option to define SMS recipient via config
This commit is contained in:
parent
1d7c2b6a15
commit
849e8dc502
@ -54,9 +54,6 @@ bool gammu_send_sms(const char* message)
|
|||||||
GSM_SMSMessage sms;
|
GSM_SMSMessage sms;
|
||||||
GSM_SMSC PhoneSMSC;
|
GSM_SMSC PhoneSMSC;
|
||||||
int return_value = 0;
|
int return_value = 0;
|
||||||
// STUB: recipient number must be in config file
|
|
||||||
const char recipient_number[]="+79515019051";
|
|
||||||
// END STUB
|
|
||||||
|
|
||||||
/* Prepare message */
|
/* Prepare message */
|
||||||
// Cleanup the structure
|
// Cleanup the structure
|
||||||
|
2
yasnd.c
2
yasnd.c
@ -16,6 +16,7 @@ cfg_t *cfg; // pointer to configuration structure
|
|||||||
host_decl* hosts=NULL; // structure with hosts' definitions
|
host_decl* hosts=NULL; // structure with hosts' definitions
|
||||||
int hosts_count=0; // count of hosts
|
int hosts_count=0; // count of hosts
|
||||||
int debug_flag=0;
|
int debug_flag=0;
|
||||||
|
char* recipient_number=NULL; // recipient of sms alerts
|
||||||
|
|
||||||
void log_debug(const char *message,int verbosity)
|
void log_debug(const char *message,int verbosity)
|
||||||
{
|
{
|
||||||
@ -44,6 +45,7 @@ void init()
|
|||||||
cfg_opt_t opts[] = {
|
cfg_opt_t opts[] = {
|
||||||
CFG_STR_LIST("hosts", "{}", CFGF_NONE),
|
CFG_STR_LIST("hosts", "{}", CFGF_NONE),
|
||||||
CFG_SIMPLE_INT("debug", &debug_flag),
|
CFG_SIMPLE_INT("debug", &debug_flag),
|
||||||
|
CFG_SIMPLE_STR("sms_recipient", &recipient_number),
|
||||||
CFG_END()
|
CFG_END()
|
||||||
};
|
};
|
||||||
cfg = cfg_init(opts, CFGF_NONE);
|
cfg = cfg_init(opts, CFGF_NONE);
|
||||||
|
1
yasnd.h
1
yasnd.h
@ -26,5 +26,6 @@ extern int hosts_count; // count of hosts
|
|||||||
extern int debug_flag;
|
extern int debug_flag;
|
||||||
extern GSM_Error error; // structure to store possible gammu errors
|
extern GSM_Error error; // structure to store possible gammu errors
|
||||||
extern GSM_StateMachine *state_machine; // structure to interact with mobile phones
|
extern GSM_StateMachine *state_machine; // structure to interact with mobile phones
|
||||||
|
extern char* recipient_number;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user