|
|
YOUR FEEDBACK
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
TOP THREE LINKS YOU MUST CLICK ON Feature
Messaging Is a Simple Game: Tic-Tac-Toe with SMS
Sybase 365 aids the delivery of nearly 6 billion messages each month
By: Ian Thain
Feb. 25, 2008 10:00 AM
Digg This!
Page 2 of 2
« previous page
Think about it - SMS users are acting as message producers and consumers and are taking advantage of this transport in a number of ways.
Hold on! I can hear you now... SMS messages are based upon text... Are they secure? These pieces of information can be coded or constructed in a way so that only the application creating or receiving the message would understand the message payload and be able to process it in a meaningful way, which will be good enough for most. What about the real world? In my famous and IMHO ultimate PocketBuilder application, Insurance Assessor, the application used SMS in various ways. The Insurance Assessor could automatically send a message to the next customer while traveling to them or even send a message informing them of a slight delay. The application can also receive SMS messages from the back office that will either increase the priority of certain appointments or cause the application to connect and synchronize, maybe to receive new data. All of these messages were made up of identifiers that mean nothing to anything other than both systems. An enhancement I've always though of adding is to have the application periodically SMS the latitude and longitude of the Assessor to the back office so that systems can keep track and maybe make intelligent decisions on whom to allocate new appointments to. Question for you: Can you utilize this sort of messaging in your architecture?
How to Program for SMS? With PocketBuilder it's so easy to do as we can use the SMSSession object. The SMSSession object must first be opened with an SMSProtocol object that is a system structure that stores the data encoding and message mode of an SMS message (see Listing 1). Now we can use the SMSSession object's one event, incommingmessage, which will be fired each time an SMS is received. For this event to be called, the PKSMSxx.DLL "shim" must be installed and registered with the operating system (see Listing 2). The event has two arguments of smsaddress and smsmessage. This is the area where we can code the process that will decide if it is a message we need to process for the application. Currently the best way is to look at the start of the message for some sort of identifier. If the identifier is found, the application can process the rest of the smsmessage and return either TRUE or FALSE. The return value of TRUE will prevent the message from entering the Windows Mobile Messaging "inbox" and FALSE to allow normal (default) processing to continue after our application code (see Listing 3). The next point is to know how to send an SMS from within an application and again it centers on the SMSSession object. An SMSMessage object is a system structure that stores the text of an SMSMessage object and an SMSAddress object is a system structure that stores the address and address type of an SMSMessage object. Once all those are populated, the SMS can be sent with the Send function of the SMSSession object (see Listing 4). For the application, I chose an SMS address type of smsat_international! So the opponent's cellphone number at the top of the screen would need to be input via an edit mask in the form of +xx etc. What is the logic behind the messages that power the game (see Figure 3)? Once each player inputs their opponent's cellphone number and clicks the "Opponent" button, the game starts. The local player will always see their turn as an X and his opponent's turn as O. I'm not going to waste time showing or explaining the logic on how to check for a winning move, but rest assured that it is triggered after the player clicks on the screen to make a move - which triggers an SMS to be sent - or the application receives an SMS, which is the opponent's move. All the SMSs contain an identifier of "PKTTT:", followed by either "cellx" where x is the number of the cell 1-9 (top left to bottom right) or a question to play again, etc. NOTE to SYS-CON the graphics above were taken from MS PowerPoint
Summary Page 2 of 2 « previous page WIRELESS BUSINESS & TECHNOLOGY LATEST STORIES . . .
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||