blob: 1c685cc28d5b13a140d0d31996a04ccf2541091c [file] [log] [blame]
#ifndef __ECALL_DAEMON_H__
#define __ECALL_DAEMON_H__
#ifndef NO_AUDIO
//#include <stdio.h>
#include "stdlib.h"
#include "string.h"
#include <libubox/blob.h>
#include <libubox/blobmsg.h>
#include <signal.h>
#include <time.h>
#include <libubox/ustream.h>
#include <libubus.h>
#include <ubusmsg.h>
#include <include/log.h>
#include <cutils/properties.h>
#define ECALL_Log(fmt, args...) RERRMSG(fmt, ##args)
#ifdef UNUSED
#undef UNUSED
#endif
#define UNUSED(x) (void)(x)
/* timer */
typedef timer_t TIMER_t;
typedef void (*SIG_HANDLER) (int, siginfo_t *, void *);
#define SIG_ECALL_PSAP_CALLBACK (SIGRTMIN)
#define SIG_ECALL_PSAP_CLEARDOWN (SIGRTMIN + 1)
#define SIG_ECALL_DIAL_SETUP (SIGRTMIN + 2)
#define SIG_ECALL_WAIT_HL_ACK (SIGRTMIN + 3)
#define SIG_ECALL_SMS_RETRANSMIT (SIGRTMIN + 4)
#define SIG_ECALL_SAVED_SMS_RETRANSMIT (SIGRTMIN + 5)
#define SIG_ECALL_DEREG_NETWORK (SIGRTMIN + 6)
#define SIG_ECALL_REDIAL_SETUP (SIGRTMIN + 7)
//#define SIG_DM_NET_LOG SIGRTMIN+1
typedef enum {
DAEMON_ECALL_IDLE = 0,
DAEMON_ECALL_MO,
DAEMON_ECALL_MO_SETUP,
DAEMON_ECALL_MO_MSD,
DAEMON_ECALL_MO_MSD_SENT,
DAEMON_ECALL_SMS
} DAEMON_ECALL_STATUS;
int ecall_subscriber_cb(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg);
void ecall_subscriber_remove_cb(struct ubus_context *ctx, struct ubus_subscriber *obj, uint32_t id);
int RildReady(void);
int ecall_handle_ril_ind(struct ubus_context *ctx, unsigned int rilid, unsigned int rilerror, char *data, int data_len);
void ecallHandleClcc(const char *s);
void ecallHandleEcalldata(const char *s);
int ecallSendAtCmd(void *data, int sync);
unsigned int ecall_ubusSendEcallCmd(unsigned int sAtpIndex, unsigned int op_id, unsigned int param1, char* MSD);
int ecall_invoke_noreply(unsigned int sAtpIndex, const char *service, const char *method, struct blob_attr *msg);
char *ecall_strsep(char **s, const char *del);
int at_tok_start(char **p_cur);
void skipWhiteSpace(char **p_cur);
void skipNextComma(char **p_cur);
char * nextTok(char **p_cur);
int at_tok_nextint_base(char **p_cur, int *p_out, int base, int uns);
int at_tok_nextint(char **p_cur, int *p_out);
int at_tok_nextstr(char **p_cur, char **p_out);
int at_tok_hasmore(char **p_cur);
int ecall_ubus_sms_send(char* smsNum, char* txtData);
void ecallHandleEcallType(const char *s);
int ecall_set_ecall_status(DAEMON_ECALL_STATUS ecallStatus);
int ecall_daemon_set_ecallPush(int val);
int ecall_daemon_set_mode(int val);
int ecall_daemon_get_mode(void);
int ecall_current_is_ecallOnly_mode(void);
char* ecallStrdup(const char* str);
//void ecallStartTimer(struct uloop_timeout *timeout, int timeVal);
//void ecallStopTimer(struct uloop_timeout *timeout);
void ecall_redial_and_send_msd(void);
void ecall_redial_only(void);
void ecallHandlePsapHangUp(void);
void ecallHandleEcallSwitchMode(const char *s);
void ecallHandleSmsMsdResp(void);
void ecall_get_network_status(void);
int handle_ecallNetwork(void *data);
int ecall_msd_saved(char *filePath, char *ecallMsd);
int ecall_save_alAck(char *aLAckStr);
char * ecall_get_timestamp(void);
int ecall_sms_send_cfg_msd(void);
int ecall_sms_send_saved_msd(void);
int ecall_sms_send_smsFailed_msd(void);
void ecallClearTimer(void);
void ecall_retransmit_send_msd(void);
void ecallHandleSmsReceived(const char *s);
void ecall_sms_deReg(void);
void ecall_start_manual_ecall(void);
void ecall_start_auto_ecall(void);
void ecall_daemon_str2hex(int src_len, char *psrc, char *pdest, int dest_len);
int ecall_ubus_get_cmgr(int index);
void ecallHandleSmsIdxRecvExt(void *data);
void ecallHandleSmsIdxRecvONSim(void *data);
void ecallHandleNetworkChanged(void *data);
void ecall_set_voice_data(unsigned int cmd_id, unsigned int res_id, unsigned int param);
void ecall_stop_auto_answer(void);
void ecallHandleEcallCeer(const char *s);
void ecall_reset_msd_timestamp(void);
int ecall_send_getEcallOnly_cmd(void);
void ecall_handle_ecallOnly_response(const char *s);
void ecall_handle_ecallOnlySim_response(const char *s);
int ecall_send_getEcallOnlySim_cmd(void);
int ecall_daemon_set_ecallSmsNum(char *ecallSmsNum);
char * ecall_daemon_get_ecallSmsNum(void);
int ecall_daemon_set_ecallMsd(char *ecallMsd);
char * ecall_daemon_get_ecallMsd(void);
int ecall_daemon_set_ecallTimer(char *timerName, int timerValue);
int ecall_daemon_get_ecallTimerValue(char *timerName);
int ecall_daemon_handle_setMode(char *ecallMode);
int ecall_daemon_send_msdSms(int smsFalg);
int ecall_daemon_set_ecallTestNum(char *ecallTestNum, char *ecallReconfigNum);
int ecall_send_updateMsd_cmd(void);
void ecall_handle_msdGen_response(const char *s);
int ecall_daemon_send_ceer_cmd(void);
void ecall_handle_ceer_response(const char *s);
void ecall_daemon_get_ecallParams(char *respBuff, int buffLen);
int ecall_daemon_invoke_noreply(const char *service, const char *method, struct blob_attr *msg);
int ecall_daemon_ubus_send_ecallCmd(unsigned int op_id, unsigned int param1);
int ecall_save_curMsd(void);
int ecall_clear_curMsd(void);
int ecall_clear_allSavedMsd(void);
int ecall_set_msdPath(char *msdPath);
char * ecall_get_msdPath(void);
int ecall_check_msd_hasMore(void);
void ecall_clear_status(void);
void ecall_timer_init(void);
int ecall_start_timer(TIMER_t *timerid, int signum, SIG_HANDLER timeout_handler);
int ecall_enable_timer(TIMER_t timerid, long secs);
int ecall_disable_timer(TIMER_t timerid);
int ecall_delete_timer(TIMER_t timerid);
unsigned int ecall_get_ubus_ril_id(void);
#endif
#endif