GEOS SDK TechDocs
|
|
3 IMEI Code Number
|
5 New Standard Monikers, Bitmaps
In addition to the old way to send messages to application using their
GeodeToken
in front of the actual data, a new user data header is now introduced. Otherwise sending and receiving messages has not changed. The new header adopts the concept from Narrow Band Socket specification.
The new header format is //SCKddoo or //SCKLddddoooo where dd (and dddd) represent "destination port" and oo (and oooo) represent "originator port". Both these headers are terminated with space character.These ports are ascii coded hexadecimal numbers.
Short header covers ports from 0 to 255 (00 to FF in hex) and the longer form from 0 to 65535 (0000 to FFFF in hex).
The range of port numbers is divided to reserved port address range and to dynamic and/or private port address range. Usage of port address range 0 to 49151 is restricted and assignment of a port in this range requires contacting port address assignment authority. The reserved port address range is further divided to ports for "well-known protocols" (range 0 to 239 and 256 to 1024) and to registered ports (range 1025 to 49151). Nokia has reserved ports 5500 to 5599 for company-specific protocols. Port addresses in the dynamic address range 240 to 255 or in the dynamic and/or private address range 49152 to 65535 may be used freely by any vendor.
In order to receive these messages application must register themselves to SMS receive application. This can be done using smreg library. This library offers functions for registering and unregistering.
SMRegRegisterApplication()
takes there parameters:
GeodeToken
of your application, a pointer to buffer containing "port numbers" you register for and number of messages you are registering. Port numbers must be ASCII coded hexadecimal numbers.
Code Display 13-3 Registering to receive "destination port" SMS Messages
@method TestProcessClass, MSG_TEST_PROCESS_REGISTER
{
GeodeToken appl;
TCHAR messageProtocol[5];
word protocol;
/* We register ourselves to listen port 43962 that is ABBA in hex. */
protocol = 43962;
appl.GT_chars[0] = `T';
appl.GT_chars[1] = `E';
appl.GT_chars[2] = `S';
appl.GT_chars[3] = `T';
appl.GT_manufID = 11;
/* Let's ask smreg library to convert 43962 to ascii coded hex for us. */
SMRegIntegerToHex( protocol, messageProtocol,
SMRITH_NULL_TERMINATE |SMRITH_WORD_LENGTH);
/* Now we have messageProtocol = "ABBA" */
SMRegRegisterApplication( appl, messageProtocol, 1);
}
You can register more than one port by calling the function:
SMRegRegisterApplication( appl, "ABBADADA0055", 3);
Then you will receive messages ABBA, DADA and 55.
The function returns a
SMRegResult
value: SMRR_OK if your registration was succesful; otherwise it will be SMRR_FAIL.
SMRegIntegerToHex()
function converts passed decimal integers to ascii coded hexadecimal strings. You pass a word containing integer to be converted, a character pointer where the result is stored and flags how the conversion is done. You can convert either byte length integers i.e. 0 to 255 and the result is two characters to word length i.e. 0 to 65535 and the result is four characters. By default the destination string is not null terminated, but if you pass flag SMRITH_NULL_TERMINATE null is added at the end of the string.
If you want to stop receiving messages you can unregister yourself. This can be done using
SMRegUnregisterApplication()
function. The parameters are identical to SMRegRegisterApplication. In addition SMMR_OK and SMRR_FAIL, this unregister function may return SMRR_APPLICATION_NOT_REGISTERED to indicate that you were not registered to listen this message.
The message routing table is stored to .INI file. You may freely modify it yourself, but it is not recommended. More than one application may want to listen same messages, so writing .INI file direct may cause problems to other applications. The category is SMSRouteTable and port numbers represent keys underneath.
Code Display 13-4 INI file: SMSRouteTable example
Here TEST application wants to receive messages 00F0 and ABBA and TES2 wants to receive message ABBA.
[SMSRouteTable]
00F0 = "TEST",11
ABBA = { "TEST",11
"TES2",11 }
GEOS SDK TechDocs
|
|
3 IMEI Code Number
|
5 New Standard Monikers, Bitmaps