bladox.com Forum Index bladox.com
Turbo SIM Toolkit Adapter Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

two question

 
Post new topic   Reply to topic    bladox.com Forum Index -> Development
View previous topic :: View next topic  
Author Message
alldj
Guest





PostPosted: Wed Jun 27, 2007 7:13 am    Post subject: two question Reply with quote

Hello,I have two question,can you reply?thanks.

q1:
How can I use AT command to sent Q or A or MSG format message?
q2:
I can't sent message from any mobile,it's also said me sent abort,is use callback code.But any mobile can sent,why?

callback code:



#include <config.h>
#include <turbo/turbo.h>

#include <stdlib.h>

/* *INDENT-OFF* */

lc_char PROGMEM lc_Callback[]={
LC_EN("Callback")
LC_END
};

/* *INDENT-ON* */

u8 PROGMEM text[] = "0123456789";
u8 PROGMEM t_ms[] ="+8615921364481";


void callback_sms (u8 * s)
{
u8 *t;

t = tpdu_seek (s, T_SMS_AA);
//retval(0x9F07);
set_up_call (t, MSISDN_SMS, NULL);
}

void callback (void *data)
{
u8 *q;
u8 *tmp = malloc (100);
u8 *ms = str2msisdn (t_ms, MSISDN_ADN, MEM_R);

memcpy (tmp, text, sizeof (text)); // answer
send_sms (tmp, sizeof (text), ms, MSISDN_ADN, tsms_dcs(), 0x00, NULL, NULL);
q = create_head_msg (tmp, text);
send_sms (tmp, q - tmp, ms, MSISDN_ADN, tsms_dcs (), 0x00, NULL,NULL);
free (tmp);
free (ms);

}

void turbo_handler (u8 action, void *data)
{
switch (action)
{
case ACTION_SMS_MSG:
stk_thread (callback_sms, data);
break;
case ACTION_APP_REGISTER:
reg_sms_tag (locale (lc_Callback), t_Callback_mime, SMS_TYPE_MSG);
break;
case ACTION_INSERT_MENU:
insert_menu (locale (lc_Callback));
break;
case ACTION_MENU_SELECTION:
stk_thread (callback, data);
break;
default:
break;
}
}
Back to top
alldj
Guest





PostPosted: Wed Jun 27, 2007 9:48 am    Post subject: an new question Reply with quote

an new question:
It's not display on screen,when I sent a SMS_TYPE_MSG type message to self.


case ACTION_SMS_MSG:
stk_thread (action_menu, data);
break;
case ACTION_APP_REGISTER:
reg_sms_tag (locale (lc_Callback), t_Callback_mime, SMS_TYPE_MSG);
break;
}



void action_menu (void *data)
{
display_text_raw (data, Q_DISPLAY_TEXT_USER_CLEAR);
}
Back to top
pz
Guest





PostPosted: Thu Jun 28, 2007 7:21 am    Post subject: Re: two question Reply with quote

alldj wrote:
Hello,I have two question,can you reply?thanks.

q1:
How can I use AT command to sent Q or A or MSG format message?


You just format your outgoing message like described in http://www.bladox.com/devel-docs/group__api__tsms.html

I would recommend to send say that PID is 0x00 and send the message from turbo to a modem/phone (without turbo) - it will store it and you can see/analyze it yourself.

There is no magic in turbo sms - it's just data format with optional special PID/DCS.

Quote:

q2:
I can't sent message from any mobile,it's also said me sent abort,is use callback code.But any mobile can sent,why?

callback code:



#include <config.h>
#include <turbo/turbo.h>

#include <stdlib.h>

/* *INDENT-OFF* */

lc_char PROGMEM lc_Callback[]={
LC_EN("Callback")
LC_END
};

/* *INDENT-ON* */

u8 PROGMEM text[] = "0123456789";
u8 PROGMEM t_ms[] ="+8615921364481";


void callback_sms (u8 * s)
{
u8 *t;

t = tpdu_seek (s, T_SMS_AA);
//retval(0x9F07);
set_up_call (t, MSISDN_SMS, NULL);
}

void callback (void *data)
{
u8 *q;
u8 *tmp = malloc (100);
u8 *ms = str2msisdn (t_ms, MSISDN_ADN, MEM_R);

memcpy (tmp, text, sizeof (text)); // answer
send_sms (tmp, sizeof (text), ms, MSISDN_ADN, tsms_dcs(), 0x00, NULL, NULL);
q = create_head_msg (tmp, text);
send_sms (tmp, q - tmp, ms, MSISDN_ADN, tsms_dcs (), 0x00, NULL,NULL);
free (tmp);
free (ms);

}

void turbo_handler (u8 action, void *data)
{
switch (action)
{
case ACTION_SMS_MSG:
stk_thread (callback_sms, data);
break;
case ACTION_APP_REGISTER:
reg_sms_tag (locale (lc_Callback), t_Callback_mime, SMS_TYPE_MSG);
break;
case ACTION_INSERT_MENU:
insert_menu (locale (lc_Callback));
break;
case ACTION_MENU_SELECTION:
stk_thread (callback, data);
break;
default:
break;
}
}


What phone do you use? What exactly does/doesn't it do? Other apps, e.g. smspal work properly?
Back to top
pz
Guest





PostPosted: Thu Jun 28, 2007 7:25 am    Post subject: Re: an new question Reply with quote

alldj wrote:
an new question:
It's not display on screen,when I sent a SMS_TYPE_MSG type message to self.


case ACTION_SMS_MSG:
stk_thread (action_menu, data);
break;
case ACTION_APP_REGISTER:
reg_sms_tag (locale (lc_Callback), t_Callback_mime, SMS_TYPE_MSG);
break;
}



void action_menu (void *data)
{
display_text_raw (data, Q_DISPLAY_TEXT_USER_CLEAR);
}


This is wrong, pointer data points on some data, which may (and definetly do) contain some \0, which display_text_raw() takes as terminator. But it's the display_text() at least triggered? I.e. do you see some garbage? Here programmer with debug would help a lot - you can see what was received, what was passed to teh application and so.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    bladox.com Forum Index -> Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group