gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fixing at handling


From: Pavel Machek
Subject: Fixing at handling
Date: Sun, 19 May 2002 22:39:19 +0200
User-agent: Mutt/1.3.28i

Hi!

Here it is. It should provide good guidance of how to make sms-sending
work with minimal effort (and still pretty clean code)...
                                                                        Pavel

Index: common/phones/atgen.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/phones/atgen.c,v
retrieving revision 1.36
diff -u -u -r1.36 atgen.c
--- common/phones/atgen.c       16 May 2002 11:27:14 -0000      1.36
+++ common/phones/atgen.c       19 May 2002 20:38:34 -0000
@@ -167,10 +167,6 @@
         8, true                                        /* User Data */
 };
 
-static const SMSMessage_Layout at_not_supported = { false };
-
-static SMSMessage_PhoneLayout at_layout;
-
 static GSM_MemoryType memorytype = GMT_XX;
 static GSMAT_Charset atdefaultcharset = CHARNONE;
 static GSMAT_Charset atcharset = CHARNONE;
@@ -578,8 +574,8 @@
        if (data->CallDivert->Operation == GSM_CDV_Register)
                sprintf(req, "%s,%d,\"%s\",%d,,,%d", req,
                        data->CallDivert->Operation,
-                       data->CallDivert->Number.number,
-                       data->CallDivert->Number.type,
+                       data->CallDivert->Number.Number,
+                       data->CallDivert->Number.Type,
                        data->CallDivert->Timeout);
        else
                sprintf(req, "%s,%d", req, data->CallDivert->Operation);
@@ -604,11 +600,13 @@
 
 static GSM_Error AT_SendSMS(GSM_Data *data, GSM_Statemachine *state)
 {
+       EncodeByLayout(data, &at_submit, 0);
        return AT_WriteSMS(data, state, "CMGS");
 }
 
 static GSM_Error AT_SaveSMS(GSM_Data *data, GSM_Statemachine *state)
 {
+       EncodeByLayout(data, &at_deliver, 0);
        return AT_WriteSMS(data, state, "CMGW");
 }
 
@@ -652,7 +650,7 @@
 static GSM_Error AT_GetSMS(GSM_Data *data, GSM_Statemachine *state)
 {
        unsigned char req[16];
-       sprintf(req, "AT+CMGR=%d\r", data->SMSMessage->Number);
+       sprintf(req, "AT+CMGR=%d\r", data->SMS->Number);
        dprintf("%s", req);
        if (SM_SendMessage(state, strlen(req), GOP_GetSMS, req) != GE_NONE)
                return GE_NOTREADY;
@@ -971,9 +969,9 @@
        /* SendSMS or SaveSMS */
        if (!strncmp("+CMGW:", buf.line2, 6) ||
            !strncmp("+CMGS:", buf.line2, 6))
-               data->SMSMessage->Number = atoi(buf.line2 + 6);
+               data->SMS->Number = atoi(buf.line2 + 6);
        else
-               data->SMSMessage->Number = -1;
+               data->SMS->Number = -1;
        dprintf("Message sent okay\n");
        return GE_NONE;
 }
@@ -1107,16 +1105,6 @@
 
        /* Copy in the phone info */
        memcpy(&(state->Phone), &phone_at, sizeof(GSM_Phone));
-
-       /* SMS Layout */
-       at_layout.Type = 0; /* Locate the Type of the mesage field. */
-       at_layout.SendHeader = 0;
-       at_layout.ReadHeader = 0;
-       at_layout.Deliver = at_deliver;
-       at_layout.Submit = at_submit;
-       at_layout.DeliveryReport = at_not_supported;
-       at_layout.Picture = at_not_supported;
-       layout = at_layout;
 
        for (i = 0; i < GOPAT_Max; i++) {
                AT_Functions[i] = NULL;



-- 
(about SSSCA) "I don't say this lightly.  However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa



reply via email to

[Prev in Thread] Current Thread [Next in Thread]