summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/phone/at
authorzautrix <zautrix>2004-10-25 08:56:23 (UTC)
committer zautrix <zautrix>2004-10-25 08:56:23 (UTC)
commit62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3 (patch) (side-by-side diff)
treec2b7a41b0c8fffdc0786b84ff86724ea8f08d6a1 /gammu/emb/common/phone/at
parentfeff0930372dd51af24dc3b46697e70838277ea5 (diff)
downloadkdepimpi-62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3.zip
kdepimpi-62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3.tar.gz
kdepimpi-62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3.tar.bz2
gammu updates
Diffstat (limited to 'gammu/emb/common/phone/at') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/phone/at/atgen.c8
-rw-r--r--gammu/emb/common/phone/at/sonyeric.c19
2 files changed, 17 insertions, 10 deletions
diff --git a/gammu/emb/common/phone/at/atgen.c b/gammu/emb/common/phone/at/atgen.c
index ba23eb2..a875f0a 100644
--- a/gammu/emb/common/phone/at/atgen.c
+++ b/gammu/emb/common/phone/at/atgen.c
@@ -675,49 +675,49 @@ GSM_Error ATGEN_Initialise(GSM_StateMachine *s)
smprintf(s, "Enabling CME errors\n");
/* Try numeric errors */
if (GSM_WaitFor (s, "AT+CMEE=1\r", 10, 0x00, 3, ID_EnableErrorInfo) != ERR_NONE) {
/* Try textual errors */
if (GSM_WaitFor (s, "AT+CMEE=2\r", 10, 0x00, 3, ID_EnableErrorInfo) != ERR_NONE) {
smprintf(s, "CME errors could not be enabled, some error types won't be detected.\n");
}
}
error = ATGEN_GetModel(s);
if (error != ERR_NONE) return error;
if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_SLOWWRITE)) {
s->Protocol.Data.AT.FastWrite = true;
}
return error;
}
GSM_Error ATGEN_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
{
unsigned char req[50];
- if (smsc->Location!=1) return ERR_NOTSUPPORTED;
+ if (smsc->Location!=1) return ERR_INVALIDLOCATION;
sprintf(req, "AT+CSCA=\"%s\"\r",DecodeUnicodeString(smsc->Number));
smprintf(s, "Setting SMSC\n");
return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_SetSMSC);
}
GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (s->Phone.Data.Priv.ATGEN.ReplyState) {
case AT_Reply_OK:
/* Reply here is:
* (memories for reading)[, (memories for writing)[, (memories for storing received messages)]]
* each memory is in quotes,
* Example: ("SM"), ("SM"), ("SM")
*
* We need to get from this supported memories. For this case
* we assume, that just appearence of memory makes it
* available for everything. Then we need to find out whether
* phone supports writing to memory. This is done by searching
* for "), (", which will appear between lists.
*/
s->Phone.Data.Priv.ATGEN.CanSaveSMS = false;
if (strstr(msg.Buffer, "), (") != NULL || strstr(msg.Buffer, "),(") != NULL) {
@@ -3818,45 +3818,51 @@ GSM_Phone_Functions ATGENPhone = {
NOTSUPPORTED, /* GetMMSSettings */
NOTSUPPORTED, /* SetMMSSettings */
NOTSUPPORTED, /* GetSyncMLSettings */
NOTSUPPORTED, /* SetSyncMLSettings */
NOTSUPPORTED, /* GetChatSettings */
NOTSUPPORTED, /* SetChatSettings */
ATGEN_GetBitmap, /* GetBitmap */
ATGEN_SetBitmap, /* SetBitmap */
SONYERIC_GetToDoStatus,
NOTSUPPORTED, /* GetToDo */
SONYERIC_GetNextToDo,
NOTSUPPORTED, /* SetToDo */
SONYERIC_AddToDo,
NOTSUPPORTED, /* DeleteToDo */
SONYERIC_DeleteAllToDo,
SONYERIC_GetCalendarStatus,
NOTIMPLEMENTED, /* GetCalendar */
ATGEN_GetNextCalendar,
NOTIMPLEMENTED, /* SetCalendar */
ATGEN_AddCalendarNote,
ATGEN_DelCalendarNote,
NOTIMPLEMENTED, /* DeleteAllCalendar */
NOTSUPPORTED, /* GetCalendarSettings */
NOTSUPPORTED, /* SetCalendarSettings */
+ NOTSUPPORTED, /* GetNoteStatus */
+ NOTSUPPORTED, /* GetNote */
NOTSUPPORTED, /* GetNextNote */
+ NOTSUPPORTED, /* SetNote */
+ NOTSUPPORTED, /* AddNote */
+ NOTSUPPORTED, /* DeleteNote */
+ NOTSUPPORTED, /* DeleteAllNotes */
NOTSUPPORTED, /* GetProfile */
NOTSUPPORTED, /* SetProfile */
NOTSUPPORTED, /* GetFMStation */
NOTSUPPORTED, /* SetFMStation */
NOTSUPPORTED, /* ClearFMStations */
NOTSUPPORTED, /* GetNextFileFolder */
NOTSUPPORTED, /* GetFilePart */
NOTSUPPORTED, /* AddFile */
NOTSUPPORTED, /* GetFileSystemStatus */
NOTSUPPORTED, /* DeleteFile */
NOTSUPPORTED, /* AddFolder */
NOTSUPPORTED, /* GetGPRSAccessPoint */
NOTSUPPORTED /* SetGPRSAccessPoint */
};
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
diff --git a/gammu/emb/common/phone/at/sonyeric.c b/gammu/emb/common/phone/at/sonyeric.c
index 8eeb39b..363e043 100644
--- a/gammu/emb/common/phone/at/sonyeric.c
+++ b/gammu/emb/common/phone/at/sonyeric.c
@@ -1,44 +1,45 @@
/* (c) 2003 by Marcin Wiacek */
#include "../../gsmstate.h"
#ifdef GSM_ENABLE_ATGEN
#include <string.h>
#include <time.h>
#include <ctype.h>
#include "../../gsmcomon.h"
#include "../../misc/coding/coding.h"
#include "atgen.h"
#include "sonyeric.h"
-#ifdef GSM_ENABLE_OBEXGEN
+#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
#include "../obex/obexgen.h"
+extern GSM_Protocol_Functions OBEXProtocol;
extern GSM_Reply_Function OBEXGENReplyFunctions[];
extern GSM_Reply_Function ATGENReplyFunctions[];
static GSM_Error SONYERIC_SetOBEXMode(GSM_StateMachine *s)
{
GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
GSM_Error error;
if (Priv->OBEX) return ERR_NONE;
dbgprintf ("Changing to OBEX\n");
error=GSM_WaitFor (s, "AT*EOBEX\r", 9, 0x00, 4, ID_SetOBEX);
if (error != ERR_NONE) return error;
error = s->Protocol.Functions->Terminate(s);
if (error != ERR_NONE) return error;
s->Protocol.Functions = &OBEXProtocol;
error = s->Protocol.Functions->Initialise(s);
if (error != ERR_NONE) {
s->Protocol.Functions = &ATProtocol;
return error;
}
@@ -103,190 +104,190 @@ static GSM_Error SONYERIC_SetFile(GSM_StateMachine *s, unsigned char *FileName,
GSM_File File;
int Pos = 0;
error = SONYERIC_SetOBEXMode(s);
if (error != ERR_NONE) return error;
strcpy(File.ID_FullName,FileName);
EncodeUnicode(File.Name,FileName,strlen(FileName));
File.Used = Length;
File.Buffer = malloc(Length);
memcpy(File.Buffer,Buffer,Length);
error = ERR_NONE;
while (error == ERR_NONE) error = OBEXGEN_AddFilePart(s,&File,&Pos);
free(File.Buffer);
if (error != ERR_EMPTY) return error;
return SONYERIC_SetATMode(s);
}
#endif
GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start)
{
-#ifdef GSM_ENABLE_OBEXGEN
+#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
GSM_Error error;
GSM_ToDoEntry ToDo;
int Pos, num, Loc;
GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
if (start) {
error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
if (error != ERR_NONE) return error;
Note->Location = 1;
} else {
Note->Location++;
}
smprintf(s, "Getting calendar note %i\n",Note->Location);
Loc = Note->Location;
Pos = 0;
num = 0;
while (1) {
error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, Note, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo);
if (error == ERR_EMPTY) break;
if (error != ERR_NONE) return error;
if (Note->EntriesNum != 0) {
num++;
if (num == Loc) return ERR_NONE;
}
}
return ERR_EMPTY;
#else
return ERR_SOURCENOTAVAILABLE;
#endif
}
GSM_Error SONYERIC_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start)
{
-#ifdef GSM_ENABLE_OBEXGEN
+#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
GSM_Error error;
GSM_CalendarEntry Calendar;
int Pos, num, Loc;
GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED;
if (start) {
error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
if (error != ERR_NONE) return error;
ToDo->Location = 1;
} else {
ToDo->Location++;
}
smprintf(s,"Getting ToDo %i\n",ToDo->Location);
Loc = ToDo->Location;
Pos = 0;
num = 0;
while (1) {
error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo);
if (error == ERR_EMPTY) break;
if (error != ERR_NONE) return error;
if (ToDo->EntriesNum != 0) {
num++;
if (num == Loc) return ERR_NONE;
}
}
return ERR_EMPTY;
#else
return ERR_SOURCENOTAVAILABLE;
#endif
}
GSM_Error SONYERIC_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)
{
-#ifdef GSM_ENABLE_OBEXGEN
+#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
GSM_Error error;
GSM_ToDoEntry ToDo;
GSM_CalendarEntry Calendar;
int Pos;
GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED;
smprintf(s,"Getting ToDo status\n");
error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
if (error != ERR_NONE) return error;
status->Used = 0;
Pos = 0;
while (1) {
error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo);
if (error == ERR_EMPTY) break;
if (error != ERR_NONE) return error;
if (ToDo.EntriesNum != 0) status->Used++;
}
return ERR_NONE;
#else
return ERR_SOURCENOTAVAILABLE;
#endif
}
GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note)
{
-#ifdef GSM_ENABLE_OBEXGEN
+#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
unsigned char req[5000];
int size=0;
smprintf(s,"Adding calendar note\n");
GSM_EncodeVCALENDAR(req,&size,Note,true,SonyEricsson_VCalendar);
return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size);
#else
return ERR_SOURCENOTAVAILABLE;
#endif
}
GSM_Error SONYERIC_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
{
-#ifdef GSM_ENABLE_OBEXGEN
+#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
unsigned char req[5000];
int size=0;
if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED;
smprintf(s,"Adding ToDo\n");
GSM_EncodeVTODO(req,&size,ToDo,true,SonyEricsson_VToDo);
return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size);
#else
return ERR_SOURCENOTAVAILABLE;
#endif
}
GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s)
{
-#ifdef GSM_ENABLE_OBEXGEN
+#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
GSM_Error error;
int Pos,Level = 0,Used;
unsigned char *Buf;
GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
unsigned char Line[2000];
if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED;
smprintf(s,"Deleting all ToDo\n");
error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
if (error != ERR_NONE) return error;
Pos = 0;
Buf = NULL;
Used = 0;
while (1) {
MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used);
if (strlen(Line) == 0) break;
dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos);
switch (Level) {
case 0:
if (strstr(Line,"BEGIN:VTODO")) {
Level = 2;
@@ -296,49 +297,49 @@ GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s)
strcpy(Buf+Used,Line);
Used=Used+strlen(Line)+3;
Buf[Used-3] = 13;
Buf[Used-2] = 10;
Buf[Used-1] = 0x00;
break;
case 2: /* ToDo note */
if (strstr(Line,"END:VTODO")) {
Level = 0;
}
break;
}
}
error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used);
// if (Buf != NULL) free(Buf);
return error;
#else
return ERR_SOURCENOTAVAILABLE;
#endif
}
GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note)
{
-#ifdef GSM_ENABLE_OBEXGEN
+#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
GSM_Error error;
int Pos,Level = 0,Loc=0,Used;
GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
unsigned char Line[2000];
unsigned char *Buf;
smprintf(s, "Deleting calendar note %i\n",Note->Location);
error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
if (error != ERR_NONE) return error;
Pos = 0;
Buf = NULL;
Used = 0;
while (1) {
MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used);
if (strlen(Line) == 0) break;
dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos);
switch (Level) {
case 0:
if (strstr(Line,"BEGIN:VEVENT")) {
Loc++;
if (Loc == Note->Location) {
Level = 1;
@@ -351,49 +352,49 @@ GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note)
Buf[Used-3] = 13;
Buf[Used-2] = 10;
Buf[Used-1] = 0x00;
break;
case 1: /* Calendar note */
if (strstr(Line,"END:VEVENT")) {
Level = 0;
}
break;
}
}
DumpMessage(s->di.df, s->di.dl, Buf, Used);
error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used);
if (Buf != NULL) free(Buf);
return error;
#else
return ERR_SOURCENOTAVAILABLE;
#endif
}
GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status)
{
-#ifdef GSM_ENABLE_OBEXGEN
+#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX)
GSM_Error error;
GSM_ToDoEntry ToDo;
GSM_CalendarEntry Calendar;
int Pos;
GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED;
smprintf(s, "Getting calendar status\n");
error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs");
if (error != ERR_NONE) return error;
Status->Used = 0;
Pos = 0;
while (1) {
error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo);
if (error == ERR_EMPTY) break;
if (error != ERR_NONE) return error;
if (Calendar.EntriesNum != 0) Status->Used++;
}
return ERR_NONE;
#else