summaryrefslogtreecommitdiff
path: root/libgammu
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2010-01-06 16:41:39 +0100
committerMichal Čihař <michal@cihar.com>2010-01-06 16:41:39 +0100
commit7f046c3bd5880e546e8088eafcb38c0f8f9d8949 (patch)
treed71232e68dfdbdfbc654154acc7afada57cab8a7 /libgammu
parentdb82aad8331a0e9aa7760091b781a2d5ede9f5fc (diff)
Imported Upstream version 1.27.90
Diffstat (limited to 'libgammu')
-rw-r--r--libgammu/phone/at/atgen.c67
-rw-r--r--libgammu/protocol/at/at.c3
2 files changed, 38 insertions, 32 deletions
diff --git a/libgammu/phone/at/atgen.c b/libgammu/phone/at/atgen.c
index 4c94277..7733bb5 100644
--- a/libgammu/phone/at/atgen.c
+++ b/libgammu/phone/at/atgen.c
@@ -274,6 +274,7 @@ static ATErrorCode CMEErrorCodes[] = {
{148, "Unspecified GPRS error."},
{149, "PDP authentication failure."},
{150, "Invalid mobile class."},
+ {-1, ""}
};
static char samsung_location_error[] = "[Samsung] Empty location";
@@ -2904,12 +2905,12 @@ GSM_Error ATGEN_SetPBKMemory(GSM_StateMachine *s, GSM_MemoryType MemType)
if (Priv->PBKSBNR == 0) {
ATGEN_CheckSBNR(s);
}
- }
- if (Priv->PBK_SPBR == 0) {
- ATGEN_CheckSPBR(s);
- }
- if (Priv->PBK_MPBR == 0) {
- ATGEN_CheckMPBR(s);
+ if (Priv->PBK_SPBR == 0) {
+ ATGEN_CheckSPBR(s);
+ }
+ if (Priv->PBK_MPBR == 0) {
+ ATGEN_CheckMPBR(s);
+ }
}
if (Priv->PBKMemory == MemType) return ERR_NONE;
@@ -3636,21 +3637,27 @@ GSM_Error ATGEN_PrivGetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry, int
if (Priv->PBKSBNR == 0) {
ATGEN_CheckSBNR(s);
}
+ if (Priv->PBK_SPBR == 0) {
+ ATGEN_CheckSPBR(s);
+ }
+ if (Priv->PBK_MPBR == 0) {
+ ATGEN_CheckMPBR(s);
+ }
if (Priv->PBKSBNR == AT_AVAILABLE) {
/* FirstMemoryEntry is not applied here, it is always 0 */
len = sprintf(req, "AT^SBNR=vcf,%i\r",entry->Location - 1);
- s->Phone.Data.Memory = entry;
- smprintf(s, "Getting phonebook entry\n");
- ATGEN_WaitFor(s, req, len, 0x00, 4, ID_GetMemory);
- return error;
+ goto read_memory;
+ }
+ if (Priv->PBK_SPBR == AT_AVAILABLE) {
+ /* FirstMemoryEntry is not applied here, it is always 1 */
+ len = sprintf(req, "AT+SPBR=%i\r", entry->Location);
+ goto read_memory;
+ }
+ if (Priv->PBK_MPBR == AT_AVAILABLE) {
+ /* FirstMemoryEntry is not applied here, it is always 1 */
+ len = sprintf(req, "AT+MPBR=%i\r", entry->Location);
+ goto read_memory;
}
- }
-
- if (Priv->PBK_SPBR == 0) {
- ATGEN_CheckSPBR(s);
- }
- if (Priv->PBK_MPBR == 0) {
- ATGEN_CheckMPBR(s);
}
error = ATGEN_GetManufacturer(s);
@@ -3668,18 +3675,13 @@ GSM_Error ATGEN_PrivGetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry, int
if (error != ERR_NONE) return error;
}
- if (Priv->PBK_SPBR == AT_AVAILABLE) {
- len = sprintf(req, "AT+SPBR=%i\r", entry->Location + Priv->FirstMemoryEntry - 1);
- } else if (Priv->PBK_MPBR == AT_AVAILABLE) {
- len = sprintf(req, "AT+MPBR=%i\r", entry->Location + Priv->FirstMemoryEntry - 1);
+ if (endlocation == 0) {
+ len = sprintf(req, "AT+CPBR=%i\r", entry->Location + Priv->FirstMemoryEntry - 1);
} else {
- if (endlocation == 0) {
- len = sprintf(req, "AT+CPBR=%i\r", entry->Location + Priv->FirstMemoryEntry - 1);
- } else {
- len = sprintf(req, "AT+CPBR=%i,%i\r", entry->Location + Priv->FirstMemoryEntry - 1, endlocation + Priv->FirstMemoryEntry - 1);
- }
+ len = sprintf(req, "AT+CPBR=%i,%i\r", entry->Location + Priv->FirstMemoryEntry - 1, endlocation + Priv->FirstMemoryEntry - 1);
}
+read_memory:
s->Phone.Data.Memory=entry;
smprintf(s, "Getting phonebook entry\n");
ATGEN_WaitFor(s, req, len, 0x00, 30, ID_GetMemory);
@@ -3704,12 +3706,12 @@ GSM_Error ATGEN_GetNextMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry, gboo
if (Priv->PBKSBNR == 0) {
ATGEN_CheckSBNR(s);
}
- }
- if (Priv->PBK_SPBR == 0) {
- ATGEN_CheckSPBR(s);
- }
- if (Priv->PBK_MPBR == 0) {
- ATGEN_CheckMPBR(s);
+ if (Priv->PBK_SPBR == 0) {
+ ATGEN_CheckSPBR(s);
+ }
+ if (Priv->PBK_MPBR == 0) {
+ ATGEN_CheckMPBR(s);
+ }
}
/* There are no status functions for SBNR */
if (entry->MemoryType != MEM_ME || Priv->PBKSBNR != AT_AVAILABLE) {
@@ -5235,6 +5237,7 @@ GSM_Reply_Function ATGENReplyFunctions[] = {
{ATGEN_GenericReplyIgnore, "^BOOT:" ,0x00,0x00,ID_IncomingFrame },
{ATGEN_GenericReplyIgnore, "^MODE:" ,0x00,0x00,ID_IncomingFrame },
{ATGEN_GenericReplyIgnore, "^DSFLOWRPT:" ,0x00,0x00,ID_IncomingFrame },
+{ATGEN_GenericReplyIgnore, "+ZUSIMR:" ,0x00,0x00,ID_IncomingFrame },
#ifdef GSM_ENABLE_ATOBEX
{ATGEN_GenericReply, "AT*EOBEX=?" ,0x00,0x00,ID_SetOBEX },
diff --git a/libgammu/protocol/at/at.c b/libgammu/protocol/at/at.c
index ba603eb..c455239 100644
--- a/libgammu/protocol/at/at.c
+++ b/libgammu/protocol/at/at.c
@@ -121,6 +121,9 @@ static GSM_Error AT_StateMachine(GSM_StateMachine *s, unsigned char rx_char)
{"^BOOT:" ,1}, /* ^BOOT:27710117,0,0,0,75 */
{"^MODE:" ,1}, /* ^MODE:3,3 */
+ /* ONDA */
+ {"+ZUSIMR:" ,1}, /* +ZUSIMR:2 */
+
{NULL ,1}};
/* Ignore leading CR, LF and ESC */