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 

Pls help--unable to display/catch call_control info

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



Joined: 18 Jan 2011
Posts: 72

PostPosted: Tue Jan 25, 2011 11:28 am    Post subject: Pls help--unable to display/catch call_control info Reply with quote

Hello,
I am trying to get call_control info on display below, but I am receiving garbage. Please help.

Code:

void disply (void * x)
{
      display_text_raw (x, Q_DISPLAY_TEXT_HIGH_PRIORITY |
            Q_DISPLAY_TEXT_DELAY_CLEAR);
}

void call_control (u8 * s)
{
u8 *get_resp_call;
u8 get_resp_call_len = 0;
u8 *tmp = malloc (100);

get_resp_call[get_resp_call_len++] = CALL_STAT_MODIFY;
get_resp_call[get_resp_call_len++] = 0x00;   //len
get_resp_call[get_resp_call_len++] = T_ADDRESS;   
get_resp_call[get_resp_call_len++] = 0x00;   //len
get_resp_call[get_resp_call_len++] = 0x81;
.........
..........

memcpy(tmp, get_resp_call, (get_resp_call_len - 2));
tmp[get_resp_call_len-1]='\0';
stk_thread(disply, tmp);
}


It would be really helpful if someone can kindly point out where I am doing wrong in capturing the array info. Many thanks.
Back to top
View user's profile Send private message
pz



Joined: 12 Mar 2004
Posts: 1161

PostPosted: Wed Jan 26, 2011 6:42 am    Post subject: Reply with quote

You are trying to print non-ascii/printable chars, so you get garbage.
Use some converstion to hex, sprintch()...

Don't forget to free(tmp)
Back to top
View user's profile Send private message
tkm



Joined: 18 Jan 2011
Posts: 72

PostPosted: Fri Jan 28, 2011 12:06 pm    Post subject: Reply with quote

pz wrote:
You are trying to print non-ascii/printable chars, so you get garbage.
Use some converstion to hex, sprintch()...

Don't forget to free(tmp)

Thanks a lot,pz. Sorry for the late reply. Didn't realize u replied. I will use sprintch to convert to hex before displaying.
Back to top
View user's profile Send private message
tkm



Joined: 18 Jan 2011
Posts: 72

PostPosted: Mon Jan 31, 2011 4:01 pm    Post subject: Reply with quote

Hi pz,
I would really appreciate a bit further help on this. This is how I am trying to access T_ADDRESS of call_control but still getting garbage.
Code:

u8 j2,l2,i2;   
u8 *r2 = buf_B ();
u8 *buf = malloc (200);
memcpy(buf, &get_resp_call[2] , get_resp_call_len );

j2 = get_tag (buf, T_ADDRESS);

if (j2 != 0)
{

   l2 = buf[j2 + 1];
   for (i2 = 0; i2 < l2; i2++)
     r2 = sprintch (r2, buf[j2 + 2 + i2]);
   r2 = sprintc (r2, '\0');
}
stk_thread(bum, buf_B()); //calling display_text_raw
free(buf);


Please can you help me on what I am doing wrong? Many thanks.
Back to top
View user's profile Send private message
pz



Joined: 12 Mar 2004
Posts: 1161

PostPosted: Tue Feb 08, 2011 9:55 am    Post subject: Reply with quote

Try memcpy(buf, &get_resp_call[1] , get_resp_call[1]+1);
get_tag() should point to buffer starting with len, you are skipping it.
Back to top
View user's profile Send private message
tkm



Joined: 18 Jan 2011
Posts: 72

PostPosted: Fri Feb 11, 2011 2:57 pm    Post subject: Reply with quote

pz wrote:
Try memcpy(buf, &get_resp_call[1] , get_resp_call[1]+1);
get_tag() should point to buffer starting with len, you are skipping it.

Many thanks,pz. Will do.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    bladox.com Forum Index -> General 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