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 also supported by the SMS and MMS Toolkit.
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. This is done while sending the encoded messages through the SmsProtocolSmpp or SmsProtocolGsm object.
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 'SmsDataPicture' object to format the message of the SMS, and use the regular 'SmsProtocolGsm' or 'SmsProtocolSmpp' functions to send the picture message.
The following code snippets show how to encode picture messages:
Encode a picture message:
Set objPicture = CreateObject ( "ActiveXperts.SmsDataPicture" ) Set objConstants = CreateObject ( "ActiveXperts.SmsConstants" ) objPicture.BitmapFile = "C:\Images\72x28.bmp" objPicture.Text = "This is an ActiveXperts picture message" objPicture.PictureType = objConstants.asPICTURE_MESSAGE objPicture.Encode
Encode a caller group icon:
Set objPicture = CreateObject ( "ActiveXperts.SmsDataPicture" ) Set objConstants = CreateObject ( "ActiveXperts.SmsConstants" ) objPicture.BitmapFile = "C:\Images\72x14.bmp" objPicture.PictureType = objConstants.asPICTURE_CALLERGROUP objPicture.Encode
Enode an operator logo:
Set objPicture = CreateObject ( "ActiveXperts.SmsDataPicture" ) Set objConstants = CreateObject ( "ActiveXperts.SmsConstants" ) objPicture.BitmapFile = "C:\Images\72x14.bmp" objPicture.PictureType = objConstants.asPICTURE_OPERATORLOGO objPicture.CountryCode = 204 objPicture.NetworkCode = 16 objPicture.Encode
Remove the current operator logo:
Set objPicture = CreateObject ( "ActiveXperts.SmsDataPicture" ) Set objConstants = CreateObject ( "ActiveXperts.SmsConstants" ) objPicture.PictureType = objConstants.asPICTURE_OPERATORLOGO_RESTORE 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
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 ). For a list of network codes click here.
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 ). For a list of network codes click here.
After all parameters has been set, you have to call the 'Encode' function. If everything is okay, the encoded data is stored in the 'EncodedMessage' property.
The encoded data can be send using the SmsProtocolSmpp or SmsProtocolGsm 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, using the 'EncodedMessage' property. 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 application port addressing. The samples below demonstrates how to send the messagedata using the SmsProtocolSmpp and SmsProtocolGsm objects:
SmsProtocolSmpp:
objSmsProtocol = CreateObject ( "ActiveXperts.SmsProtocolSmpp" )
objSmsMessage = CreateObject ( "ActiveXperts.SmsMessage" )
objConstants = CreateObject ( "ActiveXperts.SmsConstants" )
objPicture.Encode
objSmsProtocol.Server = "smpp.activexperts-labs.com"
objSmsProtocol.SystemID = "AX008"
objSmsProtocol.SystemPassword = "812056"
objSmsProtocol.Connect
If ( objSmsProtocol.LastError = 0 ) Then
objSmsMessage.Recipient = "+31647134225"
objSmsMessage.Format = objConstants.asMESSAGEFORMAT_DATA_UDH
objSmsMessage.Data = objPicture.EncodedMessage
objSmsProtocol.Send ( objSmsMessage )
End If
objSmsProtocol.Disconnect
SmsProtocolGsm:
objSmsProtocol = CreateObject ( "ActiveXperts.SmsProtocolGsm" ) objSmsMessage = CreateObject ( "ActiveXperts.SmsMessage" ) objConstants = CreateObject ( "ActiveXperts.SmsConstants" ) objPicture.Encode objSmsProtocol.Device = "COM1" objSmsMessage.Format = objConstants.asMESSAGEFORMAT_DATA_UDH objSmsMessage.Recipient = "+31647134225" objSmsMessage.Data = objPicture.EncodedMessage objSmsProtocol.Send ( objSmsMessage )
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 ( "AxSmsServer.MessageDB" )
Set objConstants = CreateObject ( "AxSmsServer.Constants" )
' Create the SMS and MMS Toolkit objects
Set objPicture = CreateObject ( "ActiveXperts.SmsDataPicture" )
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"
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 message
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.EncodedMessage
objMessageOut.BodyFormat= objConstants.MESSAGEBODYFORMAT_DATAUDH
objMessageDB.Save objMessageOut
' Close the database
objMessageDB.Close
WScript.Echo "Ready"