How to send class 0 message on Windows Mobile 5.0?
Posted on 2006-01-06 22:21 Levins Dai 阅读(1924) 评论(0) 编辑 收藏 举报According to GSM Spec, Class 0 SMS is defined as text messages that display on MS immediately when arrive and do not have to be saved in MS or SIM. Windows Mobile 5.0 supports sending and receving class 0 SMS, but unfortunately you can only do it programmatically.
There is a managed method Microsoft.WindowsMobile.PocketOutlook.SmsMessage.Send() that can be used to send out SMS in a really convenient way. But again, it does not give a way for you to specify the message class you are going to use.
To send SMS with given message class, you should call Cellcore function: SmsSendMessage():
HRESULT SmsSendMessage (
const SMS_HANDLE smshHandle,
const SMS_ADDRESS * const psmsaSMSCAddress,
const SMS_ADDRESS * const psmsaDestinationAddress,
const SYSTEMTIME * const pstValidityPeriod,
const BYTE * const pbData,
const DWORD dwDataSize,
const BYTE * const pbProviderSpecificData,
const DWORD dwProviderSpecificDataSize,
const SMS_DATA_ENCODING smsdeDataEncoding,
const DWORD dwOptions,
SMS_MESSAGE_ID * psmsmidMessageID);
The 7th parameter is a provider-specific structure you can use to customize a couple of SMS options and flags. For general text provider data, the message class can be set throught the struct member: psMessageClass.
That's the way to go! A little bit tedious actually, but it works, :)