10 #include <gammu-error.h>
11 #include <gammu-message.h>
12 #include <gammu-misc.h>
16 * SMS daemon manipulations
20 * SMSD configuration data, these are not expected to be manipulated
21 * directly by application.
25 typedef struct _GSM_SMSDConfig GSM_SMSDConfig
;
28 * Length of texts in GSM_SMSDStatus structure.
30 #define SMSD_TEXT_LENGTH 255
33 * Status structure, which can be found in shared memory (if supported
40 * Version of this structure (1 for now).
44 * PhoneID from configuration.
46 char PhoneID
[SMSD_TEXT_LENGTH
+ 1];
48 * Client software name.
50 char Client
[SMSD_TEXT_LENGTH
+ 1];
52 * Current phone battery state.
54 GSM_BatteryCharge Charge
;
56 * Current network state.
58 GSM_SignalQuality Network
;
60 * Number of received messages.
64 * Number of sent messages.
68 * Number of messages which failed to be send.
74 char IMEI
[GSM_MAX_IMEI_LENGTH
+ 1];
78 * Enqueues SMS message in SMS daemon queue.
80 * \param Config SMSD configuration pointer.
81 * \param sms Message data to send.
82 * \param NewID Pointer to string where ID of new message will be
83 * written. Can be NULL and then it is ignored.
89 GSM_Error
SMSD_InjectSMS(GSM_SMSDConfig
* Config
, GSM_MultiSMSMessage
* sms
, char *NewID
);
92 * Gets SMSD status via shared memory.
94 * \param Config SMSD configuration pointer.
95 * \param status pointer where status will be copied
101 GSM_Error
SMSD_GetStatus(GSM_SMSDConfig
* Config
, GSM_SMSDStatus
* status
);
104 * Flags SMSD daemon to terminate itself gracefully.
106 * \param Config Pointer to SMSD configuration data.
112 GSM_Error
SMSD_Shutdown(GSM_SMSDConfig
* Config
);
115 * Reads SMSD configuration.
117 * \param filename File name of configuration.
118 * \param Config Pointer to SMSD configuration data.
119 * \param uselog Whether to log errors to configured log.
125 GSM_Error
SMSD_ReadConfig(const char *filename
, GSM_SMSDConfig
* Config
,
129 * Main SMS daemon loop. It connects to phone, scans for messages and
130 * sends messages from inbox. Can be interrupted by SMSD_Shutdown.
134 * \param Config Pointer to SMSD configuration data.
135 * \param exit_on_failure Whether failure should lead to terminaton of
137 * \param max_failures Maximal number of failures after which SMSD will
138 * terminate. Use 0 to not terminate on failures.
144 GSM_Error
SMSD_MainLoop(GSM_SMSDConfig
* Config
, gboolean exit_on_failure
, int max_failures
);
147 * Creates new SMSD configuration.
149 * \param name Name of process, will be used for logging. If NULL,
150 * gammu-smsd text is used.
152 * \return Pointer to SMSD configuration data block.
156 GSM_SMSDConfig
*SMSD_NewConfig(const char *name
);
159 * Frees SMSD configuration.
161 * \param config Pointer to SMSD configuration data.
165 void SMSD_FreeConfig(GSM_SMSDConfig
* config
);
168 /* Editor configuration
169 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: