Chapter 5. Let's Talk: Instant Wireless Messaging

This might sound obvious, but the thing that people find attractive about mobile phones isn't the innovative chipsets, advanced voice compression schemes, sophisticated data networks, sleek liquid crystal displays, or sexy plastic casing. It's the communication. The capability to reach other people and be reached, anywhere, anytime.

Text messaging picks up where voice communication leaves off. There are many times when a few thoughtful words are more efficient than a long conversation. In the desktop world, messaging programs such as Yahoo! Instant Messenger, America Online Instant Messenger (IM), and Microsoft Messenger have taken the Internet's populace, especially teenagers, by storm.

In case you've been living under a rock, all instant messenger programs work as follows: You create a list of buddies. When one of your buddies is online, you are notified. You can click on your buddy's name at any time and type a message to her. She can then type a message back.

In other words, instant messaging combines the articulate focus and assured delivery of e-mail with the immediacy of the telephone.

In the world of mobile phones, text messaging is an equally impressive and important phenomenon. Once again, the trend is being led by teens. Messages can be tapped into mobile phones and sent to and fro during classes, during work, or while on the run. You can receive a message while the phone is off, or while you are talking on the other line. Messaging fanatics have become perfectly adept at typing out complex sentences with tiny numeric keypads.

Messaging And Gaming

Messaging will play a major role in gaming. Many of today's games (such as Electronic Art's Majestic) tap into instant messages as a way of communicating with the player. Tomorrow's handheld games will likely use messaging for many reasons:

  • Friends can be notified when another friend is logged in and automatically be matched up to join the same game session.

  • Teams of players can cooperate during a big multiplayer game.

  • Competitors can tease, jab, brag, or cry to each other during games.

  • Game status information such as top players, scores, hints, or other meta-game goodies can be sent as hourly, daily, or weekly updates.

  • Messaging can be part of the game itself. For example, in a persistent world space-battle game you might be able to set up a space station with certain defenses. You can then set the captain of the station to notify you if it is being attacked. Log off the game and go about your business. A few hours or days later, while you're in the middle of an important business meeting, you might get a ring on your cell phone notifying you that your station's hull is receiving massive damage from a laser attack. You can then excuse yourself from the meeting and take care of more important business….

  • Some carriers are allowing financial transactions through messaging, so players can pay for their game sessions this way.

Short Message Service (SMS)

The world's foremost messaging standard is the Short Message Service (SMS), which is a simple format allowing for the transmission of alphanumeric messages. Almost every mobile service provider offers SMS messaging in one form or another.

If you think of e-mail as a letter, an SMS message is more like a postcard. With SMS, you can send a quick message to another person by using her phone number as the destination address.

SMS isn't as popular in the United States as it is in Europe and Asia. Whereas American mobile carriers make it difficult for their subscribers to message outside their networks, most European carriers have standardized messaging, enabling almost any mobile phone to send text messages to any other.

According to the GSM Association, more than 50 billion SMS text messages were sent over the world's GSM networks in the first three months of 2001, and the group forecasts that well over 200 billion global messages will be sent throughout the course of the year. In 1999, the average number of SMS messages was 1 billion per month. Now it's more than 16 billion, and heading toward 25 billion!

Different carriers charge different rates for SMS. Some carriers actually charge 10 cents to a dollar per message! Others offer a set number of prepaid SMS messages per month.

SMS Specifics

URL: http://www.etsi.org/

SMS was created by the European Telecommunications Standards Institute (ETSI).

SMS messages are pure text. On GSM networks, a standard text message can be a maximum of 160 characters long. Each character is usually defined by a 7-bit alphabet similar to ASCII that includes major punctuation, accented letters, mathematic symbols, and numerals. Some other networks permit a maximum of 190 characters.

There are two formats in which you can send and receive SMS messages:

  • Text mode

  • PDU mode

Additionally, there are specialized versions of SMS that enable instant pop-up messages, as well as the capability to tack on multimedia and contact information. Some of these formats will be discussed later in this chapter.

SMS Text Mode

SMS's Text mode is a preset and simplified encoding of the bit stream represented by the PDU mode. In other words, Text mode is the standard way in which English alphanumeric messages can be sent back and forth.

Most mobile phones support Text mode, and it acts as a kind of SMS lowest common denominator standard.

Protocol Description Unit (PDU) Mode

Using the full PDU mode, any type of encoding can be created and implemented.

Using PDU mode adds a whole bunch of extra headers to the message, increasing the message size and telling the mobile phone exactly how to encode the alphabet the way the sender intended it.

Special SMS messages can be delivered from one carrier to another using PDU mode.

Smart Messaging

URL: http://www.forum.nokia.com

