nt9856x/code/application/source/sf_app/code/include/sf_service.h
2024-02-04 17:48:37 +08:00

120 lines
4.1 KiB
C
Executable File

#ifndef __SF_SERVICE_H__
#define __SF_SERVICE_H__
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#include "sf_type.h"
#include "sf_param_common.h"
#define QLOG_PATH "qlog/"
#define SF_APP_ERROR_NO_SUPPOET SF_ERR_ID(SF_MOD_APP, ERROR_NO_SUPPORT)
#define SF_APP_ERROR_REQUEST SF_ERR_ID(SF_MOD_APP, ERROR_REQUEST)
#define SF_APP_ERROR_QIACT SF_ERR_ID(SF_MOD_APP, ERROR_AT_ACTIVE)
#define SF_APP_ERROR_NO_FILE SF_ERR_ID(SF_MOD_APP, ERROR_NO_FILE)
#define SF_APP_ERROR_WRITE SF_ERR_ID(SF_MOD_APP, ERROR_WRITE)
#define SF_APP_ERROR_FILE_SEND SF_ERR_ID(SF_MOD_APP, ERROR_FILE_SEND)
#define SF_STRLEN(a) (UINT32)strlen((char *)a)
#define SF_STRCPY(a, b) strcpy((char *)a, (char *)b)
#define SF_STRNCPY(a, b, c) strncpy((char *)a, (char *)b, c)
#define SF_STRCMP(a, b) strcmp((char *)a, (char *)b)
#define SF_STRNCMP(a, b, c) strncmp((char *)a, (char *)b, c)
#define SF_STRSTR(a, b) (UINT8 *)strstr((char *)a, (char *)b)
#define SF_STRTOK(a, b) (UINT8 *)strtok((char *)a, (char *)b)
#define SF_SPRINTF(a, ...) sprintf((char *)a, __VA_ARGS__)
#define SF_STRCASECMP(a, b) strcasecmp((char *)a, (char *)b)
#define SF_STRSEP(a, b) strsep((char **)a, (char *)b)
#define SF_STRCAT(a, b) strcat((char *)a, (char *)b)
#define SF_STRTOLL(a, b, c) strtoll((char *)a, (char **)b, c)
#define SF_MEMSET(a, b, c) memset((void *) a, (char) b, (int) c)
#define SF_OPEN(a, b, c) open((void *) a, (int) b, (int) c)
#define SF_CLOSE(a) close((int) a)
#define SF_READ(a, b, c) read((int) a, (char *)b, (int) c)
#define SF_WRITE(a, b, c) write((int) a, (char *)b, (int) c)
#define SF_SEEK(a, b, c) lseek((int) a, (int) b, (int) c)
#define SF_SYNC() sync()
#define SF_DELETE(a) remove((char *)a)
#define SF_RENAME(a, b) rename((char *)a, (char *)b)
#define SF_APP_CHECK_RANGE(cmd, min,max) \
do { \
if(cmd < min || cmd > max)\
{\
MLOGE("Parameter[%d] out of normal range [%#x,%#x)!!!\n",cmd,min,max);\
return SF_FAILURE;\
} \
} while (0)
typedef enum SF_CMD_TYPE_E {
SF_CMD_LOGIN_IN,
SF_CMD_REPORT_STATE,
SF_CMD_PHOTO_RESULT,
SF_CMD_QUERYPENDING_CMD,
SF_CMD_QUERYPENDING_PARAM,
SF_CMD_REPORT_RESULT,
SF_CMD_TRIGGER,
SF_CMD_DISCON_SEND,
SF_CMD_QUERYPENDING_BIND_ACCOUNT,
SF_CMD_SYNC_CFG,
SF_CMD_BUTT
} SF_CMD_TYPE_E;
typedef struct SF_OPERATORS_LIST_S
{
UINT8 OperatorNameLong[20];
UINT8 OperatorNameShort[10];
UINT8 OperatorNum[10];
UINT8 SignalVal;
UINT8 NetType;
UINT8 Index;
struct SF_OPERATORS_LIST_S *pPre;
struct SF_OPERATORS_LIST_S *pNext;
} SF_OPERATORS_LIST_T;
typedef struct sf_gps_param {
int timeout_ms;
int period_ms;
}SF_GPS_PARAM;
SINT32 app_file_upload(SF_FILE_ATTR_S *pstFileAttr, SF_FN_PARAM_S *pfnParam);
SF_BOOL app_disconnect_4g_module(void);
SINT32 app_ttyusb_IsOpen(void);
SINT32 sf_ttyusb_restart(void);
SINT32 app_file_subscrible_check(SF_REPORT_FILE_ATTR_S *pDtsReportFileAttr,SF_REPORT_FILE_ATTR_S *pSrcReportFileAttr);
SINT32 sf_USB_net_init(void);
SINT32 app_RegisterNet_start(void);
void app_FileSend_start(void);
SINT32 app_t110(void);
SINT32 sf_app_to_cardv_capture(void);
SINT32 sf_module_reboot_reg_net(void);
SINT32 sf_restart_reg_net(void);
SINT32 sf_app_to_cardv_hd_ture(void);
int sf_check_eth0(void);
int sf_check_usb0(void);
void serach_gps_onkey_start(void);
SINT32 open_gps(const SINT32 utc);
int get_gps_location(void);
void keep_get_gps_location(const SF_GPS_PARAM param);
void keep_seraching_gps_location(const int timeout_ms);
void app_RegisterNet_stop(void);
int sf_check_sd(void);
void sf_save_camera_gps_info(void);
void set_at_parament(void);
int sf_net_dns_ck(void);
void sf_register_net_para_ck(void);
SINT32 sf_app_auto_send_start(void);
SINT32 sf_file_send_auto(void);
SINT32 sf_app_auto_net_start(void);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif