Gammu internals  1.38.0
pfunc.c File Reference
#include <string.h>
#include <ctype.h>
#include <gammu-ringtone.h>
#include "../gsmstate.h"
#include "../misc/coding/coding.h"
#include "../misc/locales.h"
#include "../service/gsmring.h"
Include dependency graph for pfunc.c:

Go to the source code of this file.

Functions

GSM_Error PHONE_GetSMSFolders (GSM_StateMachine *s UNUSED, GSM_SMSFolders *folders)
 
void GSM_CreateFirmwareNumber (GSM_StateMachine *s)
 
GSM_Error PHONE_EncodeSMSFrame (GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout, int *length, gboolean clear)
 
GSM_Error PHONE_Terminate (GSM_StateMachine *s)
 
GSM_Error PHONE_RTTLPlayOneNote (GSM_StateMachine *s, GSM_RingNote note, gboolean first)
 
GSM_Error PHONE_Beep (GSM_StateMachine *s)
 
GSM_Error PHONE_FindDataFile (GSM_StateMachine *s, GSM_File *File, const char *ExtraPath, const char *filename)
 
GSM_Error PHONE_UploadFile (GSM_StateMachine *s, GSM_File *File)
 
GSM_Error NoneReply (GSM_Protocol_Message *msg UNUSED, GSM_StateMachine *s)
 

Variables

GSM_SMSMessageLayout PHONE_SMSDeliver
 
GSM_SMSMessageLayout PHONE_SMSSubmit
 
GSM_SMSMessageLayout PHONE_SMSStatusReport
 

Function Documentation

§ NoneReply()

GSM_Error NoneReply ( GSM_Protocol_Message *msg  UNUSED,
GSM_StateMachine s 
)

Definition at line 188 of file pfunc.c.

References ERR_NONE, and smprintf().

189 {
190  smprintf(s,"None answer\n");
191  return ERR_NONE;
192 }
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261

§ PHONE_Beep()

GSM_Error PHONE_Beep ( GSM_StateMachine s)

Makes phone beek using state machine interface.

Definition at line 129 of file pfunc.c.

References ERR_NONE, FALSE, GSM_Phone::Functions, _GSM_StateMachine::Phone, GSM_Phone_Functions::PlayTone, and TRUE.

130 {
131  GSM_Error error;
132 
133  error=s->Phone.Functions->PlayTone(s, 4000, 5,TRUE);
134  if (error!=ERR_NONE) return error;
135 
136  usleep(500000);
137 
138  return s->Phone.Functions->PlayTone(s,255*255,0,FALSE);
139 }
GSM_Error
Definition: gammu-error.h:23
GSM_Phone Phone
Definition: gsmstate.h:1431
#define FALSE
Definition: gammu-types.h:25
GSM_Error(* PlayTone)(GSM_StateMachine *s, int Herz, unsigned char Volume, gboolean start)
Definition: gsmstate.h:1075
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373
#define TRUE
Definition: gammu-types.h:28

§ PHONE_GetSMSFolders()

GSM_Error PHONE_GetSMSFolders ( GSM_StateMachine *s  UNUSED,
GSM_SMSFolders folders 
)

Definition at line 38 of file pfunc.c.

References _, EncodeUnicode(), ERR_NONE, FALSE, GSM_SMSFolders::Folder, GSM_OneSMSFolder::InboxFolder, MEM_SM, GSM_OneSMSFolder::Memory, GSM_OneSMSFolder::Name, GSM_SMSFolders::Number, GSM_OneSMSFolder::OutboxFolder, and TRUE.

Referenced by DUMMY_GetSMSFolders().

39 {
40  folders->Number=2;
41  EncodeUnicode(folders->Folder[0].Name,_("Inbox"),strlen(_("Inbox")));
42  EncodeUnicode(folders->Folder[1].Name,_("Outbox"),strlen(_("Outbox")));
43  folders->Folder[0].InboxFolder = TRUE;
44  folders->Folder[1].InboxFolder = FALSE;
45  folders->Folder[0].OutboxFolder = FALSE;
46  folders->Folder[1].OutboxFolder = TRUE;
47  folders->Folder[0].Memory = MEM_SM;
48  folders->Folder[1].Memory = MEM_SM;
49  return ERR_NONE;
50 }
GSM_OneSMSFolder Folder[GSM_MAX_SMS_FOLDERS]
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
#define FALSE
Definition: gammu-types.h:25
unsigned char Name[(GSM_MAX_SMS_FOLDER_NAME_LEN+1) *2]
GSM_MemoryType Memory
gboolean OutboxFolder
gboolean InboxFolder
#define _(x)
Definition: locales.h:21
#define TRUE
Definition: gammu-types.h:28

§ PHONE_RTTLPlayOneNote()

GSM_Error PHONE_RTTLPlayOneNote ( GSM_StateMachine s,
GSM_RingNote  note,
gboolean  first 
)

Play one note using state machine interface.

Definition at line 94 of file pfunc.c.

References ContinuousStyle, ERR_NONE, FALSE, GSM_Phone::Functions, GSM_RingNoteGetFrequency(), GSM_RingNoteGetFullDuration(), INVALIDStyle, NaturalStyle, _GSM_StateMachine::Phone, GSM_Phone_Functions::PlayTone, StaccatoStyle, GSM_RingNote::Style, and GSM_RingNote::Tempo.

95 {
96  int duration, Hz;
97  GSM_Error error;
98 
99  Hz=GSM_RingNoteGetFrequency(note);
100 
101  error=s->Phone.Functions->PlayTone(s,Hz,5,first);
102  if (error!=ERR_NONE) return error;
103 
104  duration = GSM_RingNoteGetFullDuration(note);
105 
106  /* Is it correct ? Experimental values here */
107  switch (note.Style) {
108  case INVALIDStyle:
109  break;
110  case StaccatoStyle:
111  usleep(7500000);
112  error=s->Phone.Functions->PlayTone(s,0,0,FALSE);
113  if (error != ERR_NONE) return error;
114  usleep ((1400000000L/note.Tempo*duration)-(7500000));
115  break;
116  case ContinuousStyle:
117  usleep(1400000000L/note.Tempo*duration);
118  break;
119  case NaturalStyle:
120  usleep(1400000000L/note.Tempo*duration-50000);
121  error=s->Phone.Functions->PlayTone(s,0,0,FALSE);
122  if (error != ERR_NONE) return error;
123  usleep(50000);
124  break;
125  }
126  return ERR_NONE;
127 }
int GSM_RingNoteGetFrequency(GSM_RingNote Note)
Definition: gsmring.c:40
GSM_Error
Definition: gammu-error.h:23
GSM_Phone Phone
Definition: gsmstate.h:1431
#define FALSE
Definition: gammu-types.h:25
GSM_RingNoteStyle Style
int GSM_RingNoteGetFullDuration(GSM_RingNote Note)
Definition: gsmring.c:76
GSM_Error(* PlayTone)(GSM_StateMachine *s, int Herz, unsigned char Volume, gboolean start)
Definition: gsmstate.h:1075
GSM_Phone_Functions * Functions
Definition: gsmstate.h:1373