Smart Messaging is an enhanced SMS format designed by Nokia. Many other phones support similar enhanced messages. These usually use a special 8-bit alphabet, with a maximum of 140 characters per message. These 8-bit characters are usually designated for digital data, not text. Data that can be sent over SMS depends on the carrier, but typical data formats enable the following:

  • Simple black and white images.

  • New operator logos. For example, if you change your phone service from Sprint to Nextel, then the Nextel logo can be sent down using SMS.

  • “Musical notes” for new ring tones.

  • Business cards and other contact information.

  • Calendar and scheduling information.

  • Over-the-air provisioning of WAP access, enabling a carrier to send bookmark lists, WAP homepage and server settings, and other WAP options.

  • The WAP gateway can send the phone URLs using SMS. The phone is smart enough to grab the URL from the SMS message text and request the appropriate WML document.

Unicode Messages

Additionally, 16-bit messages are enabled on many networks. This format can handle a maximum of only 70 characters per message.

The extended alphabet is used to support the Unicode (UCS2) format, capable of showing characters from alphabets such as Chinese, Japanese, Korean, Cyrillic, Hebrew, and Arabic.

More information about Unicode can be found at http://www.unicode.org/

Flash SMS

Many mobile phones support Flash SMS messages. These messages will literally flash up on the screen as soon as they arrive, without the need for the user to navigate through option menus. This provides more of a classic “instant messenger” feel.

Most Nokia, Siemens, Ericsson, and Motorola phones support this type of messaging. The user usually has the option to turn Flash SMS off if she finds it distracting.

To send a Flash SMS, the message data-coding scheme must be set to 16-bit Unicode with the message class 0, and the message should start with the character 0001. Thus, the message length itself can only be 69 Unicode characters.

Short Message Service Centers (SMSCs)

All SMS messages are routed through a central server, known as a Short Message Service Center (SMSC). The SMSC is software that basically acts as a post office. It sits atop the operator's network and queues up messages, bills the sender, routes messages to phones, notifies the sender if the message can't be sent, and even sends return receipts when the messages are read.

The reason an SMSC is needed is that mobile phones are not always on. Users often switch their phones off, are out of the network coverage area, or run out of battery power. The SMSC stores each message and queues it up, trying to send it out as soon as possible. If the phone is unavailable, the SMSC will periodically keep trying. After the message is successfully sent, the SMSC deletes the message from its cache and continues on with other work.

Most operators permit you to tap into their SMSC using the Web or other open Internet connections. Every provider uses different protocols for their SMSC. For example, CMG uses a protocol called UCP/EMI, Logica uses SMPP, SEMA uses SMS2000, and Nokia uses CIMD.

NOTE

Game developers who plan on sending a lot of messages may need special permission or access from various carriers. Carriers are also sensitive about the type of information you send over their network, and want to avoid anything that can be construed as unwanted advertising, or spam.

Figure 5.1 shows the typical SMS architecture: Either a phone or Web server gateway machine can connect to a SMSC to send or receive SMS messages.

The SMS architecture.

Figure 5.1. The SMS architecture.

Free SMS Service

The following are several SMS services you can use to send SMS messages from the Web:

There are also several services that enable you to use SMS to reach various Internet gateways. Many service providers have created their own portal, enabling you to send and synchronize your e-mail, schedule, or other contact information using SMS. For example

Some carriers also allow you to use SMS to access the wider Internet. For example, one free server can be found at http://www.excell.to/. After you have registered, you can get the phone number of the gateway (which is in Italy) and actually send out an e-mail using SMS and the following format:

EMAIL user@domain .subject.message body

Actually Sending SMS Messages

Desktops or servers can send SMS messages directly to a mobile phone by using the phone or SMCS software as a modem. Many mobile phones have cables enabling you to attach the phone to your computer's serial port.

If you are interested in creating your own SMS server, this can be a good way to tap into the wireless network and begin playing around.

To use SMS, send standard AT modem commands through the serial port and into the phone. For example

  • AT+CMGF=1

    Changes the SMS sending mode to Text mode. Type 0 is used for PDU mode.

  • AT+CMGS="5551234567"

    <message>
    
    <Ctrl>+<Z>
    

    This sequence dials the number (555-123-4567 in this case) and sends the message.

To test some of this stuff out, you can use the Hyper Terminal program that comes with Windows (3.1 or later).

Luckily, however, there are some ready-made SMS tools for you to tap into or interface with.

SMS Tools

There are numerous SMS tools on the market, most of them geared toward carriers, large corporations, and other organizations that want to add SMS capabilities to their communications arsenal.

