 |
bladox.com Turbo SIM Toolkit Adapter Forums
|
View previous topic :: View next topic |
Author |
Message |
vzent
Joined: 03 Jun 2008 Posts: 2
|
Posted: Tue Jun 03, 2008 9:01 am Post subject: display_text problem |
|
|
Hi,
I am in the midst of testing out the power of TurboSim and writting some basic apps. This is cool.
I want to have a input textbox and let the user key in their name then display it, however i have problem displaying it by using display_text
Code: | #include <config.h>
#include <turbo/turbo.h>
//create a struct
typedef struct _HDD //for EEPROM
{
u8 fullname[30];
u8 nric[9];
u8 age[2];
u8 gender[1];
u8 school[3];
} HDD;
HDD *hddAddress;
//declare var here
u8 PROGMEM mainMenuName[]="Cool Apps";
u8 PROGMEM innerMenuName[]="Test App";
u8 PROGMEM appVersion[] = "Version: 1.0";
u8 PROGMEM txt_Fullname[] = "Full Name";
u8 PROGMEM txt_NRIC[] = "NRIC";
u8 PROGMEM txt_Age[] = "Age";
u8 PROGMEM txt_Gender[] = "Gender";
u8 PROGMEM txt_School[] = "School";
lc_char PROGMEM lc_fullname[]={
LC_UN("")
LC_END
};
u8 inputFullname;
void action_menu (void *data){
inputFullname = get_input(locale(lc_fullname), 3, 18, NULL, Q_GET_INPUT_ALPHABET); //problem is this line
display_text(inputFullname, NULL);
}
void turbo_handler (u8 action, void *data){
switch (action)
{
case ACTION_INSERT_MENU:
set_menu_alpha(mainMenuName); //set the name for the icon appear on the phone, instead of 'turbo'
insert_menu (innerMenuName);
break;
case ACTION_MENU_SELECTION:
stk_thread (action_menu, data);
break;
default:
break;
}
} |
I have got the following warning when im trying to compile my file:
Code: | vForm.c: In function `action_menu':
vForm.c:40: warning: passing arg 1 of `locale' from incompatible pointer type
vForm.c:40: warning: assignment makes integer from pointer without a cast
vForm.c:41: warning: passing arg 1 of `display_text' makes pointer from integer
without a cast |
Please help !!
Thank you for your time. |
|
Back to top |
|
 |
pz Guest
|
Posted: Thu Jun 05, 2008 2:20 pm Post subject: Re: display_text problem |
|
|
vzent wrote: | Hi,
I am in the midst of testing out the power of TurboSim and writting some basic apps. This is cool.
I want to have a input textbox and let the user key in their name then display it, however i have problem displaying it by using display_text
Code: | #include <config.h>
#include <turbo/turbo.h>
//create a struct
typedef struct _HDD //for EEPROM
{
u8 fullname[30];
u8 nric[9];
u8 age[2];
u8 gender[1];
u8 school[3];
} HDD;
HDD *hddAddress;
//declare var here
u8 PROGMEM mainMenuName[]="Cool Apps";
u8 PROGMEM innerMenuName[]="Test App";
u8 PROGMEM appVersion[] = "Version: 1.0";
u8 PROGMEM txt_Fullname[] = "Full Name";
u8 PROGMEM txt_NRIC[] = "NRIC";
u8 PROGMEM txt_Age[] = "Age";
u8 PROGMEM txt_Gender[] = "Gender";
u8 PROGMEM txt_School[] = "School";
lc_char PROGMEM lc_fullname[]={
LC_UN("")
LC_END
};
u8 inputFullname;
void action_menu (void *data){
inputFullname = get_input(locale(lc_fullname), 3, 18, NULL, Q_GET_INPUT_ALPHABET); //problem is this line
display_text(inputFullname, NULL);
}
void turbo_handler (u8 action, void *data){
switch (action)
{
case ACTION_INSERT_MENU:
set_menu_alpha(mainMenuName); //set the name for the icon appear on the phone, instead of 'turbo'
insert_menu (innerMenuName);
break;
case ACTION_MENU_SELECTION:
stk_thread (action_menu, data);
break;
default:
break;
}
} |
I have got the following warning when im trying to compile my file:
Code: | vForm.c: In function `action_menu':
vForm.c:40: warning: passing arg 1 of `locale' from incompatible pointer type
vForm.c:40: warning: assignment makes integer from pointer without a cast
vForm.c:41: warning: passing arg 1 of `display_text' makes pointer from integer
without a cast |
Please help !!
Thank you for your time. |
3 issues:
- get_input() returns length+coding+data
- it's not \0 terminated
- the buffer you get the answer in is the same new STK command is being constructed, i.e. your data are overwritten.
Try something like this:
Code: |
res = get_input (...);
l=res[0] - 1; // length without one byte DCS
memcpy(buf_B(), res + 2, l);
buf_B()[l]='\0';
display_text(buf_B(), NULL);
|
|
|
Back to top |
|
 |
|
|
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
|