char *gsm_to_cdmapdu(char *msg) { char to[256]; char message[256]; static char hexpdu[512]; SmsAddressRec smsaddr; sms_address_from_str(&smsaddr,"000000",6); SmsPDU pdu=smspdu_create_from_hex( msg, strlen(msg) ); if(smspdu_get_receiver_address(pdu,&smsaddr)<0) { LOGE("Error: no receiver address"); smspdu_get_sender_address(pdu,&smsaddr); } sms_address_to_str(&smsaddr,to,256); if(to[0]=='+') { // convert + to 00 otherwise international sms doesn't work memmove(to+1,to,255); to[0]='0'; to[1]='0'; } int length=smspdu_get_text_message(pdu, message, 256); message[length]=0; smspdu_free(pdu); LOGD("GSM Message:%s To:%s\n",message,to); encode_cdma_sms(hexpdu,to,message); return hexpdu; }
char *gsm_to_cdmapdu(char *msg) { char to[256]; char message[256]; static char hexpdu[512]; SmsAddressRec smsaddr; sms_address_from_str(&smsaddr,"000000",6); SmsPDU pdu=smspdu_create_from_hex( msg, strlen(msg) ); if(smspdu_get_receiver_address(pdu,&smsaddr)<0) { LOGE("Error: no receiver address"); smspdu_get_sender_address(pdu,&smsaddr); } sms_address_to_str(&smsaddr,to,256); int length=smspdu_get_text_message(pdu, message, 256); message[length]=0; smspdu_free(pdu); LOGD("GSM Message:%s To:%s\n",message,to); encode_cdma_sms(hexpdu,to,message); return hexpdu; }