The following are some examples:

  • SMS Gateway

    http://www.winsms.com/

    A utility that lets anyone send and receive text and binary SMS messages over GSM. The package also comes with a gateway that other Windows applications can communicate with using DDE, OLE, or the command line. If you want to create a huge game reliant on SMS, this package is worth checking out.

  • SMS-JDK

    http://www.noctor.com/

    This package, by Noctor Consulting, is a 100% Java interface to the SMS protocol. You can create Java applications that talk to the SMSC synchronously or asynchronously, with multithreading and custom call-backs. This means that several Java objects can communicate with one or more SMSCs at the same time. Additionally, applets can use a special SMS-JDK proxy to communicate with an SMSC.

  • Kuulalaakeri

    http://www.kuulalaakeri.com/

    This is a Unix-based SMS gateway, based on the HTTP request method. You can tap into the API with any other program.

SMS and J2ME

If you want to create a Micro Java game that uses wireless messaging, you can send out SMS messages using the followings steps:

  1. Gain access to a SMSC that supports your subscribers. You might need to contact various wireless networks to arrange this. There are also companies that can act as a third party provider of SMS services for you.

  2. Create or buy an SMS gateway server that lets you send commands to the SMSC over the Internet.

  3. Create a database indicating different game players, what type of SMS service they use, and what their phone number is.

  4. When you want to send a message to a user, have the gateway send the message to the appropriate SMSC, along with the number to dial.

  5. The SMSC will ship off the desired message to the desired user.

If you want to receive SMS messages from game players, then the process is similar:

  1. Create or hire an SMS out to a service that can handle the receipt of SMS messages. You will need to give out a telephone number that players can dial.

    Some game developers have struck deals with wireless providers and been given access to a short, special number. For example, to play Sonera Zed's Fisupeli fishing game, players can begin fishing merely by sending out a text message that says “FISU” to the special phone number 400.

  2. When players send an SMS message to this number, the SMSC will decode the message and route it to your game server, along with the phone number or ID of the person who sent the message.

  3. You can look up the player in your user database and adjust their game state as needed, and possibly send them out another SMS message as a response.

Sample Server Code

Actually sending an SMS message, then, might work according to the following process.

You will need to have all the following pieces in place:

  • The cell phone number of a player. Let's call the variable pNumber.

  • The message to send, stored in a String variable called pMessage.

  • Knowledge of which cell phone provider the player is using.

  • Access to that cell phone provider's SMSC.

The access will usually be through a servlet with a command structure similar to

http://www.myprovider.com/sendsms?msg=Message&destination= 555-765-4321&callback
_number=555-123-4567 &priority=normal& date=4/15&time=10:30

To send a message to a specific provider, your Java code will look similar to the following:

String smsMsg = new String();
smsMsg = "msg=" + URLEncoder.encode(pMessage);
smsMsg = smsMsg + "&destination=" + URLEncoder.encode(pNumber);
smsMsg = smsMsg + "&callback_number=123456789";
smsMsg = smsMsg + "&priority=normal";

int date,month,hour,minute;
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("EST"));
date = cal.get(cal.DAY_OF_MONTH);
month = cal.get(cal.MONTH) + 1;
hour = cal.get(cal.HOUR);
minute = cal.get(cal.MINUTE) + 1;

smsMsg = smsMsg + "&date=" + URLEncoder.encode(month + "/" + date) ;
smsMsg = smsMsg + "&time=" + URLEncoder.encode(hour + ":" + minute) ;

URL cellUrl = new URL("http://www.myprovider.com/sendsms");
HttpURLConnection conn = (HttpURLConnection) cellUrl.openConnection();
conn.setRequestMethod("POST");
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestProperty ("Content-Type", "application/x-www-form-urlencoded");

DataOutputStream ds = new DataOutputStream (conn.getOutputStream ());
ds.writeBytes (smsMsg);
ds.flush ();
ds.close ();

Note that you use the URLEncoder.encode() method to convert any strings into valid escape characters able to be sent over HTTP.

Multimedia Messaging Service (MMS)

URL: http://www.wapforum.org

URL: http://www.3gpp.org/

Multimedia Messaging Service (MMS) is the next generation of wireless messaging. Focusing on entertainment applications, MMS is like a supercharged version of SMS with the capability to send e-mail, audio, video, and presentations. The MMS specification was created by the WAP Forum and the Third Generation Partnership Project (3GPP).

MMS uses a language called Synchronized Multimedia Integration Language (SMIL), which acts as a sort of script indicating exactly how and when multimedia should be displayed. This permits you to create small presentations and animations, not to mention rich game scenarios.

When a user gets an MMS message, a sort of slide show with audio and graphics begins playing right on their phone's screen. The user can generally choose to rewind and watch the slide show again, delete it, or store it for later viewing. Phones can only store a limited number of MMS messages before running out of room, so MMS messages usually expire after a few days.

