jplaschke
Joined: 04 Mar 2009 Posts: 23
|
Posted: Fri Mar 27, 2009 3:05 pm Post subject: pz - please help. stk_cmd for sms |
|
|
Do you have any idea what is wrong with this. I get a return 21 in the terminal response.
It means "Network currently unable to process command"
I tried just sending regular data with out UDH but it does not work either. It gets the same 0x21 response.
Thank you
Code: |
res = msisdn (alpha);
if (res != ENULL && res != NULL)
{
//ms = str2msisdn(&res[2],MSISDN_ADN, MEM_R);
ms = msisdncpy (res, MSISDN_ADN, MEM_R);
ms = msisdn2str (ms, MSISDN_ADN,MEM_R);
ms = str2msisdn (ms, MSISDN_SMS,MEM_R);
tmp = malloc (20);
//q = create_head_q (tmp, t_Position_mime, ms, MSISDN_ADN);
//send_sms (tmp, q - tmp, ms, MSISDN_ADN, 0x16, tsms_pid (), NULL,
// NULL);
mslen = ms[0];
buf[len++] = T_SMS_TPDU | CR_FLAG;
buf[len++] = 0; // fill in length later
buf[len++] = 0x1; //0x41; // user data header indicator = 1, SMS-SUBMIT
buf[len++] = msg_ref++; // TP-MR message reference TODO increment this number by one each time
for (i=0; i<mslen; i++)
{
buf[len++] = ms[i];
}
buf[len++] = 0x7F; //TP-PID
buf[len++] = 0x16; //TP-DCS
// add user data header here
buf[len++] = 17; // user data length TODO fill this in
buf[len++] = 11; // user data header length
buf[len++] = 0x7F; // user data IE
buf[len++] = 0; // length of user data header IE
buf[len++] = 0; // null field
buf[len++] = 0; // command packet length
buf[len++] = 2; // command packet length
buf[len++] = 0; // spi 1st octet
buf[len++] = 0; // spi 2nd octet
buf[len++] = 4; //
buf[len++] = 'T'; // secure data
buf[len++] = 'h';
buf[len++] = 'i';
buf[len++] = 's';
buf[len++] = 'h'; // unsecure data
buf[len++] = 'e';
buf[len++] = 'l';
buf[len++] = 'p';
buf[1] = len - 2 ;
//for (i = 0; i < strlen(t_Text_ss); i++)
//buf[len++] = rb(t_Text_ss+i);
term_resp = stk_cmd (STK_CMD_SEND_SMS, 0x00, DEV_ID_ME, len);
len=term_resp[0];
for(i=0;i<len;i++)
{
r = sprintch (r, term_resp[i]);
}
r[len] = 0;
display_text_raw (buf2,
Q_DISPLAY_TEXT_HIGH_PRIORITY | Q_DISPLAY_TEXT_USER_CLEAR);
|
|
|