s
Quicklinks
Picture messages are small bitmap images that can be used on mobile phones as a background image, screensaver or to display the service provider's logo the phone is currently connected to.
Small black and white picture messages can be send using SMS to send coloured picture messages, SMS cannot be used, because the number of bytes that has to be transferred would require a huge number of SMS messages. This content is always sent using MMS. MMS is not yet supported by ActiveXperts Software.
To send picture messages using SMS, the picture has to be encoded as a binary message first. The binary part of a picture message containing a simple 72x28 pixel picture is encoded as follows:
| Octet(s) | Value | Description |
|---|---|---|
| 1 | 30 | Format version used, should be zero. |
| 2 | 00 | Start of text part |
| 3,4 | 00 27 | Length of the text | 5 - 32 |
54 68 69 73 20 69 73 20 61 6E 20 41 63 74 69 76 65 58 70 65 72 74 73 20 70 69 63 74 75 72 65 20 6D 65 73 73 61 67 65 |
This is an ActiveXperts picture message |
| 33 | 02 | Start of picture part |
| 34 | 48 | Width of the bitmap ( 0x48 = 72 pixels ) |
| 35 | 1C | Height of the bitmap ( 0x1C = 28 pixels ) |
| 36 | 01 | Number of colors in the bitmap ( Always 1 ) |
| 37-289 |
07 FC 00 00 00 7F FF FF FE 03 DF 00 00 00 70 00 00 3E 07 8F C0 00 00 D8 00 00 E4 0F DF E0 00 00 8C 00 07 86 1F F8 F0 00 01 86 00 1C 0C 3F E0 39 6D EF F3 00 F0 08 7F 40 1C 00 03 01 83 80 14 FF 81 CE 00 02 00 DE 00 18 FD 23 67 3B 7F 80 70 00 30 FE 06 B3 80 04 00 00 00 28 F4 8D 59 C0 0C 00 00 00 50 F8 1A AC E6 DE 00 00 00 60 F2 35 56 70 18 00 00 00 C0 E0 6A AB 38 10 00 00 00 A0 C0 D5 55 98 30 00 00 01 40 81 AA AA CC 3F FF FF FF 80 83 55 55 6C 15 55 55 55 40 86 AA AA A6 00 00 00 00 00 8D 55 55 66 00 00 00 00 00 CA AA AA CF 00 00 00 00 00 CD 55 55 9B 00 00 00 00 00 E6 AA AB 37 80 00 00 00 00 F3 55 56 6D C0 00 00 00 00 F9 AA AC 79 E0 00 00 00 00 FC D5 58 00 F0 00 00 00 00 7E 6A B0 38 F8 00 00 00 00 3F 35 64 7C 7C 00 00 00 00 00 00 00 00 00 00 00 00 00 |
The actual bitmap data. The data is encoded as 1 bit per pixel |
Because a single SMS message can only send 140 bytes of user data, the encoded data has to be splitted up. To do this there is also a user data header with segmentation and reassembly and port addressing information inserted before the message data.
The SMS and MMS Toolkit makes it easy to generate and deliver picture messages. You can send picture messages using a GSM modem (or GSM phone), or using an SMPP provider. Use the 'PictureMessage' object to format the message of the SMS, and use the regular 'GsmOut' or 'Smpp' functions to send the picture message.
The following code snippets show how to encode picture messages:
Encode a picture message:
Set objPicture = CreateObject ( "ActiveXperts.PictureMessage" ) Set objConstants = CreateObject ( "ActiveXperts.SmsConstants" ) objPicture.BitmapFile = "C:\Images\72x28.bmp" objPicture.Text = "This is an ActiveXperts picture message" objPicture.PictureType = objConstants.asPICTURE_MESSAGE nMessageParts = objPicture.Encode
Encode a caller group icon:
Set objPicture = CreateObject ( "ActiveXperts.PictureMessage" ) Set objConstants = CreateObject ( "ActiveXperts.SmsConstants" ) objPicture.BitmapFile = "C:\Images\72x14.bmp" objPicture.PictureType = objConstants.asPICTURE_CALLERGROUP nMessageParts = objPicture.Encode
Enode an operator logo:
Set objPicture = CreateObject ( "ActiveXperts.PictureMessage" ) Set objConstants = CreateObject ( "ActiveXperts.SmsConstants" ) objPicture.BitmapFile = "C:\Images\72x14.bmp" objPicture.PictureType = objConstants.asPICTURE_OPERATORLOGO objPicture.CountryCode = 204 objPicture.NetworkCode = 16 nMessageParts = objPicture.Encode
Remove the current operator logo:
Set objPicture = CreateObject ( "ActiveXperts.PictureMessage" ) Set objConstants = CreateObject ( "ActiveXperts.SmsConstants" ) objPicture.PictureType = objConstants.asPICTURE_OPERATORLOGO_RESTORE nMessageParts = objPicture.Encode
The full path to the picture file. This has to be a .bmp file with one of the following formats:
For picture messages:
72 x 14 x 1 BPP 72 x 14 x 4 BPP 72 x 14 x 8 BPP 72 x 14 x 16 BPP 72 x 14 x 24 BPP 72 x 14 x 32 BPP 72 x 28 x 1 BPP 72 x 28 x 4 BPP 72 x 28 x 8 BPP 72 x 28 x 16 BPP 72 x 28 x 32 BPP
For caller group icons and operator logos:
72 x 14 x 1 BPP 72 x 14 x 4 BPP 72 x 14 x 8 BPP 72 x 14 x 16 BPP 72 x 14 x 24 BPP 72 x 14 x 32 BPP
If a bitmap contains colors, the bitmap will be converted to black and white automatically. You can download the bitmaps used in the code samples here:
The text to be send with a picture messages. The text is diplayed below the picture on the recipients phone. This field is only used for the 'asPICTURE_MESSAGE' message type.
You can specify what sort of picture message to send, by setting this property. The following types of picture messages are supported:
| Number | ActiveXperts Constant | Description |
|---|---|---|
| 0 | asPICTURE_MESSAGE | Bitmap and text |
| 1 | asPICTURE_CALLERGROUP | Caller Line Identification Icon |
| 2 | asPICTURE_OPERATORLOGO | Operator Logo |
| 3 | asPICTURE_OPERATORLOGO_RESTORE | Remove Operator Logo |
This property is only used for operator logo's. Operator logo's are only displayed when the phone is connected to the network associated with the operator logo. To associate the logo with a network you have to specify the NetworkCode and CountryCode of the network ( MCC and MNC ).
This property is only used for operator logo's. Operator logo's are only displayed when the phone is connected to the network associated with the operator logo. To associate the logo with a network you have to specify the NetworkCode and CountryCode of the network ( MCC and MNC ).
After all parameters has been set, you have to call the 'Encode' function.
This function does the actual encoding and returns the number of SMS messages created.
In case of multiple message parts, the 'PictureMessage' object inserts the data needed to reassamble the data to a single message on the recipients phone. The object also includes the application port addressing. This means that the message is send to a 'software program' listening to that specific port, instead of displaying the message on the screen
If the 'Encode' functions returns 0, you can check the 'LastError' property to see what is going wrong.
The encoded data can be send using the Smpp or GsmOut object or queued to the SMS Messaging Server database.
Sending picture messages using the DialUp object is not supported.
To retrieve an encode message from the object, you the 'GetMessagePart' function.
Please note that you have to set the messagetype to 'asMESSAGETYPE_DATA_UDH' because the picture message data is encoded as 8 bit message data
and includes UDH information for message segmentation and application port addressing.
The samples below demonstrates how to send the messagedata using the Smpp and GsmOut objects:
Smpp:
objGsmOut = CreateObject ( "ActiveXperts.Smpp" )
objConstants = CreateObject ( "ActiveXperts.SmsConstants" )
nParts = objPicture.Encode
objSmpp.Server = "smpp.activexperts-labs.com"
objSmpp.SystemID = "AX008"
objSmpp.SystemPassword = "812056"
objSmpp.MessageRecipient = "+31647134225"
objSmpp.Connect
If objSmpp.LastError = 0 Then
objSmpp.MessageType = objConstants.asMESSAGETYPE_DATA_UDH
For i = 0 To nParts - 1
objSmpp.MessageData = objPicture.GetMessagePart ( i )
objSmpp.Send
Next
End If
objSmpp.Disconnect
GsmOut:
objGsmOut = CreateObject ( "ActiveXperts.GsmOut" ) objConstants = CreateObject ( "ActiveXperts.SmsConstants" ) nParts = objPicture.Encode objGsmOut.Device = "COM1" objGsmOut.MessageType = objConstants.asMESSAGETYPE_DATA_UDH objGsmOut.MessageRecipient = "+31647134225" For i = 0 To nParts - 1 objGsmOut.MessageData = objPicture.GetMessagePart ( i ) objGsmOut.Send Next
It also possible to send picture messages using the SMS Messaging Server. Use the following script to queue a picture message:
' Sending a picture message using the ActiveXperts SMS Messaging Server
'
Dim objMessageDB
Dim objPicture
Dim objMessageOut
Dim nParts
' Create the SMS Messaging Server API objects
Set objMessageDB = CreateObject ( "AxMmServer.MessageDB" )
Set objConstants = CreateObject ( "AxMmServer.Constants" )
' Create the SMS and MMS Toolkit objects
Set objPicture = CreateObject ( "ActiveXPerts.PictureMessage" )
Set objConstantsTk = CreateObject ( "ActiveXperts.SmsConstants")
' Encode the picture message
objPicture.PictureType = objConstantsTk.asPICTURE_MESSAGE
objPicture.BitmapFile = "C:\72x28.bmp"
objPicture.Text = "This is an Activexperts picture message"
nParts = objPicture.Encode
If ( objPicture.LastError <> 0) Then
WScript.Echo "Error occured while encoding picture message: " & objPicture.GetErrorDescription ( objPicture.LastError )
WScript.Quit
End If
' Queue the message
' Open the Message Database
objMessageDB.Open
If( objMessageDB.LastError <> 0 ) Then
WScript.Echo "Error occured while opening message database: " & objMessageDB.GetErrorDescription ( objMessageDB.LastError )
WScript.Quit
End If
' Write the messages
For i = 0 to nParts - 1
Set objMessageOut = objMessageDB.Create
If( objMessageDB.LastError <> 0 ) Then
WScript.Echo "Error occured while creating new message: " & objMessageDB.GetErrorDescription ( objMessageDB.LastError )
WScript.Quit
End If
objMessageOut.Direction = objConstants.MESSAGEDIRECTION_OUT
objMessageOut.Type = objConstants.MESSAGETYPE_SMS
objMessageOut.Status = objConstants.MESSAGESTATUS_PENDING
objMessageOut.Recipient = "+31647134225"
objMessageOut.ChannelID = 0 ' Any available SMS channel
objMessageOut.Body = objPicture.GetMessagePart ( i )
objMessageOut.BodyFormat= objConstants.MESSAGEBODYFORMAT_DATAUDH
objMessageDB.Save objMessageOut
Next
' Close the database
objMessageDB.Close
WScript.Echo "Ready"