3 #include "../../gsmstate.h" 5 #ifdef GSM_ENABLE_ATGEN 11 #include "../../misc/coding/coding.h" 12 #include "../../gsmcomon.h" 18 #include "../../service/gsmlogo.h" 22 unsigned char *buffer,
size_t *len)
25 int i=2, pos=0, length=0;
26 unsigned char buf[512];
42 memcpy (buffer+pos,buf,length);
56 unsigned char req[60],req1[512],hexreq[10000];
57 int MaxFrame,CurrentFrame,size,sz,pos=0;
60 if ((len * 2) > (
sizeof(hexreq) - 1)) {
70 MaxFrame = size / 352;
75 for (CurrentFrame = 0; CurrentFrame < MaxFrame; CurrentFrame++) {
76 pos = CurrentFrame * 352;
77 if (pos + 352 < size) {
84 reqlen = sprintf(req,
"AT^SBNW=\"%s\",%i,%i,%i\r",templ,Location,CurrentFrame+1,MaxFrame);
86 error =
GSM_WaitFor(s, req, reqlen, 0x00, 3, RequestID);
94 memcpy(req1, hexreq + pos, sz);
120 unsigned char buffer[4096];
124 error = GetSiemensFrame(msg,s,
"bmp",buffer,&length);
126 smprintf(s,
"Operator logo received lenght=%ld\n", (
long)length);
150 return SIEMENS_ReplySetFunction (msg, s,
"Operator Logo");
155 unsigned char req[32];
161 len = sprintf(req,
"AT^SBNR=\"bmp\",%i\r", Bitmap->
Location-1);
168 unsigned char buffer[4096];
176 length = 0x100 * buffer[3] + buffer[2];
177 buffer[58]=0xff; buffer[59]=0xff; buffer[60]=0xff;
180 return SetSiemensFrame(s, buffer,
"bmp",Bitmap->
Location-1,
186 char buffer[] =
"Individual";
192 smprintf(s,
"Midi ringtone received\n");
202 unsigned char req[32];
206 len = sprintf(req,
"AT^SBNR=\"mid\",%i\r", Ringtone->
Location-1);
213 return SIEMENS_ReplySetFunction (msg, s,
"Ringtone");
236 unsigned char buffer[354];
242 smprintf(s,
"Calendar entry received\n");
243 error = GetSiemensFrame(msg, s,
"vcs", buffer, &len);
244 if (error !=
ERR_NONE)
return error;
247 smprintf(s,
"Error - too high location ?\n");
267 unsigned char req[32];
280 len = sprintf(req,
"AT^SBNR=\"vcs\",%i\r",Location);
300 unsigned char req[32];
306 len = sprintf(req,
"AT^SBNR=\"vcs\",%i\r",Note->
Location);
307 smprintf(s,
"Getting calendar note\n");
314 return SIEMENS_ReplySetFunction (msg, s,
"Calendar Note");
319 return SIEMENS_ReplySetFunction (msg, s,
"Memory entry");
329 smprintf(s,
"Calendar note deleted\n");
332 smprintf(s,
"Can't delete calendar note\n");
340 unsigned char req[32];
345 len = sprintf(req,
"AT^SBNW=\"vcs\",%i,0\r",Note->
Location);
346 smprintf(s,
"Deleting calendar note\n");
355 unsigned char req[500];
362 if (error !=
ERR_NONE)
return error;
371 unsigned char req[500], req1[32];
390 len = sprintf(req1,
"AT^SBNR=\"vcs\",%i\r",Location);
414 smprintf(s,
"Phonebook entry received\n");
415 error = GetSiemensFrame(msg,s,
"vcf", buffer, &length);
416 if (error !=
ERR_NONE)
return error;
421 smprintf(s,
"Error - too high location ?\n");
447 smprintf(s,
"Memory info received\n");
450 pos = strstr(msg->
Buffer,
"\"vcf\"");
452 pos = strchr(pos + 1,
'(');
459 pos = strchr(pos,
'-');
483 unsigned char req[5000];
499 if (error !=
ERR_NONE)
return error;
GSM_Error GSM_EncodeVCALENDAR(char *Buffer, const size_t buff_len, size_t *Length, GSM_CalendarEntry *note, const gboolean header, const GSM_VCalendarVersion Version)
unsigned char Name[(GSM_MAX_RINGTONE_NAME_LENGTH+1) *2]
GSM_Error BMP2Bitmap(unsigned char *buffer, FILE *file, GSM_Bitmap *bitmap)
GSM_Error GSM_EncodeVCARD(GSM_Debug_Info *di, char *Buffer, const size_t buff_len, size_t *Length, GSM_MemoryEntry *pbk, const gboolean header, const GSM_VCardVersion Version)
GSM_RingtoneFormat Format
GSM_Error SIEMENS_GetCalendar(GSM_StateMachine *, GSM_CalendarEntry *)
struct GSM_Protocol::@1 Data
GSM_Error SIEMENS_ReplyGetMemory(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Error ATGEN_HandleCMEError(GSM_StateMachine *s)
GSM_MemoryType MemoryType
GSM_Error SIEMENS_ReplyGetMemoryInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error ATGEN_HandleCMSError(GSM_StateMachine *s)
const char * GetLineString(const char *message, GSM_CutLines *lines, int start)
GSM_Error SIEMENS_ReplyGetRingtone(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Error SIEMENS_ReplyGetBitmap(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Error GSM_WaitForOnce(GSM_StateMachine *s, unsigned const char *buffer, size_t length, int type, int timeout)
GSM_Error SIEMENS_ReplyGetNextCalendar(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Error(* WriteMessage)(GSM_StateMachine *s, unsigned const char *buffer, int length, int type)
char Manufacturer[GSM_MAX_MANUFACTURER_LENGTH+1]
GSM_Error SIEMENS_ReplySetRingtone(GSM_Protocol_Message *, GSM_StateMachine *)
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
struct GSM_Phone_Data::@2 Priv
GSM_NokiaBinaryRingtone NokiaBinary
GSM_Error SIEMENS_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error GSM_WaitFor(GSM_StateMachine *s, unsigned const char *buffer, size_t length, int type, int timeout, GSM_Phone_RequestID request)
unsigned char Frame[50000]
GSM_Error SIEMENS_GetRingtone(GSM_StateMachine *, GSM_Ringtone *, gboolean)
GSM_Error SIEMENS_GetNextCalendar(GSM_StateMachine *, GSM_CalendarEntry *, gboolean)
GSM_Error SIEMENS_ReplyDelCalendarNote(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Phone_RequestID RequestID
#define MAX_VCALENDAR_LOCATION
GSM_Error GSM_DecodeVCARD(GSM_Debug_Info *di, char *Buffer, size_t *Pos, GSM_MemoryEntry *Pbk, GSM_VCardVersion Version)
GSM_Error GSM_DecodeVCALENDAR_VTODO(GSM_Debug_Info *di, char *Buffer, size_t *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer)
GSM_Error SIEMENS_SetBitmap(GSM_StateMachine *, GSM_Bitmap *)
GSM_Error SIEMENS_ReplySetBitmap(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Error SIEMENS_SetCalendarNote(GSM_StateMachine *, GSM_CalendarEntry *)
GSM_Error SIEMENS_SetRingtone(GSM_StateMachine *, GSM_Ringtone *, int *)
gboolean DecodeHexBin(unsigned char *dest, const unsigned char *src, size_t len)
void EncodeHexBin(char *dest, const unsigned char *src, size_t len)
GSM_Error SIEMENS_AddCalendarNote(GSM_StateMachine *, GSM_CalendarEntry *)
GSM_Protocol_Functions * Functions
GSM_Error SIEMENS_GetBitmap(GSM_StateMachine *, GSM_Bitmap *)
GSM_AT_Reply_State ReplyState
GSM_AT_Manufacturer Manufacturer
GSM_Error SIEMENS_ReplyAddCalendarNote(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Error SIEMENS_DelCalendarNote(GSM_StateMachine *, GSM_CalendarEntry *)
GSM_Error SIEMENS_ReplySetMemory(GSM_Protocol_Message *msg, GSM_StateMachine *s)
int smprintf(GSM_StateMachine *s, const char *format,...)
GSM_Error Bitmap2BMP(unsigned char *buffer, FILE *file, GSM_Bitmap *bitmap)