# SMSD

GSM_Error SMSD_InjectSMS(GSM_SMSDConfig *Config, GSM_MultiSMSMessage *sms, char *NewID)

  Enqueues SMS message in SMS daemon queue.

  Parameters:

    - Config – SMSD configuration pointer.

    - sms – Message data to send.

    - NewID – Pointer to string where ID of new message will be written. Can be NULL and then it is ignored.

  Returns:

    Error code

GSM_Error SMSD_GetStatus(GSM_SMSDConfig *Config, GSM_SMSDStatus *status)

  Gets SMSD status via shared memory.

  Parameters:

    - Config – SMSD configuration pointer.

    - status – pointer where status will be copied

  Returns:

    Error code

GSM_Error SMSD_Shutdown(GSM_SMSDConfig *Config)

  Flags SMSD daemon to terminate itself gracefully.

  Parameters:

    - Config – Pointer to SMSD configuration data.

  Returns:

    Error code

GSM_Error SMSD_ReadConfig(const char *filename, GSM_SMSDConfig *Config, gboolean uselog)

  Reads SMSD configuration.

  Parameters:

    - filename – File name of configuration.

    - Config – Pointer to SMSD configuration data.

    - uselog – Whether to log errors to configured log.

  Returns:

    Error code

GSM_Error SMSD_MainLoop(GSM_SMSDConfig *Config, gboolean exit_on_failure, int max_failures)

  Main SMS daemon loop. It connects to phone, scans for messages and sends messages from inbox. Can be interrupted by SMSD_Shutdown.

  See also

  SMSD_Shutdown

  Parameters:

    - Config – Pointer to SMSD configuration data.

    - exit_on_failure – Whether failure should lead to terminaton of program.

    - max_failures – Maximal number of failures after which SMSD will terminate. Use 0 to not terminate on failures.

  Returns:

    Error code

GSM_SMSDConfig *SMSD_NewConfig(const char *name)

  Creates new SMSD configuration.

  Parameters:

    - name – Name of process, will be used for logging. If NULL, gammu-smsd text is used.

  Returns:

    Pointer to SMSD configuration data block.

void SMSD_FreeConfig(GSM_SMSDConfig *config)

  Frees SMSD configuration.

  Parameters:

    - config – Pointer to SMSD configuration data.

struct GSM_SMSDStatus

  Status structure, which can be found in shared memory (if supported on platform).

  Public Members

  int Version

    Version of this structure (2 for now).

  char PhoneID[SMSD_TEXT_LENGTH + 1]

    PhoneID from configuration.

  char Client[SMSD_TEXT_LENGTH + 1]

    Client software name.

  GSM_BatteryCharge Charge

    Current phone battery state.

  GSM_SignalQuality Network

    Current network state.

  int Received

    Number of received messages.

  int Sent

    Number of sent messages.

  int Failed

    Number of messages which failed to be send.

  char IMEI[GSM_MAX_IMEI_LENGTH + 1]

    Phone IMEI.

  char IMSI[GSM_MAX_INFO_LENGTH + 1]

    SIM IMSI.

  GSM_NetworkInfo NetInfo

    Network information.

typedef struct _GSM_SMSDConfig GSM_SMSDConfig

  SMSD configuration data, these are not expected to be manipulated directly by application.