buggnokii - Bugs: bug #32831, gn_sms_send failed to send sms (...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #32831: gn_sms_send failed to send sms ( lack of gn_data structure )

Submitted by:  capede <capede>
Submitted on:  Fri 18 Mar 2011 12:11:05 PM UTC  
 
Category: libgnokiiSeverity: 3 - Normal
Item Group: crashStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri 18 Mar 2011 12:43:58 PM UTC, comment #1:

Closing as invalid since the bug is in your application and this is not an help forum.

Daniele Forsi <dforsi>
Project Administrator
Fri 18 Mar 2011 12:11:05 PM UTC, original submission:

hi all,
i got an issue when im gonna sending sms with libgnokii :

my code :
---------------------------------
root@vivalavida:/tmp# cat gnokii_send_sms.c
/*

  • File: gnokii_send_sms.c
  • Author: xxx

*

  • Created on March 18, 2011, 1:30 AM

*/

#include <stdio.h>
#include <stdlib.h>
#include <gnokii.h>
#include <signal.h>
/*

*/

#define _(x) x

struct gn_statemachine *state = NULL;

void busterminate(void) {
gn_lib_phone_close(state);
gn_lib_phoneprofile_free(&state);
gn_lib_library_free();
}

void businit(void) {
gn_error error;

atexit(busterminate);

error = gn_lib_phoneprofile_load(NULL, &state);
if (GN_ERR_NONE == error) {
error = gn_lib_phone_open(state);
}

if (GN_ERR_NONE != error) {
fprintf(stderr, "%s\n", gn_error_print(error));
exit(-1);
}
}

void signal_handler(int signal) {
(void)signal;
exit(-2);
}
gn_gsm_number_type get_number_type(const char *number)
{
gn_gsm_number_type type;

if (!number)
return GN_GSM_NUMBER_Unknown;
if (*number == '+') {
type = GN_GSM_NUMBER_International;
number++;
} else {
type = GN_GSM_NUMBER_Unknown;
}
while (*number) {
if (!isdigit(*number))
return GN_GSM_NUMBER_Alphanumeric;
number++;
}
return type;
}
int main(int argc, char *argv[]) {
gn_data data;
gn_sms sms;
gn_error error;

businit();

signal(SIGINT, signal_handler);

gn_data_clear(&data);
char nomor[] = "+628571641111";
snprintf(sms.remote.number,sizeof(sms.remote.number),"%s",nomor);
sms.remote.type = get_number_type(nomor);
if(sms.remote.type == GN_GSM_NUMBER_Alphanumeric)
{
printf("invalid phone number\n");
return GN_ERR_WRONGDATAFORMAT;
}

snprintf(sms.user_data[0].u.text,sizeof(sms.user_data[0].u.text),"%s","tesss");

data.message_center = calloc(1, sizeof(gn_sms_message_center));
data.message_center->id= 1;

error = gn_sm_functions(GN_OP_GetSMSCenter, &data, state);
if(error == GN_ERR_NONE)
{
snprintf(sms.smsc.number,sizeof(sms.smsc.number),"%s",data.message_center->smsc.number); // set to sms.smsc.number from data.sms.smsc.number
sms.smsc.type = data.message_center->smsc.type;
//g_slice_free(gn_sms_message_center,data->message_center); // free the ram
free(data.message_center);
}
if(!sms.smsc.number[0])
{
printf("failed once getting sms center number\n");

}
if(!sms.smsc.type)
{
sms.smsc.type = GN_GSM_NUMBER_Unknown;
}

data.sms = &sms;

//send the message
error = gn_sms_send(&data,state);

if(error == GN_ERR_NONE)
{
if(sms.parts > 1)
{
int j;
printf("sms sent with : %d parts, and reference number is : ", sms.parts);

for(j=0; j < sms.parts; j++)
{
printf("%d\n",sms.reference[j]);
}
}
else
{
printf("one sms sent with reference number : %d\n",sms.reference[0]);
}
}
else
{
printf("libgnokii error : %s\n",gn_error_print(error));
}

free(sms.reference);

return 0;
}
root@vivalavida:/tmp#

compiling and running :
---------------------------------
root@vivalavida:/tmp# gcc -o gnokii_send_sms gnokii_send_sms.c `pkg-config --libs gnokii`
root@vivalavida:/tmp# gnokii --showsmsfolderstatus
GNOKII Version 0.6.29
No. Name Id #Msg
========================================================
0 Internal memory ME 4725
1 SIM card SM 8
root@vivalavida:/tmp# gdb -q ./gnokii_send_sms
Reading symbols from /tmp/gnokii_send_sms...(no debugging symbols found)...done.
(gdb) r
Starting program: /tmp/gnokii_send_sms
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x0015321e in ?? () from /usr/lib/libgnokii.so.6
(gdb) bt
#0 0x0015321e in ?? () from /usr/lib/libgnokii.so.6
#1 0x00154fea in gn_sms_send () from /usr/lib/libgnokii.so.6
#2 0x08048bc0 in main ()
(gdb)

and anyway, what are uninitialized var that need to be initialzed in 'gn_data structure', before gn_sms_send() function take 'gn_data structure' and spin ?

thx in advance

capede <capede>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dforsi (Posted a comment)
  • -unavailable- added by capede (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 18 Mar 2011 12:43:58 PM UTCdforsiStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1