NOTE

In general, MMS is intended only for carrier networks that can transfer data at a rate of 14.4Kbps or better.

Multimedia Message Service Centers (MMSC)

Just as SMS has its SMSCs, MMS has MMSCs that act as a central post office to send and receive each message. An entire MMS is sent in the background, using WAP's Wireless Service Protocol (WSP) to “push” content down to the phone. As such, WAP 1.2 or better is needed to support MMS.

MMS messages might take a while to reach the phone. For example, if a message is 50 kilobytes long (400 kilobits), and is sent over a network that supports 10Kbps bandwidth, it will take 40 seconds to send the message down. However, MMS phones will not notify users of a new message until it has been entirely downloaded and is ready to play. This makes messages “seem” instant.

MMSC also features distribution lists, enabling a sender to compose one message for many recipients.

Crack a SMIL

URL: http://www.w3.org/TR/REC-smil/

The Synchronized Multimedia Integration Language is, as its name implies, a language that enables you to synchronize the playback of multimedia content. The language can juggle music, voice, images, text, and even video. It shows exactly where visual elements are laid out on the screen, when to play audio elements, and how long everything is displayed before switching to a new “slide.”

The language is based on XML, which is very similar to HTML, and was developed by major television, audio, new media, and video companies. The World Wide Web Consortium (W3C) standardized the final specification.

The content in SMIL messages is encapsulated using standard MIME types, with various phones capable of displaying and dealing with different formats of multimedia. Almost every MMS-capable phone will support these formats:

  • Text

  • JPEG

  • GIF

  • AMR Voice

Additionally, different carriers will permit different message lengths. Nokia, for example, is planning on permitting messages from 30 to 100 kilobytes in size.

Simple SMIL Example

Using MMC and SMIL, then, you could create a game that shows a tiny image of your evil nemesis taunting you in a left-hand pane while text statistics about your army scroll by on the right. Meanwhile, scary music could play.

A SMIL file to achieve this might look something like this:

<smil >
 <head >
 <layout >
  <root-layout width="580" height="213" background-color="black"/>
  <!— Text region —>
  <region id="text" left="0" top="0" width="50" height="100"/>
  <!— Image region —>
  <region id="images" left="101" top="0" width="50" height="100"/>
 </layout>
 </head >
 <body>
 <par>
  <text src="message.txt" region="text_region" begin="1s" />
  <img src="badguy.gif" region="images_region" begin="1s" />
  <audio src="scary.au" clip-end="145s" />
  </par>
 </body>
</smil>

The preceding file only shows one sequence. You could easily use SMIL to set a duration for the sequence and then swap out graphical elements, add new text, and so on.

Enhanced Messaging Service (EMS)

URL: http://www.3gpp.org/

Because networks and phones that can support MMS will take a while to hit the market, Alcatel, Ericsson, Motorola, and Siemens have developed an interim messaging standard called the Enhanced Messaging Service (EMS). The standard is defined by the Third Generation Partnership Project (3GPP).

EMS adds images, audio, melodies, and animations to SMS. Unlike MMS, which turns messages into a full-fledged slide show, EMS works more like a still picture. For instance, if you receive an EMS message, a special icon will indicate that an image, some music, or even a brief animation is attached. The EMS message can even combine types, so that a black and white graphic appears next to the message while a small clip of music plays in the background.

Features that EMS supports include the following:

  • Text formatting—Text can be justified right, center, or left. And a large or small font can be used along with bold, italic, underlined, or strikethrough text.

  • Black and white bitmap graphics—There are three supported graphic formats. Small (16×16 pixels), large (32×32 pixels), or custom. The maximum picture size is 96×64.

  • Audio—You can compose simple melodies using 10 predefined sounds such as chimes, chords, ding, “ta da,” claps, or a drum. You can also define and transmit your own 128-byte sounds.

  • Animation—Two sizes of animation will be supported, (8×8 pixels) and large (16×16 pixels). Many phones will have predefined animations stored on the phone showing characters with emotions such as sad, happy, skeptical, flirty, and grieving. These animations can help punctuate text messages. Custom animations can also be sent over the air.

EMS-capable phones will begin shipping at the end of 2001 and are expected to be popular and widely used near the end of 2002.

Summary

As you can see, messaging is simple to program. In fact, the key to dealing with messaging has to do more with setting up relationships with wireless carriers than hardcore programming or technical know-how.

Messaging provides an extremely compelling way to push content to game players, as well as a simple way of having players send information back to the game. Text and multimedia messaging will only continue to grow in popularity as it catches on with more and more people.

The next chapter will discuss the i-mode network, which has taken wireless Japan by storm. The Compact HTML language used to create content for i-mode will also be explained.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.252.204