Translated using Weblate.
[gammu.git] / include / gammu-smsd.h
blob7acd7ce991410fc37563cf221f71bb59a12f91db
1 /**
2 * \file gammu-smsd.h
3 * \author Michal Čihař
5 * SMSD interaction
6 */
7 #ifndef __gammu_smsd_h
8 #define __gammu_smsd_h
10 #include <gammu-error.h>
11 #include <gammu-message.h>
12 #include <gammu-misc.h>
14 /**
15 * \defgroup SMSD SMSD
16 * SMS daemon manipulations
19 /**
20 * SMSD configuration data, these are not expected to be manipulated
21 * directly by application.
23 * \ingroup SMSD
25 typedef struct _GSM_SMSDConfig GSM_SMSDConfig;
27 /**
28 * Length of texts in GSM_SMSDStatus structure.
30 #define SMSD_TEXT_LENGTH 255
32 /**
33 * Status structure, which can be found in shared memory (if supported
34 * on platform).
36 * \ingroup SMSD
38 typedef struct {
39 /**
40 * Version of this structure (1 for now).
42 int Version;
43 /**
44 * PhoneID from configuration.
46 char PhoneID[SMSD_TEXT_LENGTH + 1];
47 /**
48 * Client software name.
50 char Client[SMSD_TEXT_LENGTH + 1];
51 /**
52 * Current phone battery state.
54 GSM_BatteryCharge Charge;
55 /**
56 * Current network state.
58 GSM_SignalQuality Network;
59 /**
60 * Number of received messages.
62 int Received;
63 /**
64 * Number of sent messages.
66 int Sent;
67 /**
68 * Number of messages which failed to be send.
70 int Failed;
71 /**
72 * Phone IMEI.
74 char IMEI[GSM_MAX_IMEI_LENGTH + 1];
75 } GSM_SMSDStatus;
77 /**
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.
85 * \return Error code
87 * \ingroup SMSD
89 GSM_Error SMSD_InjectSMS(GSM_SMSDConfig * Config, GSM_MultiSMSMessage * sms, char *NewID);
91 /**
92 * Gets SMSD status via shared memory.
94 * \param Config SMSD configuration pointer.
95 * \param status pointer where status will be copied
97 * \return Error code
99 * \ingroup SMSD
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.
108 * \return Error code
110 * \ingroup SMSD
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.
121 * \return Error code
123 * \ingroup SMSD
125 GSM_Error SMSD_ReadConfig(const char *filename, GSM_SMSDConfig * Config,
126 gboolean uselog);
129 * Main SMS daemon loop. It connects to phone, scans for messages and
130 * sends messages from inbox. Can be interrupted by SMSD_Shutdown.
132 * \see SMSD_Shutdown
134 * \param Config Pointer to SMSD configuration data.
135 * \param exit_on_failure Whether failure should lead to terminaton of
136 * program.
137 * \param max_failures Maximal number of failures after which SMSD will
138 * terminate. Use 0 to not terminate on failures.
140 * \return Error code
142 * \ingroup SMSD
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.
154 * \ingroup SMSD
156 GSM_SMSDConfig *SMSD_NewConfig(const char *name);
159 * Frees SMSD configuration.
161 * \param config Pointer to SMSD configuration data.
163 * \ingroup SMSD
165 void SMSD_FreeConfig(GSM_SMSDConfig * config);
166 #endif
168 /* Editor configuration
169 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: