Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Anyone knows the solution???

I think that is because you send the message as Unicode string and the device encoding for SMS is not Unicode.
In BREW 2.1 I am sure that is not Unicode but in BREW 3.1 you have to check the device encoding for SMS:
//from BREW API
if (nDeviceEncoding == AEE_ENC_UNICODE)
{
ITAPI_SendSMS (pITapi, "8581112222", (char*)STRTOWSTR("Hello World", pBuffer, nBufSize), 0, MyMOSMSNotify, pMe );
ITAPI_SendSMS ( pITapi, "foo@sample.com", (char*)STRTOWSTR("Hello World", pBuffer, nBufSize), 0, MyMOSMSNotify, pMe );
}
else
{
ITAPI_SendSMS (pITapi, "8581112222", "Hello World", 0, MyMOSMSNotify, pMe );
ITAPI_SendSMS ( pITapi, "foo@sample.com", "Hello World", 0, MyMOSMSNotify, pMe );
}

I think that is because you send the message as Unicode string and the device encoding for SMS is not Unicode.
In BREW 2.1 I am sure that is not Unicode but in BREW 3.1 you have to check the device encoding for SMS:
//from BREW API
if (nDeviceEncoding == AEE_ENC_UNICODE)
{
ITAPI_SendSMS (pITapi, "8581112222", (char*)STRTOWSTR("Hello World", pBuffer, nBufSize), 0, MyMOSMSNotify, pMe );
ITAPI_SendSMS ( pITapi, "foo@sample.com", (char*)STRTOWSTR("Hello World", pBuffer, nBufSize), 0, MyMOSMSNotify, pMe );
}
else
{
ITAPI_SendSMS (pITapi, "8581112222", "Hello World", 0, MyMOSMSNotify, pMe );
ITAPI_SendSMS ( pITapi, "foo@sample.com", "Hello World", 0, MyMOSMSNotify, pMe );
}

Well, I've tried your idea. But the result is the same.
Maybe it's required to make some format for message body?

Well, I've tried your idea. But the result is the same.
Maybe it's required to make some format for message body?

Is your string \0 or null terminated?

Is your string \0 or null terminated?

Yes. It is NULL-terminated.
I've also tried to add \r and \n and \r\n symbols at the end of string. But this has no effect.

Yes. It is NULL-terminated.
I've also tried to add \r and \n and \r\n symbols at the end of string. But this has no effect.

From what I recall an SMS has a maximum length of 160bytes not including the header size You could try allocating that amount, clearing it all to 0 and add your message just to the start so that it doesn't try passing more data than it has available. Just a wild guess but could just work.

From what I recall an SMS has a maximum length of 160bytes not including the header size You could try allocating that amount, clearing it all to 0 and add your message just to the start so that it doesn't try passing more data than it has available. Just a wild guess but could just work.

Nope. The first thing i've tried is check on NULL at the end of string and try to make whole buffer zero-inited...
Still seraching for solution...

Nope. The first thing i've tried is check on NULL at the end of string and try to make whole buffer zero-inited...
Still seraching for solution...

Quote: int sz = ( WSTRLEN(sMsg) + 1 ) * sizeof(AECHAR); // size of sms...
AECHAR* buff = (AECHAR*) MALLOC( sz );
did you try creating a buffer to the maximum length as i suggested? as this would only give in the example "hello" 6 aechar characters or 12 bytes. Not 160.

Quote: int sz = ( WSTRLEN(sMsg) + 1 ) * sizeof(AECHAR); // size of sms...
AECHAR* buff = (AECHAR*) MALLOC( sz );
did you try creating a buffer to the maximum length as i suggested? as this would only give in the example "hello" 6 aechar characters or 12 bytes. Not 160.