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 

Sending SMS automatically jumps phone to Turbo menu?

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



Joined: 13 Apr 2011
Posts: 6

PostPosted: Mon May 02, 2011 9:45 pm    Post subject: Sending SMS automatically jumps phone to Turbo menu? Reply with quote

I wrote a program that is meant to send a delayed SMS message. That is, I input a message and destination, activate a timer, and when the timer ends, it sends the SMS. Here's the menu option that activates the timer:

Code:

u8 PROGMEM msg_timer[] = "Timer set for one minute.";
u8 PROGMEM msg_no_timer[] = "No timer available.";
u8 Menu_Func_Send(SCtx *ctx, u8 action) {
  if (action == APP_ENTER) {
   
   
    u8 t = timer_start(0, 1, 0); // 0 h, 1 m, 0 s
    if (t != 0)
      display_text_raw(msg_timer, Q_DISPLAY_TEXT_HIGH_PRIORITY | Q_DISPLAY_TEXT_DELAY_CLEAR);
    else
      display_text_raw(msg_no_timer, Q_DISPLAY_TEXT_HIGH_PRIORITY | Q_DISPLAY_TEXT_DELAY_CLEAR);
   
    return APP_BACK;
  }
  return APP_OK;
}


There's a clause in the turbo_handler function for handling the timer stopping:

Code:

    case ACTION_TIMER_EXPIRATION:
      stk_thread(action_timer_expired, data);
      break;


And that function it calls sends the SMS:

Code:

void action_timer_expired (void *data) {
  action_sms(NULL);
}

void action_sms(void *data) {
  u8 i;
 
  u8* eMessage = (u8*) rw(&(PM->message));
  u8* eNumber = (u8*) rw(&(PM->number));
 
  u8* number = malloc( 32*sizeof(u8) );
  for(i = 0; i < 32; i++) number[i] = rb(&(eNumber[i]));
  u8* ms = str2msisdn(number, MSISDN_ADN, MEM_R);
  free(number);
 
  u8* message = malloc( 161*sizeof(u8) );
  for(i = 0; i < 161; i++) message[i] = rb(&(eMessage[i]));
 
  u8 len;
  for(len = 0; len < 161; len++) if(!message[len]) break;
 
  u8 pid = tsms_pid();
 
  u8 alpha[1]; alpha[0] = 0x00;
  send_sms(message, len, ms, MSISDN_ADN, 0xF6, pid, alpha, NULL);
 
  free(message);
  free(ms);
}


This all works fine, and the message is sent, but I don't want the actual sending of the message to disrupt what I'm doing on the phone when the message is sent. Notice I provided a null string alpha argument for the send_sms function to prevent the usual "Sending" dialog from popping up, but my phone still jumps to the Turbo menu where my programs are listed when the timer expires. It doesn't seem to be caused directly by the timer expiring, because I tried commenting out the call to action_sms and nothing happened. Is there a way to prevent it from doing that?

Thank you.
Back to top
View user's profile Send private message
pz



Joined: 12 Mar 2004
Posts: 1161

PostPosted: Wed May 04, 2011 7:50 am    Post subject: Reply with quote

Ad ALPHA - we noticed some phones show the message even if there is null string. Probably violation of standard.

Why you phone goes to STK menu doesn't make sense but maybe you should answer APP_END instead of APP_BACK in Menu_Func_Send(). What phone is this?
Back to top
View user's profile Send private message
SkylerSchneider



Joined: 13 Apr 2011
Posts: 6

PostPosted: Wed May 04, 2011 2:23 pm    Post subject: Reply with quote

pz wrote:
Ad ALPHA - we noticed some phones show the message even if there is null string. Probably violation of standard.

Why you phone goes to STK menu doesn't make sense but maybe you should answer APP_END instead of APP_BACK in Menu_Func_Send(). What phone is this?



This is a Samsung SGH-A127. I was just experimenting a bit and did notice a difference in behavior between backing out of the Turbo menu by pressing the back button multiple times and pressing the end call button. Perhaps the end call button is merely hiding the menu instead of closing it, and later actions somehow resume it. I will check it out some more.
Back to top
View user's profile Send private message
SkylerSchneider



Joined: 13 Apr 2011
Posts: 6

PostPosted: Thu May 05, 2011 5:58 pm    Post subject: Reply with quote

Yes, this seems to be a problem specific to the phone model. Thank you.
Back to top
View user's profile Send private message
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