1.更新0417IQ;2.调整sf app
This commit is contained in:
parent
d28e78b4a6
commit
ffb3e99f4e
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,3 +5,4 @@
|
|||
modules.order
|
||||
.tmp_versions
|
||||
Module.symvers
|
||||
/.vs
|
||||
|
|
11
.vscode/settings.json
vendored
Executable file
11
.vscode/settings.json
vendored
Executable file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"sf_param_common.h": "c",
|
||||
"sf_filemng.h": "c",
|
||||
"hmacsha.h": "c",
|
||||
"stdio.h": "c",
|
||||
"sf_hal_ttyusb.h": "c",
|
||||
"type.h": "c",
|
||||
"sf_commu_mcu_reg.h": "c"
|
||||
}
|
||||
}
|
31
S530_VS.sln
Executable file
31
S530_VS.sln
Executable file
|
@ -0,0 +1,31 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33530.505
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "S530_VS", "S530_VS.vcxproj", "{956E88C5-C345-403E-ABC3-537D4B4CB4B7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{956E88C5-C345-403E-ABC3-537D4B4CB4B7}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{956E88C5-C345-403E-ABC3-537D4B4CB4B7}.Debug|x64.Build.0 = Debug|x64
|
||||
{956E88C5-C345-403E-ABC3-537D4B4CB4B7}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{956E88C5-C345-403E-ABC3-537D4B4CB4B7}.Debug|x86.Build.0 = Debug|Win32
|
||||
{956E88C5-C345-403E-ABC3-537D4B4CB4B7}.Release|x64.ActiveCfg = Release|x64
|
||||
{956E88C5-C345-403E-ABC3-537D4B4CB4B7}.Release|x64.Build.0 = Release|x64
|
||||
{956E88C5-C345-403E-ABC3-537D4B4CB4B7}.Release|x86.ActiveCfg = Release|Win32
|
||||
{956E88C5-C345-403E-ABC3-537D4B4CB4B7}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {BF83FDA2-3222-4B3A-9500-DE8DF6048A07}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
84203
S530_VS.vcxproj
Executable file
84203
S530_VS.vcxproj
Executable file
File diff suppressed because it is too large
Load Diff
252301
S530_VS.vcxproj.filters
Executable file
252301
S530_VS.vcxproj.filters
Executable file
File diff suppressed because it is too large
Load Diff
4
S530_VS.vcxproj.user
Executable file
4
S530_VS.vcxproj.user
Executable file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
|
@ -32,7 +32,7 @@ EMBMEM = EMBMEM_SPI_NOR
|
|||
FW_TYPE = FW_TYPE_PARTIAL
|
||||
UI_STYLE = UI_STYLE_LVGL
|
||||
NVT_CFG_APP_EXTERNAL = hostapd wireless_tool iperf-3 wpa_supplicant dhd_priv
|
||||
NVT_CFG_APP = mem cardv memcpy isp_demon
|
||||
NVT_CFG_APP = mem cardv memcpy isp_demon sf_app
|
||||
NVT_ROOTFS_ETC =
|
||||
NVT_BINARY_FILE_STRIP = yes
|
||||
NVT_CFG_KERNEL_CFG = na51089_evb_cardv_defconfig_release
|
||||
|
|
|
@ -68,7 +68,7 @@ C_LDFLAGS = \
|
|||
LDSCRIPT = $(MODULE_NAME).lds
|
||||
LDS_EXTERN = extern.lds
|
||||
OUTPUT_NAME = $(OUTPUT_DIR)/cardv
|
||||
#OUTPUT2_NAME = $(OUTPUT_DIR)/sf_app
|
||||
#OUTPUT2_NAME = $(OUTPUT_DIR)/sifar_app
|
||||
IMG_NAME = $(OUTPUT_DIR)/$(MODULE_NAME).img
|
||||
MAP_NAME = $(OUTPUT_DIR)/$(MODULE_NAME).map
|
||||
SYM_NAME = $(OUTPUT_DIR)/$(MODULE_NAME).sym
|
||||
|
@ -368,7 +368,7 @@ cim: $(DTB) $(OBJ)
|
|||
clean:
|
||||
@rm -rf $(OBJ) $(MAIN_C:.c=.o) $(LDS_EXTERN) $(DTB) $(OUTPUT_DIR)
|
||||
|
||||
install: $(OUTPUT_NAME) $(OUTPUT_APPFS)
|
||||
install: $(OUTPUT_NAME) $(OUTPUT_APPFS)
|
||||
@mkdir -p $(INSTALL_DIR)
|
||||
@cp -avf $(OUTPUT_NAME) $(INSTALL_DIR)
|
||||
@cp -avf $(OUTPUT_NAME) $(ROOTFS_DIR)/rootfs/usr/bin
|
||||
|
|
|
@ -13,6 +13,7 @@ int main(int argc, char *argv[])
|
|||
gpio_direction_input(C_GPIO(10));
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#if MOVIE_ISP_LOG
|
||||
#include "vendor_isp.h"
|
||||
#include "sf_mcu.h"
|
||||
#endif
|
||||
//#NT#2016/10/17#Bin Xiao -end
|
||||
#define __MODULE__ MovieStamp
|
||||
|
@ -276,6 +277,9 @@ static void MovieStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen)
|
|||
AET_STATUS_INFO ae_status = {0};
|
||||
AWBT_STATUS awb_status = {0};
|
||||
IQT_WDR_PARAM wdr = {0};
|
||||
//sf_mcu_power_on_para_get(SF_MCU_POWERON);
|
||||
UINT16 AD_Value;
|
||||
AD_Value = sf_mcu_get_irshtter();
|
||||
|
||||
id = 0;
|
||||
ae_status.id = id;
|
||||
|
@ -285,7 +289,8 @@ id = 0;
|
|||
wdr.id = id;
|
||||
vendor_isp_get_iq(IQT_ITEM_WDR_PARAM, &wdr);
|
||||
|
||||
snprintf(Buf, BufLen, "%3d %4d %4d %6d %6d %4d %4d %d %4d %4d %4d\0",
|
||||
snprintf(Buf, BufLen, "%d %3d %3d %3d %6d %6d %3d %3d %d %3d %3d %4d %d\0",
|
||||
ae_status.status_info.state_adj,
|
||||
ae_status.status_info.lv/100000,
|
||||
ae_status.status_info.lum,
|
||||
ae_status.status_info.expect_lum,
|
||||
|
@ -296,7 +301,8 @@ id = 0;
|
|||
wdr.wdr.enable,
|
||||
awb_status.status.cur_r_gain,
|
||||
awb_status.status.cur_b_gain,
|
||||
awb_status.status.cur_ct
|
||||
awb_status.status.cur_ct,
|
||||
AD_Value
|
||||
);
|
||||
//DBG_DUMP("isp Buf=%s\r\n",Buf);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "UIApp/AppDisp_PipView.h"
|
||||
#include <vf_gfx.h>
|
||||
#include "vendor_videocapture.h"
|
||||
#include "sf_mcu.h"
|
||||
|
||||
#define THIS_DBGLVL 2 // 0=FATAL, 1=ERR, 2=WRN, 3=UNIT, 4=FUNC, 5=IND, 6=MSG, 7=VALUE, 8=USER
|
||||
|
||||
|
@ -1403,11 +1404,11 @@ void PhotoStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen)
|
|||
AWBT_STATUS awb_status = {0};
|
||||
//IQT_WDR_PARAM wdr = {0};
|
||||
HD_RESULT hd_ret;
|
||||
|
||||
UINT16 AD_Value;
|
||||
if ((hd_ret = vendor_isp_init()) != HD_OK) {
|
||||
DBG_ERR("vendor_isp_init() failed(%d)\r\n", hd_ret);
|
||||
}
|
||||
|
||||
AD_Value = sf_mcu_get_irshtter();
|
||||
ae_status.id = 0;
|
||||
vendor_isp_get_ae(AET_ITEM_STATUS, &ae_status);
|
||||
awb_status.id = 0;
|
||||
|
@ -1415,7 +1416,8 @@ void PhotoStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen)
|
|||
/*wdr.id = id;
|
||||
vendor_isp_get_iq(IQT_ITEM_WDR_PARAM, &wdr);
|
||||
*/
|
||||
snprintf(Buf, BufLen, "%3d %4d %4d %6d %6d %4d %4d %4d %4d %4d\0",
|
||||
snprintf(Buf, BufLen, "%d %3d %3d %3d %6d %6d %4d %4d %3d %3d %4d %d\0",
|
||||
ae_status.status_info.state_adj,
|
||||
ae_status.status_info.lv/100000,
|
||||
ae_status.status_info.lum,
|
||||
ae_status.status_info.expect_lum,
|
||||
|
@ -1426,9 +1428,10 @@ void PhotoStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen)
|
|||
//wdr.wdr.enable,
|
||||
awb_status.status.cur_r_gain,
|
||||
awb_status.status.cur_b_gain,
|
||||
awb_status.status.cur_ct
|
||||
awb_status.status.cur_ct,
|
||||
AD_Value
|
||||
);
|
||||
// DBG_ERR("isp Buf=%s\r\n",Buf);
|
||||
DBG_ERR("isp Buf=%s\r\n",Buf);
|
||||
if ((hd_ret = vendor_isp_uninit()) != HD_OK) {
|
||||
DBG_ERR("vendor_isp_uninit() failed(%d)\r\n", hd_ret);
|
||||
}
|
||||
|
@ -5931,11 +5934,13 @@ INT32 PhotoExe_Preview_SliceEncode_CB2(void* user_data)
|
|||
MEM_RANGE pri_jpg = {.addr = slice_encode_primary_info->bs_buf_mem_info.va + CFG_JPG_HEADER_SIZE, .size = slice_encode_primary_info->bs_buf_mem_info.used_size};
|
||||
MEM_RANGE scr_jpg = {.addr = slice_encode_screennail_info->bs_buf_mem_info.va, .size = slice_encode_screennail_info->bs_buf_mem_info.used_size};
|
||||
MEM_RANGE dst_jpg_file = { 0 };
|
||||
DBG_WRN(" EXIF\r\n");
|
||||
|
||||
/* exif */
|
||||
ExifVendor_Write0thIFD(EXIF_HDL_ID_1);
|
||||
ExifVendor_WriteExifIFD(EXIF_HDL_ID_1);
|
||||
ExifVendor_Write0thIntIFD(EXIF_HDL_ID_1);
|
||||
ExifVendor_WriteGPSIFD(EXIF_HDL_ID_1);
|
||||
if (EXIF_CreateExif(EXIF_HDL_ID_1, &exif_data, &thumb_jpg) != EXIF_ER_OK) {
|
||||
DBG_ERR("Create Exif fail\r\n");
|
||||
exif_data.size = 0;
|
||||
|
|
|
@ -166,7 +166,7 @@
|
|||
#endif
|
||||
|
||||
#define DEFAULT_ETHCAM_TX_IP_ADDR 0 //0xc00a8c0
|
||||
#define DEFAULT_BOOT_WORK_MODE SF_CAM_MODE_PHOTO_VIDEO//SF_CAM_MODE_PHOTO
|
||||
#define DEFAULT_BOOT_WORK_MODE SF_CAM_MODE_PHOTO_VIDEO//
|
||||
#define DEFAULT_SF_CAMID SF_CAMID_OFF
|
||||
#define DEFAULT_FLASH_LED SF_FLASH_LED_HIGH
|
||||
#define DEFAULT_NIGHT_MODE SF_NIGHT_MODE_MIN_BLUR//SF_NIGHT_MODE_BALANCED
|
||||
|
|
|
@ -1477,6 +1477,7 @@ void SysSetFixedFlagSysInit(void)
|
|||
|
||||
void SysResetFlag(void)
|
||||
{
|
||||
UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||
// Set system flag default value here
|
||||
// Photo
|
||||
SysSetFlag(FL_PHOTO_SIZE, DEFAULT_PHOTO_SIZE);
|
||||
|
@ -1614,9 +1615,33 @@ void SysResetFlag(void)
|
|||
SysSetFlag(PirSwitch, DEFAULT_PIR_SWITCH);
|
||||
SysSetFlag(PirSensitivity, DEFAULT_PIR_SENSITIVITY);
|
||||
SysSetFlag(PirDelaySwitch, DEFAULT_PIR_DELAY_SWITCH);
|
||||
|
||||
SysSetFlag(TimelapseSwitch, DEFAULT_TIMELAPSE_SWITCH);
|
||||
if(SysGetFlag(TimelapseSwitch))
|
||||
{
|
||||
puiPara->TimelapseTime.Hour = 0;
|
||||
puiPara->TimelapseTime.Min = 0;
|
||||
puiPara->TimelapseTime.Sec = 5;
|
||||
}
|
||||
|
||||
SysSetFlag(WorkTime1Switch, DEFAULT_WORKTIME_SWITCH);
|
||||
if(SysGetFlag(WorkTime1Switch))
|
||||
{
|
||||
puiPara->WorkTime[0].StartTime.Hour = 16;
|
||||
puiPara->WorkTime[0].StartTime.Min = 0;
|
||||
puiPara->WorkTime[0].StopTime.Hour = 20;
|
||||
puiPara->WorkTime[0].StopTime.Min = 0;
|
||||
}
|
||||
|
||||
SysSetFlag(WorkTime2Switch, DEFAULT_WORKTIME_SWITCH);
|
||||
if(SysGetFlag(WorkTime2Switch))
|
||||
{
|
||||
puiPara->WorkTime[1].StartTime.Hour = 5;
|
||||
puiPara->WorkTime[1].StartTime.Min = 0;
|
||||
puiPara->WorkTime[1].StopTime.Hour = 8;
|
||||
puiPara->WorkTime[1].StopTime.Min = 0;
|
||||
}
|
||||
|
||||
SysSetFlag(SimAutoSwitch, DEFAULT_SIM_AUTO_SWITCH);
|
||||
SysSetFlag(SendMaxNum, DEFAULT_SEND_MAX_NUM);
|
||||
SysSetFlag(GprsMode, DEFAULT_GPRS_MODE);
|
||||
|
@ -1667,6 +1692,8 @@ void SysResetFlag(void)
|
|||
SysSetFlag(TimeSend4Switch, DEFAULT_TIMESEND4_SWITCH);
|
||||
//sf_set_pir_sensitivity(7);
|
||||
#endif
|
||||
|
||||
|
||||
printf("%s:%d sifar para e\n", __FUNCTION__, __LINE__);
|
||||
|
||||
|
||||
|
|
|
@ -7,9 +7,16 @@
|
|||
#endif
|
||||
|
||||
//============Sifar==============///Payton
|
||||
#ifndef SF_DATA_UI_TYPE
|
||||
#define SF_DATA_UI_TYPE
|
||||
|
||||
#define SF_TIMER_MAX_NUMBER 2
|
||||
typedef struct sf_PARA_TIME_S
|
||||
{
|
||||
{
|
||||
UINT16 Year;
|
||||
UINT16 Mon;
|
||||
UINT16 Day;
|
||||
|
||||
UINT8 Hour;
|
||||
UINT8 Min;
|
||||
UINT8 Sec;
|
||||
|
@ -20,6 +27,7 @@ typedef struct sf_WORKTIME_S
|
|||
SF_PARA_TIME_S StartTime;
|
||||
SF_PARA_TIME_S StopTime;
|
||||
} SF_WORKTIME_S;
|
||||
#endif
|
||||
//============Sifar==============///Payton
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,3 +77,8 @@ C_PREDEFINED = \
|
|||
-D_$(TOUCH)_ \
|
||||
-D_$(NVT_ETHREARCAM)_\
|
||||
-D_$(NVT_ETHREARCAM_CAPS_COUNT)_\
|
||||
-DCFG_MODULE_EG91 \
|
||||
-DCFG_COMM_MCU_UART \
|
||||
-DCFG_SUPPORT_OTHER_SIM \
|
||||
-DCFG_SUPPORT_GPS \
|
||||
|
|
@ -32,6 +32,27 @@ endif
|
|||
SIFAR_DIR = $(LIBRARY_DIR)/source/sifar/code
|
||||
SIFAR_APP_DIR = ./code/include
|
||||
|
||||
#LIB DIRs for C_LDFLAGS
|
||||
EXTRA_LIB_DIR += \
|
||||
-L$(LIBC_LIB_DIR) \
|
||||
-L$(GCC_LIB_DIR) \
|
||||
-L$(STDC_LIB_DIR) \
|
||||
-L$(SYSROOT_LIB_DIR) \
|
||||
-L$(NVT_HDAL_DIR)/output \
|
||||
-L$(NVT_HDAL_DIR)/vendor/output \
|
||||
-L$(NVT_HDAL_DIR)/vendor/media/drivers/output/ \
|
||||
-L$(NVT_HDAL_DIR)/vendor/isp/drivers/output/ \
|
||||
-L$(KDRV_DIR)/output \
|
||||
-L$(EXT_DIR)/panel/output \
|
||||
-L$(EXT_DIR)/sensor/output \
|
||||
-L$(EXT_DIR)/audio/output \
|
||||
-L$(KFLOW_DIR)/output \
|
||||
-L$(HDAL_SAMPLE_DIR)/output \
|
||||
-L$(LIBRARY_DIR)/output \
|
||||
-L$(VOS_DRIVER_DIR)/output \
|
||||
-L$(NVT_VOS_DIR)/output \
|
||||
-L$(NVT_DRIVER_DIR)/output \
|
||||
|
||||
# public includes
|
||||
EXTRA_INCLUDE += \
|
||||
-I$(NVT_VOS_DIR)/include \
|
||||
|
@ -52,7 +73,6 @@ EXTRA_INCLUDE += \
|
|||
-I$(KDRV_DIR)/source/kdrv_gfx2d/kdrv_affine/include \
|
||||
-I$(NVT_HDAL_DIR)/vendor/media/include \
|
||||
-I$(NVT_HDAL_DIR)/vendor/common/include \
|
||||
-I$(SIFAR_DIR)/include \
|
||||
-I$(SIFAR_APP_DIR) \
|
||||
|
||||
# application local includes
|
||||
|
@ -84,9 +104,99 @@ EXTRA_INCLUDE += \
|
|||
|
||||
#--------- END OF INCs FOR C_CFLAGS ---------------------------------------------------
|
||||
|
||||
# kernel, vos, libc, others necessary
|
||||
EXTRA_LIB = \
|
||||
-lgcc \
|
||||
-lgcc_s \
|
||||
-lc -lgcc \
|
||||
-lgcc_s \
|
||||
-lrt \
|
||||
-lm \
|
||||
-l:libstdc++.a \
|
||||
-lpthread \
|
||||
|
||||
# vos
|
||||
EXTRA_LIB += \
|
||||
-l:libvos.a \
|
||||
|
||||
# hdal, vendor
|
||||
EXTRA_LIB += \
|
||||
-l:libhdal.a \
|
||||
-l:libvendor_media.a \
|
||||
-l:libvendor_isp.a \
|
||||
-l:libprebuilt_isp.a \
|
||||
|
||||
# code/lib
|
||||
EXTRA_LIB += \
|
||||
-l:libsifar.a \
|
||||
-l:libSxTimer.a \
|
||||
-l:libgxgfx.a \
|
||||
-l:libnvtuser.a \
|
||||
-l:libuicontrol.a \
|
||||
-l:libvcontrol.a \
|
||||
-l:libappcontrol.a \
|
||||
-l:libvf_gfx.a \
|
||||
-l:libutility.a \
|
||||
-l:libfdt.a \
|
||||
-l:libWiFiIpc.a \
|
||||
-l:libfiledb.a \
|
||||
-l:libDCF.a \
|
||||
-l:libFileSys.a \
|
||||
-l:libNameRule.a \
|
||||
-l:libFsLinux.a \
|
||||
-l:libio.a \
|
||||
-l:libstrg.a \
|
||||
-l:libfileout.a \
|
||||
-l:libavfile.a \
|
||||
-l:libbsmux.a \
|
||||
-l:libnvtlive555.a \
|
||||
-l:libLviewNvt.a \
|
||||
-l:libgximagefile.a \
|
||||
-l:libexif.a \
|
||||
-l:libsizeconvert.a \
|
||||
-l:libimageapp_common.a \
|
||||
-l:libimageapp_moviemulti.a \
|
||||
-l:libimageapp_usbmovie.a \
|
||||
-l:libimageapp_voice.a \
|
||||
-l:libFontConv.a \
|
||||
-l:libimageapp_photo.a \
|
||||
-l:libmsdcnvt.a \
|
||||
-l:libumsd.a \
|
||||
-l:libusb2dev.a \
|
||||
-l:libimageapp_play.a \
|
||||
-l:libplayback.a \
|
||||
-l:libpbxfilelist_filedb.a \
|
||||
-l:libpbxfilelist_dcf.a \
|
||||
-l:libGxVideoFile.a \
|
||||
-l:libpbxfile.a \
|
||||
-l:libfilein.a \
|
||||
-l:libbsdemux.a \
|
||||
-l:libimageapp_movieplay.a \
|
||||
-l:libusockipc.a \
|
||||
-l:libusockcliipc.a \
|
||||
-l:libHfsNvt.a \
|
||||
-l:libuvac.a \
|
||||
-l:libuvcp.a \
|
||||
-l:libfwsrv.a \
|
||||
-l:libsw_md.a \
|
||||
-l:libPStore.a \
|
||||
-l:libethcamsocket.a \
|
||||
-l:libethsocketcli.a \
|
||||
-l:libethsockcliipc.a \
|
||||
-l:libethsocket.a \
|
||||
-l:libethcamsmi.a \
|
||||
-l:libtse.a \
|
||||
-l:liblogfile.a \
|
||||
|
||||
ifeq "$(UI_STYLE)" "UI_STYLE_LVGL"
|
||||
EXTRA_LIB += \
|
||||
-l:liblvgl.a \
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_LIB += \
|
||||
-l:libvendor_ai2.a \
|
||||
-l:libvendor_ai2_pub.a \
|
||||
-l:libprebuilt_ai.a
|
||||
|
||||
#######################################################################################
|
||||
#--------- SOURCEs FOR APPLICATION ---------------------------------------------------#
|
||||
|
@ -94,21 +204,81 @@ EXTRA_LIB += \
|
|||
|
||||
# system
|
||||
SRC = \
|
||||
./code/source/app/sf_test.c \
|
||||
./code/source/app/sf_app.c
|
||||
./code/source/app/sf_device.c \
|
||||
./code/source/app/sf_app.c \
|
||||
./code/source/gpio/sf_hal_gpio.c \
|
||||
./code/source/logMng/sf_log.c \
|
||||
./code/source/commMng/sf_message_queue.c \
|
||||
./code/source/commMng/sf_share_mem.c \
|
||||
./code/source/fileMng/cJSON.c \
|
||||
./code/source/fileMng/sf_fileMng.c \
|
||||
./code/source/signatureMng/aos_util.c \
|
||||
./code/source/signatureMng/apr_sha1.c \
|
||||
./code/source/signatureMng/HMACSHA.c \
|
||||
./code/source/signatureMng/sha256.c \
|
||||
./code/source/paramMng/sf_param_common.c \
|
||||
./code/source/qrcodeMng/bitstream.c \
|
||||
./code/source/qrcodeMng/mask.c \
|
||||
./code/source/qrcodeMng/mmask.c \
|
||||
./code/source/qrcodeMng/mqrspec.c \
|
||||
./code/source/qrcodeMng/qrenc.c \
|
||||
./code/source/qrcodeMng/qrencode.c \
|
||||
./code/source/qrcodeMng/qrinput.c \
|
||||
./code/source/qrcodeMng/qrspec.c \
|
||||
./code/source/qrcodeMng/rscode.c \
|
||||
./code/source/qrcodeMng/sf_base64.c \
|
||||
./code/source/qrcodeMng/sf_bmp.c \
|
||||
./code/source/qrcodeMng/sf_qrcode.c \
|
||||
./code/source/qrcodeMng/split.c \
|
||||
./code/source/storeMng/sf_storeMng.c \
|
||||
./code/source/ttyusb/sf_hal_ttyusb.c \
|
||||
./code/source/4gMng/sf_eg91_gps.c \
|
||||
./code/source/4gMng/sf_eg91_server.c \
|
||||
./code/source/4gMng/sf_eg91_sim.c \
|
||||
./code/source/4gMng/sf_http_server.c \
|
||||
./code/source/4gMng/sf_module.c \
|
||||
./code/source/4gMng/sf_opera_adapt.c \
|
||||
./code/source/dataMng/sf_dataMng.c \
|
||||
./code/source/dataMng/sf_transdata1.c \
|
||||
./code/source/dataMng/sf_datahttp.c \
|
||||
./code/source/systemMng/sf_systemMng.c \
|
||||
./code/source/systemMng/sf_commu_mcu_reg.c \
|
||||
./code/source/systemMng/sf_commu_mcu.c \
|
||||
./code/source/devMng/sf_dev_other.c \
|
||||
./code/source/devMng/sf_dev_usb.c \
|
||||
./code/source/devMng/sf_keymng.c \
|
||||
./code/source/devMng/sf_ledmng.c \
|
||||
./code/source/utils/mbedtls.c \
|
||||
./code/source/utils/sf_aes.c \
|
||||
./code/source/debugMng/sf_debug.c
|
||||
|
||||
|
||||
#--------- END OF SOURCEs FOR APPLICATION ---------------------------------------------
|
||||
|
||||
include $(NVT_PRJCFG_MODEL_CFG)
|
||||
#--------- ENVIRONMENT SETTING --------------------
|
||||
INCLUDES = -I$(NVT_HDAL_DIR)/include -I$(LIBRARY_DIR)/include
|
||||
WARNING = -Wall -Wundef -Wsign-compare -Wno-missing-braces -Wstrict-prototypes
|
||||
COMPILE_OPTS = $(INCLUDES) -I. -O2 -fPIC -ffunction-sections -fdata-sections
|
||||
CPPFLAGS =
|
||||
CFLAGS = $(PLATFORM_CFLAGS) $(PRJCFG_CFLAGS)
|
||||
C_FLAGS = $(COMPILE_OPTS) $(EXTRA_INCLUDE) $(EXTRA_LIB) $(CPPFLAGS) $(CFLAGS) $(WARNING) $(C_PREDEFINED)
|
||||
LD_FLAGS = -L$(LIBRARY_DIR)/output/lib -Wl,-rpath-link=$(LIBRARY_DIR)/output/lib -lrt
|
||||
C_FLAGS = $(COMPILE_OPTS) $(EXTRA_INCLUDE) $(EXTRA_LIB_DIR) $(EXTRA_LIB) $(CPPFLAGS) $(CFLAGS) $(WARNING) $(C_PREDEFINED)
|
||||
LD_FLAGS = $(EXTRA_LIB_DIR) $(EXTRA_LIB)
|
||||
|
||||
C_LDFLAGS = \
|
||||
--sysroot=$(SYSROOT_DIR) \
|
||||
--eh-frame-hdr \
|
||||
-dynamic-linker $(DYNAMIC_LINKER) \
|
||||
-X \
|
||||
-m armelf_linux_eabi \
|
||||
-T $(OUTPUT_DIR)/$(LDSCRIPT) \
|
||||
-Map $(MAP_NAME) \
|
||||
--start-group \
|
||||
$(CRT_OBJ_BEGIN) \
|
||||
$(EXTRA_LIB_DIR) \
|
||||
$(EXTRA_LIB) \
|
||||
$(CRT_OBJ_END) \
|
||||
--end-group
|
||||
|
||||
#--------- END OF ENVIRONMENT SETTING -------------
|
||||
|
||||
#--------- Compiling -------------------
|
||||
|
|
3
code/application/source/sf_app/build/cardv_inc.mk
Executable file
3
code/application/source/sf_app/build/cardv_inc.mk
Executable file
|
@ -0,0 +1,3 @@
|
|||
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/common/inc
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/cardv_debug/inc
|
14
code/application/source/sf_app/build/config.mk
Executable file
14
code/application/source/sf_app/build/config.mk
Executable file
|
@ -0,0 +1,14 @@
|
|||
|
||||
CUR_DIR_NAME = $(shell pwd |sed 's/^\(.*\)[/]//' )
|
||||
CUR_PARENT_DIR_NAME = $(shell cd ./..;pwd|sed 's/^\(.*\)[/]//')
|
||||
|
||||
CFG_4G_ENBLE =y
|
||||
CFG_LIVE_ENBLE =n
|
||||
CFG_MODULE_TYPE =EG91
|
||||
CFG_COMM_MCU_TYPE =UART
|
||||
CFG_TRANSDATA_TYPE =HTTP
|
||||
CFG_DUAL_PROCESS_EN =y
|
||||
|
||||
CFG_CASE_TYPE =T100
|
||||
CFG_OTHER_SIM =y
|
||||
CFG_GPS =y
|
72
code/application/source/sf_app/build/inc.mk
Executable file
72
code/application/source/sf_app/build/inc.mk
Executable file
|
@ -0,0 +1,72 @@
|
|||
include $(SF_CS_DIR)/build/config.mk
|
||||
C_FLAGS :=
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/hal/gpio/inc
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/hal/ttyusb/inc
|
||||
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/logMng/inc
|
||||
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/fileMng/inc
|
||||
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/commMng/inc
|
||||
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/dataMng/common/inc
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/dataMng/datacmd/inc
|
||||
ifeq ($(CFG_TRANSDATA_TYPE) ,AT)
|
||||
C_FLAGS += -DCFG_TRANSDATA_AT
|
||||
else
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/dataMng/datahttp/inc
|
||||
endif
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/debugMng/inc
|
||||
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/paramMng/inc
|
||||
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/storeMng/inc
|
||||
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/systemMng/inc
|
||||
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/qrcodeMng/inc
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/signatureMng/inc
|
||||
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/devMng/inc
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/nfcMng/inc
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/updataMng/inc
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/utils/inc
|
||||
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/4gMng/common/inc
|
||||
ifeq ($(CFG_MODULE_TYPE) ,EG91)
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/4gMng/EG91/inc
|
||||
ifneq ($(CFG_TRANSDATA_TYPE) ,AT)
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/4gMng/http/inc
|
||||
endif
|
||||
C_FLAGS += -DCFG_MODULE_EG91
|
||||
endif
|
||||
|
||||
ifeq ($(CFG_LIVE_ENBLE) ,y)
|
||||
C_FLAGS += -DCFG_LIVE_ENBLE
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/liveMng/inc
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/liveMng/inc/exports
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/component/liveMng/inc/imports
|
||||
endif
|
||||
|
||||
ifeq ($(CFG_CASE_TYPE) ,T100)
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/app/t100/inc
|
||||
endif
|
||||
|
||||
ifeq ($(CFG_DUAL_PROCESS_EN) ,y)
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/../../../../project/release/include
|
||||
INCLUDE_PATH+= -I$(SF_CS_DIR)/../cardv/inc/mid
|
||||
endif
|
||||
|
||||
ifeq ($(CFG_COMM_MCU_TYPE) ,IIC)
|
||||
C_FLAGS += -DCFG_COMM_MCU_IIC
|
||||
else
|
||||
C_FLAGS += -DCFG_COMM_MCU_UART
|
||||
endif
|
||||
|
||||
ifeq ($(CFG_OTHER_SIM) ,y)
|
||||
C_FLAGS += -DCFG_SUPPORT_OTHER_SIM
|
||||
endif
|
||||
|
||||
ifeq ($(CFG_GPS) ,y)
|
||||
C_FLAGS += -DCFG_SUPPORT_GPS
|
||||
endif
|
75
code/application/source/sf_app/build/modbuild.mk
Executable file
75
code/application/source/sf_app/build/modbuild.mk
Executable file
|
@ -0,0 +1,75 @@
|
|||
|
||||
include $(SF_CS_DIR)/build/inc.mk
|
||||
include $(PROJECT_DIR)/configs/current.configs
|
||||
-include $(PROJECT_DIR)/release/$(PRODUCT)/$(CHIP)/$(BOARD)/$(TOOLCHAIN)/toolchain.mk
|
||||
|
||||
|
||||
MODULE_NAME ?=$(CUR_DIR_NAME)
|
||||
|
||||
CFLAGS := -Wall -O3
|
||||
#-std=c99
|
||||
COMPILEDEP = $(CC) -MM "$<" $(INCLUDE_PATH)
|
||||
|
||||
OBJ_DIR := $(SF_CS_DIR)/output/obj/$(MODULE_NAME)
|
||||
|
||||
LIB :=$(SF_CS_DIR)/output/lib/static/lib$(MODULE_NAME).a
|
||||
SOLIB := $(SF_CS_DIR)/output/lib/dynamic/lib$(MODULE_NAME).so
|
||||
|
||||
|
||||
COMPILE = $(CC) $(C_FLAGS) -c "$<" -o "$@" $(INCLUDE_PATH)
|
||||
SRCS := $(shell find $(SRC_DIR) -name '*.c')
|
||||
SRCS := $(sort $(SRCS))
|
||||
|
||||
ifneq ($(CFG_DUAL_PROCESS_EN),y)
|
||||
SRCS_OMIT := $(shell find $(SRC_DIR) -name 'main.c')
|
||||
SRCS := $(filter-out $(SRCS_OMIT),$(SRCS))
|
||||
endif
|
||||
|
||||
OBJS := $(SRCS:$(SRC_DIR)%.c=$(OBJ_DIR)%.o)
|
||||
OBJS := $(sort $(OBJS))
|
||||
SRC_DEPS := $(OBJS:%.o=%.d)
|
||||
|
||||
|
||||
.PHONY: clean $(LIB) all install
|
||||
all : prepare $(SRC_DEPS) $(OBJS) $(LIB) install
|
||||
|
||||
|
||||
prepare:
|
||||
@echo "";echo ""
|
||||
@echo -e "\033[31;32m *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \033[0m"
|
||||
@echo -e "\033[31;32m [COMPILING] `basename $(MODULE_NAME)` ... ... \033[0m"
|
||||
@echo ""
|
||||
@mkdir -p $(OBJ_DIR)
|
||||
$(SRC_DEPS) : $(OBJ_DIR)/%.d : $(SRC_DIR)/%.c
|
||||
@echo "SRC_DEPS: " $(notdir $@)
|
||||
set -e;$(COMPILEDEP) > $@.$$$$; \
|
||||
sed 's,.*\.o[ :]*,$(@:%.d=%.o) $@ : ,g' < $@.$$$$ > $@; \
|
||||
rm -f $@.$$$$
|
||||
$(OBJS) : $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c
|
||||
@echo -e "\033[31;32m [$(CC)] \033[0m `basename $<` \033[0m"
|
||||
$(CC) $(CFLAGS) $(C_FLAGS) -fpic -c $< -o $@ $(INCLUDE_PATH)
|
||||
@echo -e "\033[31;32m [OK] \033[0m";echo ""
|
||||
|
||||
$(LIB) : $(OBJS)
|
||||
@echo -e "\033[31;32m [CREATING] \033[0m `basename $(LIB)` \033[0m"
|
||||
$(AR) -r $@ $(OBJS)
|
||||
@echo -e "\033[31;32m [OK] \033[0m";echo ""
|
||||
|
||||
$(SOLIB) : $(OBJS)
|
||||
@echo -e "\033[31;32m [CREATING] \033[0m `basename $(SOLIB)` \033[0m"
|
||||
@$(CC) -fPIC -shared -o $@ $(OBJS)
|
||||
@echo -e "\033[31;32m [OK] \033[0m";echo ""
|
||||
|
||||
clean:
|
||||
@echo " "
|
||||
@echo "--------------------------------------------"
|
||||
@echo -e "\033[31;31m [DELETING $(MODULE_NAME) files ......] \033[0m"
|
||||
@-rm -f $(LIB)
|
||||
@-rm -f $(SOLIB)
|
||||
@-rm -f $(SRC_DEPS)
|
||||
@if [ -n $(OBJ_DIR) ];then rm -rf $(OBJ_DIR);fi
|
||||
@echo "--------------------------------------------"
|
||||
@echo " "
|
||||
install:
|
||||
@#cp $(SOLIB) $(PROJECT_DIR)/release/$(PRODUCT)/$(CHIP)/common/$(TOOLCHAIN)/$(TOOLCHAIN_VERSION)/ex_libs/dynamic
|
||||
@#cp $(LIB) $(PROJECT_DIR)/release/$(PRODUCT)/$(CHIP)/common/$(TOOLCHAIN)/$(TOOLCHAIN_VERSION)/ex_libs/static
|
19
code/application/source/sf_app/code/include/HMACSHA.h
Executable file
19
code/application/source/sf_app/code/include/HMACSHA.h
Executable file
|
@ -0,0 +1,19 @@
|
|||
#ifndef HMACSHA_H
|
||||
#define HMACSHA_H
|
||||
#include "sf_type.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void amz_signature(UINT8 *signatureStr,UINT32 content_len, UINT8*objectName,UINT8*typestr,UINT8*password,UINT8*bucket,UINT8*region);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
41
code/application/source/sf_app/code/include/aos_util.h
Executable file
41
code/application/source/sf_app/code/include/aos_util.h
Executable file
|
@ -0,0 +1,41 @@
|
|||
#ifndef LIBAOS_UTIL_H
|
||||
#define LIBAOS_UTIL_H
|
||||
#include "sf_type.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define APR_SHA1_DIGESTSIZE 20
|
||||
|
||||
/**
|
||||
* base64 encode bytes. The output buffer must have at least
|
||||
* ((4 * (inLen + 1)) / 3) bytes in it. Returns the number of bytes written
|
||||
* to [out].
|
||||
*/
|
||||
int aos_base64_encode(const UINT8 *in, int inLen, UINT8 *out);
|
||||
|
||||
/**
|
||||
* Compute HMAC-SHA-1 with key [key] and message [message], storing result
|
||||
* in [hmac]
|
||||
*/
|
||||
void HMAC_SHA1(UINT8 hmac[20], const UINT8 *key, int key_len,
|
||||
const UINT8 *message, int message_len);
|
||||
|
||||
/*void oss_sign_headers(aos_pool_t *p, const aos_string_t *signstr, const aos_string_t *access_key_id,
|
||||
const aos_string_t *access_key_secret, aos_table_t *headers);*/
|
||||
|
||||
void oss_sign_headers();
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
644
code/application/source/sf_app/code/include/apr.h
Executable file
644
code/application/source/sf_app/code/include/apr.h
Executable file
|
@ -0,0 +1,644 @@
|
|||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef APR_H
|
||||
#define APR_H
|
||||
|
||||
/* GENERATED FILE WARNING! DO NOT EDIT apr.h
|
||||
*
|
||||
* You must modify apr.hw instead.
|
||||
*
|
||||
* And please, make an effort to stub apr.hnw and apr.h.in in the process.
|
||||
*
|
||||
* This is the Win32 specific version of apr.h. It is copied from
|
||||
* apr.hw by the apr.dsp and libapr.dsp projects.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr.h
|
||||
* @brief APR Platform Definitions
|
||||
* @remark This is a generated header generated from include/apr.h.in by
|
||||
* ./configure, or copied from include/apr.hw or include/apr.hnw
|
||||
* for Win32 or Netware by those build environments, respectively.
|
||||
*/
|
||||
|
||||
/* Make sure we have our platform identifier macro defined we ask for later.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(WIN32)
|
||||
#define WIN32 1
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(DOXYGEN)
|
||||
|
||||
/* Ignore most warnings (back down to /W3) for poorly constructed headers
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
/* disable or reduce the frequency of...
|
||||
* C4057: indirection to slightly different base types
|
||||
* C4075: slight indirection changes (unsigned short* vs short[])
|
||||
* C4100: unreferenced formal parameter
|
||||
* C4127: conditional expression is constant
|
||||
* C4163: '_rotl64' : not available as an intrinsic function
|
||||
* C4201: nonstandard extension nameless struct/unions
|
||||
* C4244: int to char/short - precision loss
|
||||
* C4514: unreferenced inline function removed
|
||||
*/
|
||||
#pragma warning(disable: 4100 4127 4163 4201 4514; once: 4057 4075 4244)
|
||||
|
||||
/* Ignore Microsoft's interpretation of secure development
|
||||
* and the POSIX string handling API
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
/* Has windows.h already been included? If so, our preferences don't matter,
|
||||
* but we will still need the winsock things no matter what was included.
|
||||
* If not, include a restricted set of windows headers to our tastes.
|
||||
*/
|
||||
#ifndef _WINDOWS_
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT
|
||||
|
||||
/* Restrict the server to a subset of Windows XP header files by default
|
||||
*/
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
#ifndef NOUSER
|
||||
#define NOUSER
|
||||
#endif
|
||||
#ifndef NOMCX
|
||||
#define NOMCX
|
||||
#endif
|
||||
#ifndef NOIME
|
||||
#define NOIME
|
||||
#endif
|
||||
#include <windows.h>
|
||||
/*
|
||||
* Add a _very_few_ declarations missing from the restricted set of headers
|
||||
* (If this list becomes extensive, re-enable the required headers above!)
|
||||
* winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now
|
||||
*/
|
||||
#define SW_HIDE 0
|
||||
#ifndef _WIN32_WCE
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <mswsock.h>
|
||||
#else
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#endif /* !_WINDOWS_ */
|
||||
|
||||
/**
|
||||
* @defgroup APR Apache Portability Runtime library
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @defgroup apr_platform Platform Definitions
|
||||
* @{
|
||||
* @warning
|
||||
* <strong><em>The actual values of macros and typedefs on this page<br>
|
||||
* are platform specific and should NOT be relied upon!</em></strong>
|
||||
*/
|
||||
|
||||
#define APR_INLINE __inline
|
||||
#define APR_HAS_INLINE 1
|
||||
#if !defined(__GNUC__) && !defined(__attribute__)
|
||||
#define __attribute__(__x)
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define APR_HAVE_ARPA_INET_H 0
|
||||
#define APR_HAVE_CONIO_H 1
|
||||
#define APR_HAVE_CRYPT_H 0
|
||||
#define APR_HAVE_CTYPE_H 1
|
||||
#define APR_HAVE_DIRENT_H 0
|
||||
#define APR_HAVE_ERRNO_H 1
|
||||
#define APR_HAVE_FCNTL_H 1
|
||||
#define APR_HAVE_IO_H 1
|
||||
#define APR_HAVE_LIMITS_H 1
|
||||
#define APR_HAVE_NETDB_H 0
|
||||
#define APR_HAVE_NETINET_IN_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_UIO_H 0
|
||||
#define APR_HAVE_NETINET_TCP_H 0
|
||||
#define APR_HAVE_PTHREAD_H 0
|
||||
#define APR_HAVE_SEMAPHORE_H 0
|
||||
#define APR_HAVE_SIGNAL_H 1
|
||||
#define APR_HAVE_STDARG_H 1
|
||||
#define APR_HAVE_STDINT_H 0
|
||||
#define APR_HAVE_STDIO_H 1
|
||||
#define APR_HAVE_STDLIB_H 1
|
||||
#define APR_HAVE_STRING_H 1
|
||||
#define APR_HAVE_STRINGS_H 0
|
||||
#define APR_HAVE_SYS_IOCTL_H 0
|
||||
#define APR_HAVE_SYS_SENDFILE_H 0
|
||||
#define APR_HAVE_SYS_SIGNAL_H 0
|
||||
#define APR_HAVE_SYS_SOCKET_H 0
|
||||
#define APR_HAVE_SYS_SOCKIO_H 0
|
||||
#define APR_HAVE_SYS_SYSLIMITS_H 0
|
||||
#define APR_HAVE_SYS_TIME_H 0
|
||||
#define APR_HAVE_SYS_TYPES_H 1
|
||||
#define APR_HAVE_SYS_UIO_H 0
|
||||
#define APR_HAVE_SYS_UN_H 0
|
||||
#define APR_HAVE_SYS_WAIT_H 0
|
||||
#define APR_HAVE_TIME_H 1
|
||||
#define APR_HAVE_UNISTD_H 0
|
||||
#define APR_HAVE_STDDEF_H 1
|
||||
#define APR_HAVE_PROCESS_H 1
|
||||
#else
|
||||
#define APR_HAVE_ARPA_INET_H 0
|
||||
#define APR_HAVE_CONIO_H 0
|
||||
#define APR_HAVE_CRYPT_H 0
|
||||
#define APR_HAVE_CTYPE_H 0
|
||||
#define APR_HAVE_DIRENT_H 0
|
||||
#define APR_HAVE_ERRNO_H 0
|
||||
#define APR_HAVE_FCNTL_H 0
|
||||
#define APR_HAVE_IO_H 0
|
||||
#define APR_HAVE_LIMITS_H 0
|
||||
#define APR_HAVE_NETDB_H 0
|
||||
#define APR_HAVE_NETINET_IN_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_UIO_H 0
|
||||
#define APR_HAVE_NETINET_TCP_H 0
|
||||
#define APR_HAVE_PTHREAD_H 0
|
||||
#define APR_HAVE_SEMAPHORE_H 0
|
||||
#define APR_HAVE_SIGNAL_H 0
|
||||
#define APR_HAVE_STDARG_H 0
|
||||
#define APR_HAVE_STDINT_H 0
|
||||
#define APR_HAVE_STDIO_H 1
|
||||
#define APR_HAVE_STDLIB_H 1
|
||||
#define APR_HAVE_STRING_H 1
|
||||
#define APR_HAVE_STRINGS_H 0
|
||||
#define APR_HAVE_SYS_IOCTL_H 0
|
||||
#define APR_HAVE_SYS_SENDFILE_H 0
|
||||
#define APR_HAVE_SYS_SIGNAL_H 0
|
||||
#define APR_HAVE_SYS_SOCKET_H 0
|
||||
#define APR_HAVE_SYS_SOCKIO_H 0
|
||||
#define APR_HAVE_SYS_SYSLIMITS_H 0
|
||||
#define APR_HAVE_SYS_TIME_H 0
|
||||
#define APR_HAVE_SYS_TYPES_H 0
|
||||
#define APR_HAVE_SYS_UIO_H 0
|
||||
#define APR_HAVE_SYS_UN_H 0
|
||||
#define APR_HAVE_SYS_WAIT_H 0
|
||||
#define APR_HAVE_TIME_H 0
|
||||
#define APR_HAVE_UNISTD_H 0
|
||||
#define APR_HAVE_STDDEF_H 0
|
||||
#define APR_HAVE_PROCESS_H 0
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
||||
/* We don't include our conditional headers within the doxyblocks
|
||||
* or the extern "C" namespace
|
||||
*/
|
||||
|
||||
#if APR_HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
#if APR_HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
#if APR_HAVE_PROCESS_H
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup apr_platform
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define APR_HAVE_SHMEM_MMAP_TMP 0
|
||||
#define APR_HAVE_SHMEM_MMAP_SHM 0
|
||||
#define APR_HAVE_SHMEM_MMAP_ZERO 0
|
||||
#define APR_HAVE_SHMEM_SHMGET_ANON 0
|
||||
#define APR_HAVE_SHMEM_SHMGET 0
|
||||
#define APR_HAVE_SHMEM_MMAP_ANON 0
|
||||
#define APR_HAVE_SHMEM_BEOS 0
|
||||
|
||||
#define APR_USE_SHMEM_MMAP_TMP 0
|
||||
#define APR_USE_SHMEM_MMAP_SHM 0
|
||||
#define APR_USE_SHMEM_MMAP_ZERO 0
|
||||
#define APR_USE_SHMEM_SHMGET_ANON 0
|
||||
#define APR_USE_SHMEM_SHMGET 0
|
||||
#define APR_USE_SHMEM_MMAP_ANON 0
|
||||
#define APR_USE_SHMEM_BEOS 0
|
||||
|
||||
#define APR_USE_FLOCK_SERIALIZE 0
|
||||
#define APR_USE_POSIXSEM_SERIALIZE 0
|
||||
#define APR_USE_SYSVSEM_SERIALIZE 0
|
||||
#define APR_USE_FCNTL_SERIALIZE 0
|
||||
#define APR_USE_PROC_PTHREAD_SERIALIZE 0
|
||||
#define APR_USE_PTHREAD_SERIALIZE 0
|
||||
|
||||
#define APR_HAS_FLOCK_SERIALIZE 0
|
||||
#define APR_HAS_SYSVSEM_SERIALIZE 0
|
||||
#define APR_HAS_POSIXSEM_SERIALIZE 0
|
||||
#define APR_HAS_FCNTL_SERIALIZE 0
|
||||
#define APR_HAS_PROC_PTHREAD_SERIALIZE 0
|
||||
|
||||
#define APR_PROCESS_LOCK_IS_GLOBAL 0
|
||||
|
||||
#define APR_HAVE_CORKABLE_TCP 0
|
||||
#define APR_HAVE_GETRLIMIT 0
|
||||
#define APR_HAVE_ICONV 0
|
||||
#define APR_HAVE_IN_ADDR 1
|
||||
#define APR_HAVE_INET_ADDR 1
|
||||
#define APR_HAVE_INET_NETWORK 0
|
||||
#define APR_HAVE_IPV6 0
|
||||
#define APR_HAVE_MEMMOVE 1
|
||||
#define APR_HAVE_SETRLIMIT 0
|
||||
#define APR_HAVE_SIGACTION 0
|
||||
#define APR_HAVE_SIGSUSPEND 0
|
||||
#define APR_HAVE_SIGWAIT 0
|
||||
#define APR_HAVE_SA_STORAGE 0
|
||||
#define APR_HAVE_STRCASECMP 0
|
||||
#define APR_HAVE_STRDUP 1
|
||||
#define APR_HAVE_STRNCASECMP 0
|
||||
#define APR_HAVE_STRSTR 1
|
||||
#define APR_HAVE_MEMCHR 1
|
||||
#define APR_HAVE_STRUCT_RLIMIT 0
|
||||
#define APR_HAVE_UNION_SEMUN 0
|
||||
#define APR_HAVE_SCTP 0
|
||||
#define APR_HAVE_IOVEC 0
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define APR_HAVE_STRICMP 1
|
||||
#define APR_HAVE_STRNICMP 1
|
||||
#else
|
||||
#define APR_HAVE_STRICMP 0
|
||||
#define APR_HAVE_STRNICMP 0
|
||||
#endif
|
||||
|
||||
/* APR Feature Macros */
|
||||
#define APR_HAS_SHARED_MEMORY 1
|
||||
#define APR_HAS_THREADS 1
|
||||
#define APR_HAS_MMAP 1
|
||||
#define APR_HAS_FORK 0
|
||||
#define APR_HAS_RANDOM 1
|
||||
#define APR_HAS_OTHER_CHILD 1
|
||||
#define APR_HAS_DSO 1
|
||||
#define APR_HAS_SO_ACCEPTFILTER 0
|
||||
#define APR_HAS_UNICODE_FS 1
|
||||
#define APR_HAS_PROC_INVOKED 1
|
||||
#define APR_HAS_OS_UUID 1
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define APR_HAS_SENDFILE 1
|
||||
#define APR_HAS_USER 1
|
||||
#define APR_HAS_LARGE_FILES 1
|
||||
#define APR_HAS_XTHREAD_FILES 1
|
||||
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 1
|
||||
#else
|
||||
#define APR_HAS_SENDFILE 0
|
||||
#define APR_HAS_USER 0
|
||||
#define APR_HAS_LARGE_FILES 0
|
||||
#define APR_HAS_XTHREAD_FILES 0
|
||||
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 0
|
||||
#endif
|
||||
|
||||
/* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible
|
||||
* to poll on files/pipes.
|
||||
*/
|
||||
#define APR_FILES_AS_SOCKETS 0
|
||||
|
||||
/* This macro indicates whether or not EBCDIC is the native character set.
|
||||
*/
|
||||
#define APR_CHARSET_EBCDIC 0
|
||||
|
||||
/* If we have a TCP implementation that can be "corked", what flag
|
||||
* do we use?
|
||||
*/
|
||||
#define APR_TCP_NOPUSH_FLAG @apr_tcp_nopush_flag@
|
||||
|
||||
/* Is the TCP_NODELAY socket option inherited from listening sockets?
|
||||
*/
|
||||
#define APR_TCP_NODELAY_INHERITED 1
|
||||
|
||||
/* Is the O_NONBLOCK flag inherited from listening sockets?
|
||||
*/
|
||||
#define APR_O_NONBLOCK_INHERITED 1
|
||||
|
||||
/* Typedefs that APR needs. */
|
||||
|
||||
typedef unsigned char apr_byte_t;
|
||||
|
||||
typedef short apr_int16_t;
|
||||
typedef unsigned short apr_uint16_t;
|
||||
|
||||
typedef int apr_int32_t;
|
||||
typedef unsigned int apr_uint32_t;
|
||||
|
||||
typedef __int64 apr_int64_t;
|
||||
typedef unsigned __int64 apr_uint64_t;
|
||||
|
||||
typedef size_t apr_size_t;
|
||||
#if APR_HAVE_STDDEF_H
|
||||
typedef ptrdiff_t apr_ssize_t;
|
||||
#else
|
||||
typedef int apr_ssize_t;
|
||||
#endif
|
||||
#if APR_HAS_LARGE_FILES
|
||||
typedef __int64 apr_off_t;
|
||||
#else
|
||||
typedef int apr_off_t;
|
||||
#endif
|
||||
typedef int apr_socklen_t;
|
||||
typedef apr_uint64_t apr_ino_t;
|
||||
|
||||
#ifdef _WIN64
|
||||
#define APR_SIZEOF_VOIDP 8
|
||||
#else
|
||||
#define APR_SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
#if APR_SIZEOF_VOIDP == 8
|
||||
typedef apr_uint64_t apr_uintptr_t;
|
||||
#else
|
||||
typedef apr_uint32_t apr_uintptr_t;
|
||||
#endif
|
||||
|
||||
/* Are we big endian? */
|
||||
/* XXX: Fatal assumption on Alpha platforms */
|
||||
#define APR_IS_BIGENDIAN 0
|
||||
|
||||
/* Mechanisms to properly type numeric literals */
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define APR_INT64_C(val) (val##i64)
|
||||
#define APR_UINT64_C(val) (val##Ui64)
|
||||
#else
|
||||
#define APR_INT64_C(val) (val##LL)
|
||||
#define APR_UINT64_C(val) (val##ULL)
|
||||
#endif
|
||||
|
||||
#ifdef INT16_MIN
|
||||
#define APR_INT16_MIN INT16_MIN
|
||||
#else
|
||||
#define APR_INT16_MIN (-0x7fff - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT16_MAX
|
||||
#define APR_INT16_MAX INT16_MAX
|
||||
#else
|
||||
#define APR_INT16_MAX (0x7fff)
|
||||
#endif
|
||||
|
||||
#ifdef UINT16_MAX
|
||||
#define APR_UINT16_MAX UINT16_MAX
|
||||
#else
|
||||
#define APR_UINT16_MAX (0xffff)
|
||||
#endif
|
||||
|
||||
#ifdef INT32_MIN
|
||||
#define APR_INT32_MIN INT32_MIN
|
||||
#else
|
||||
#define APR_INT32_MIN (-0x7fffffff - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT32_MAX
|
||||
#define APR_INT32_MAX INT32_MAX
|
||||
#else
|
||||
#define APR_INT32_MAX 0x7fffffff
|
||||
#endif
|
||||
|
||||
#ifdef UINT32_MAX
|
||||
#define APR_UINT32_MAX UINT32_MAX
|
||||
#else
|
||||
#define APR_UINT32_MAX (0xffffffffU)
|
||||
#endif
|
||||
|
||||
#ifdef INT64_MIN
|
||||
#define APR_INT64_MIN INT64_MIN
|
||||
#else
|
||||
#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT64_MAX
|
||||
#define APR_INT64_MAX INT64_MAX
|
||||
#else
|
||||
#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff)
|
||||
#endif
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
#define APR_UINT64_MAX UINT64_MAX
|
||||
#else
|
||||
#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff)
|
||||
#endif
|
||||
|
||||
#define APR_SIZE_MAX (~((apr_size_t)0))
|
||||
|
||||
/* Definitions that APR programs need to work properly. */
|
||||
|
||||
/**
|
||||
* APR public API wrap for C++ compilers.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#define APR_BEGIN_DECLS extern "C" {
|
||||
#define APR_END_DECLS }
|
||||
#else
|
||||
#define APR_BEGIN_DECLS
|
||||
#define APR_END_DECLS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Thread callbacks from APR functions must be declared with APR_THREAD_FUNC,
|
||||
* so that they follow the platform's calling convention.
|
||||
* <PRE>
|
||||
*
|
||||
* void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data);
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_THREAD_FUNC __stdcall
|
||||
|
||||
|
||||
#if defined(DOXYGEN) || !defined(WIN32)
|
||||
|
||||
/**
|
||||
* The public APR functions are declared with APR_DECLARE(), so they may
|
||||
* use the most appropriate calling convention. Public APR functions with
|
||||
* variable arguments must use APR_DECLARE_NONSTD().
|
||||
*
|
||||
* @remark Both the declaration and implementations must use the same macro.
|
||||
*
|
||||
* <PRE>
|
||||
* APR_DECLARE(rettype) apr_func(args)
|
||||
* </PRE>
|
||||
* @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA
|
||||
* @remark Note that when APR compiles the library itself, it passes the
|
||||
* symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32)
|
||||
* to export public symbols from the dynamic library build.\n
|
||||
* The user must define the APR_DECLARE_STATIC when compiling to target
|
||||
* the static APR library on some platforms (e.g. Win32.) The public symbols
|
||||
* are neither exported nor imported when APR_DECLARE_STATIC is defined.\n
|
||||
* By default, compiling an application and including the APR public
|
||||
* headers, without defining APR_DECLARE_STATIC, will prepare the code to be
|
||||
* linked to the dynamic library.
|
||||
*/
|
||||
#define APR_DECLARE(type) type
|
||||
|
||||
/**
|
||||
* The public APR functions using variable arguments are declared with
|
||||
* APR_DECLARE_NONSTD(), as they must follow the C language calling convention.
|
||||
* @see APR_DECLARE @see APR_DECLARE_DATA
|
||||
* @remark Both the declaration and implementations must use the same macro.
|
||||
* <PRE>
|
||||
*
|
||||
* APR_DECLARE_NONSTD(rettype) apr_func(args, ...);
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_DECLARE_NONSTD(type) type
|
||||
|
||||
/**
|
||||
* The public APR variables are declared with AP_MODULE_DECLARE_DATA.
|
||||
* This assures the appropriate indirection is invoked at compile time.
|
||||
* @see APR_DECLARE @see APR_DECLARE_NONSTD
|
||||
* @remark Note that the declaration and implementations use different forms,
|
||||
* but both must include the macro.
|
||||
*
|
||||
* <PRE>
|
||||
*
|
||||
* extern APR_DECLARE_DATA type apr_variable;\n
|
||||
* APR_DECLARE_DATA type apr_variable = value;
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_DECLARE_DATA
|
||||
|
||||
#elif defined(APR_DECLARE_STATIC)
|
||||
#define APR_DECLARE(type) type __stdcall
|
||||
#define APR_DECLARE_NONSTD(type) type __cdecl
|
||||
#define APR_DECLARE_DATA
|
||||
#elif defined(APR_DECLARE_EXPORT)
|
||||
#define APR_DECLARE(type) __declspec(dllexport) type __stdcall
|
||||
#define APR_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
|
||||
#define APR_DECLARE_DATA __declspec(dllexport)
|
||||
#else
|
||||
#define APR_DECLARE(type) __declspec(dllimport) type __stdcall
|
||||
#define APR_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
|
||||
#define APR_DECLARE_DATA __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
#define APR_SSIZE_T_FMT "I64d"
|
||||
#define APR_SIZE_T_FMT "I64u"
|
||||
#else
|
||||
#define APR_SSIZE_T_FMT "d"
|
||||
#define APR_SIZE_T_FMT "u"
|
||||
#endif
|
||||
|
||||
#if APR_HAS_LARGE_FILES
|
||||
#define APR_OFF_T_FMT "I64d"
|
||||
#else
|
||||
#define APR_OFF_T_FMT "d"
|
||||
#endif
|
||||
|
||||
#define APR_PID_T_FMT "d"
|
||||
|
||||
#define APR_INT64_T_FMT "I64d"
|
||||
#define APR_UINT64_T_FMT "I64u"
|
||||
#define APR_UINT64_T_HEX_FMT "I64x"
|
||||
|
||||
/* No difference between PROC and GLOBAL mutex */
|
||||
#define APR_PROC_MUTEX_IS_GLOBAL 1
|
||||
|
||||
/* Local machine definition for console and log output. */
|
||||
#define APR_EOL_STR "\r\n"
|
||||
|
||||
typedef int apr_wait_t;
|
||||
|
||||
#if APR_HAS_UNICODE_FS
|
||||
/* An arbitrary size that is digestable. True max is a bit less than 32000 */
|
||||
#define APR_PATH_MAX 8192
|
||||
#else /* !APR_HAS_UNICODE_FS */
|
||||
#define APR_PATH_MAX MAX_PATH
|
||||
#endif
|
||||
|
||||
#define APR_DSOPATH "PATH"
|
||||
|
||||
/** @} */
|
||||
|
||||
/* Definitions that only Win32 programs need to compile properly. */
|
||||
|
||||
/* XXX These simply don't belong here, perhaps in apr_portable.h
|
||||
* based on some APR_HAVE_PID/GID/UID?
|
||||
*/
|
||||
#ifndef __GNUC__
|
||||
typedef int pid_t;
|
||||
#endif
|
||||
typedef int uid_t;
|
||||
typedef int gid_t;
|
||||
|
||||
/* Win32 .h ommissions we really need */
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
|
||||
#if APR_HAVE_IPV6
|
||||
|
||||
/* Appears in later flavors, not the originals. */
|
||||
#ifndef in_addr6
|
||||
#define in6_addr in_addr6
|
||||
#endif
|
||||
|
||||
#ifndef WS2TCPIP_INLINE
|
||||
#define IN6_IS_ADDR_V4MAPPED(a) \
|
||||
( (*(const apr_uint64_t *)(const void *)(&(a)->s6_addr[0]) == 0) \
|
||||
&& (*(const apr_uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
|
||||
#endif
|
||||
|
||||
#endif /* APR_HAS_IPV6 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Done with badly written headers
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma warning(pop)
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#endif /* APR_H */
|
1316
code/application/source/sf_app/code/include/apr_errno.h
Executable file
1316
code/application/source/sf_app/code/include/apr_errno.h
Executable file
File diff suppressed because it is too large
Load Diff
243
code/application/source/sf_app/code/include/apr_general.h
Executable file
243
code/application/source/sf_app/code/include/apr_general.h
Executable file
|
@ -0,0 +1,243 @@
|
|||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_GENERAL_H
|
||||
#define APR_GENERAL_H
|
||||
|
||||
/**
|
||||
* @file apr_general.h
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @brief APR Miscellaneous library routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#if APR_HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_general Miscellaneous library routines
|
||||
* @ingroup APR
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** FALSE */
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
/** TRUE */
|
||||
#ifndef TRUE
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
/** a space */
|
||||
#define APR_ASCII_BLANK '\040'
|
||||
/** a carrige return */
|
||||
#define APR_ASCII_CR '\015'
|
||||
/** a line feed */
|
||||
#define APR_ASCII_LF '\012'
|
||||
/** a tab */
|
||||
#define APR_ASCII_TAB '\011'
|
||||
|
||||
/** signal numbers typedef */
|
||||
typedef int apr_signum_t;
|
||||
|
||||
/**
|
||||
* Finding offsets of elements within structures.
|
||||
* Taken from the X code... they've sweated portability of this stuff
|
||||
* so we don't have to. Sigh...
|
||||
* @param p_type pointer type name
|
||||
* @param field data field within the structure pointed to
|
||||
* @return offset
|
||||
*/
|
||||
|
||||
#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) || defined(__FreeBSD__)))
|
||||
#ifdef __STDC__
|
||||
#define APR_OFFSET(p_type,field) _Offsetof(p_type,field)
|
||||
#else
|
||||
#ifdef CRAY2
|
||||
#define APR_OFFSET(p_type,field) \
|
||||
(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
|
||||
|
||||
#else /* !CRAY2 */
|
||||
|
||||
#define APR_OFFSET(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
|
||||
|
||||
#endif /* !CRAY2 */
|
||||
#endif /* __STDC__ */
|
||||
#else /* ! (CRAY || __arm) */
|
||||
|
||||
#define APR_OFFSET(p_type,field) \
|
||||
((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
|
||||
|
||||
#endif /* !CRAY */
|
||||
|
||||
/**
|
||||
* Finding offsets of elements within structures.
|
||||
* @param s_type structure type name
|
||||
* @param field data field within the structure
|
||||
* @return offset
|
||||
*/
|
||||
#if defined(offsetof) && !defined(__cplusplus)
|
||||
#define APR_OFFSETOF(s_type,field) offsetof(s_type,field)
|
||||
#else
|
||||
#define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)
|
||||
#endif
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
/* A couple of prototypes for functions in case some platform doesn't
|
||||
* have it
|
||||
*/
|
||||
#if (!APR_HAVE_STRCASECMP) && (APR_HAVE_STRICMP)
|
||||
#define strcasecmp(s1, s2) stricmp(s1, s2)
|
||||
#elif (!APR_HAVE_STRCASECMP)
|
||||
int strcasecmp(const char *a, const char *b);
|
||||
#endif
|
||||
|
||||
#if (!APR_HAVE_STRNCASECMP) && (APR_HAVE_STRNICMP)
|
||||
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
|
||||
#elif (!APR_HAVE_STRNCASECMP)
|
||||
//int strncasecmp(const char *a, const char *b, size_t n);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Alignment macros
|
||||
*/
|
||||
|
||||
/* APR_ALIGN() is only to be used to align on a power of 2 boundary */
|
||||
#define APR_ALIGN(size, boundary) \
|
||||
(((size) + ((boundary) - 1)) & ~((boundary) - 1))
|
||||
|
||||
/** Default alignment */
|
||||
#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
|
||||
|
||||
|
||||
/**
|
||||
* String and memory functions
|
||||
*/
|
||||
|
||||
/* APR_STRINGIFY is defined here, and also in apr_release.h, so wrap it */
|
||||
#ifndef APR_STRINGIFY
|
||||
/** Properly quote a value as a string in the C preprocessor */
|
||||
#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
|
||||
/** Helper macro for APR_STRINGIFY */
|
||||
#define APR_STRINGIFY_HELPER(n) #n
|
||||
#endif
|
||||
|
||||
#if (!APR_HAVE_MEMMOVE)
|
||||
//#define memmove(a,b,c) bcopy(b,a,c)
|
||||
#endif
|
||||
|
||||
#if (!APR_HAVE_MEMCHR)
|
||||
//void *memchr(const void *s, int c, size_t n);
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_library Library initialization and termination
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Setup any APR internal data structures. This MUST be the first function
|
||||
* called for any APR library. It is safe to call apr_initialize several
|
||||
* times as long as apr_terminate is called the same number of times.
|
||||
* @remark See apr_app_initialize if this is an application, rather than
|
||||
* a library consumer of apr.
|
||||
*/
|
||||
//APR_DECLARE(apr_status_t) apr_initialize(void);
|
||||
|
||||
/**
|
||||
* Set up an application with normalized argc, argv (and optionally env) in
|
||||
* order to deal with platform-specific oddities, such as Win32 services,
|
||||
* code pages and signals. This must be the first function called for any
|
||||
* APR program.
|
||||
* @param argc Pointer to the argc that may be corrected
|
||||
* @param argv Pointer to the argv that may be corrected
|
||||
* @param env Pointer to the env that may be corrected, may be NULL
|
||||
* @remark See apr_initialize if this is a library consumer of apr.
|
||||
* Otherwise, this call is identical to apr_initialize, and must be closed
|
||||
* with a call to apr_terminate at the end of program execution.
|
||||
*/
|
||||
/*APR_DECLARE(apr_status_t) apr_app_initialize(int *argc,
|
||||
char const * const * *argv,
|
||||
char const * const * *env);
|
||||
*/
|
||||
/**
|
||||
* Tear down any APR internal data structures which aren't torn down
|
||||
* automatically. apr_terminate must be called once for every call to
|
||||
* apr_initialize() or apr_app_initialize().
|
||||
* @remark An APR program must call this function at termination once it
|
||||
* has stopped using APR services. The APR developers suggest using
|
||||
* atexit to ensure this is called. When using APR from a language
|
||||
* other than C that has problems with the calling convention, use
|
||||
* apr_terminate2() instead.
|
||||
*/
|
||||
//APR_DECLARE_NONSTD(void) apr_terminate(void);
|
||||
|
||||
/**
|
||||
* Tear down any APR internal data structures which aren't torn down
|
||||
* automatically, same as apr_terminate
|
||||
* @remark An APR program must call either the apr_terminate or apr_terminate2
|
||||
* function once it it has finished using APR services. The APR
|
||||
* developers suggest using atexit(apr_terminate) to ensure this is done.
|
||||
* apr_terminate2 exists to allow non-c language apps to tear down apr,
|
||||
* while apr_terminate is recommended from c language applications.
|
||||
*/
|
||||
//APR_DECLARE(void) apr_terminate2(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_random Random Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if APR_HAS_RANDOM || defined(DOXYGEN)
|
||||
|
||||
/* TODO: I'm not sure this is the best place to put this prototype...*/
|
||||
/**
|
||||
* Generate random bytes.
|
||||
* @param buf Buffer to fill with random bytes
|
||||
* @param length Length of buffer in bytes
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf,
|
||||
apr_size_t length);
|
||||
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_GENERAL_H */
|
243
code/application/source/sf_app/code/include/apr_lib.h
Executable file
243
code/application/source/sf_app/code/include/apr_lib.h
Executable file
|
@ -0,0 +1,243 @@
|
|||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_LIB_H
|
||||
#define APR_LIB_H
|
||||
|
||||
/**
|
||||
* @file apr_lib.h
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @brief APR general purpose library routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#if APR_HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_lib General Purpose Library Routines
|
||||
* @ingroup APR
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A constant representing a 'large' string. */
|
||||
#define HUGE_STRING_LEN 8192
|
||||
|
||||
/*
|
||||
* Define the structures used by the APR general-purpose library.
|
||||
*/
|
||||
|
||||
/** @see apr_vformatter_buff_t */
|
||||
typedef struct apr_vformatter_buff_t apr_vformatter_buff_t;
|
||||
|
||||
/**
|
||||
* Structure used by the variable-formatter routines.
|
||||
*/
|
||||
struct apr_vformatter_buff_t {
|
||||
/** The current position */
|
||||
char *curpos;
|
||||
/** The end position of the format string */
|
||||
char *endpos;
|
||||
};
|
||||
|
||||
/**
|
||||
* return the final element of the pathname
|
||||
* @param pathname The path to get the final element of
|
||||
* @return the final element of the path
|
||||
* @remark
|
||||
* <PRE>
|
||||
* For example:
|
||||
* "/foo/bar/gum" -> "gum"
|
||||
* "/foo/bar/gum/" -> ""
|
||||
* "gum" -> "gum"
|
||||
* "bs\\path\\stuff" -> "stuff"
|
||||
* </PRE>
|
||||
*/
|
||||
//APR_DECLARE(const char *) apr_filepath_name_get(const char *pathname);
|
||||
|
||||
/**
|
||||
* apr_killpg
|
||||
* Small utility macros to make things easier to read. Not usually a
|
||||
* goal, to be sure..
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#define apr_killpg(x, y)
|
||||
#else /* WIN32 */
|
||||
#ifdef NO_KILLPG
|
||||
#define apr_killpg(x, y) (kill (-(x), (y)))
|
||||
#else /* NO_KILLPG */
|
||||
#define apr_killpg(x, y) (killpg ((x), (y)))
|
||||
#endif /* NO_KILLPG */
|
||||
#endif /* WIN32 */
|
||||
|
||||
/**
|
||||
* apr_vformatter() is a generic printf-style formatting routine
|
||||
* with some extensions.
|
||||
* @param flush_func The function to call when the buffer is full
|
||||
* @param c The buffer to write to
|
||||
* @param fmt The format string
|
||||
* @param ap The arguments to use to fill out the format string.
|
||||
*
|
||||
* @remark
|
||||
* <PRE>
|
||||
* The extensions are:
|
||||
*
|
||||
* - %%pA takes a struct in_addr *, and prints it as a.b.c.d
|
||||
* - %%pI takes an apr_sockaddr_t * and prints it as a.b.c.d:port or
|
||||
* \[ipv6-address\]:port
|
||||
* - %%pT takes an apr_os_thread_t * and prints it in decimal
|
||||
* ('0' is printed if !APR_HAS_THREADS)
|
||||
* - %%pt takes an apr_os_thread_t * and prints it in hexadecimal
|
||||
* ('0' is printed if !APR_HAS_THREADS)
|
||||
* - %%pm takes an apr_status_t * and prints the appropriate error
|
||||
* string (from apr_strerror) corresponding to that error code.
|
||||
* - %%pp takes a void * and outputs it in hex
|
||||
* - %%pB takes a apr_uint32_t * as bytes and outputs it's apr_strfsize
|
||||
* - %%pF same as above, but takes a apr_off_t *
|
||||
* - %%pS same as above, but takes a apr_size_t *
|
||||
*
|
||||
* %%pA, %%pI, %%pT, %%pp are available from APR 1.0.0 onwards (and in 0.9.x).
|
||||
* %%pt is only available from APR 1.2.0 onwards.
|
||||
* %%pm, %%pB, %%pF and %%pS are only available from APR 1.3.0 onwards.
|
||||
*
|
||||
* The %%p hacks are to force gcc's printf warning code to skip
|
||||
* over a pointer argument without complaining. This does
|
||||
* mean that the ANSI-style %%p (output a void * in hex format) won't
|
||||
* work as expected at all, but that seems to be a fair trade-off
|
||||
* for the increased robustness of having printf-warnings work.
|
||||
*
|
||||
* Additionally, apr_vformatter allows for arbitrary output methods
|
||||
* using the apr_vformatter_buff and flush_func.
|
||||
*
|
||||
* The apr_vformatter_buff has two elements curpos and endpos.
|
||||
* curpos is where apr_vformatter will write the next byte of output.
|
||||
* It proceeds writing output to curpos, and updating curpos, until
|
||||
* either the end of output is reached, or curpos == endpos (i.e. the
|
||||
* buffer is full).
|
||||
*
|
||||
* If the end of output is reached, apr_vformatter returns the
|
||||
* number of bytes written.
|
||||
*
|
||||
* When the buffer is full, the flush_func is called. The flush_func
|
||||
* can return -1 to indicate that no further output should be attempted,
|
||||
* and apr_vformatter will return immediately with -1. Otherwise
|
||||
* the flush_func should flush the buffer in whatever manner is
|
||||
* appropriate, re apr_pool_t nitialize curpos and endpos, and return 0.
|
||||
*
|
||||
* Note that flush_func is only invoked as a result of attempting to
|
||||
* write another byte at curpos when curpos >= endpos. So for
|
||||
* example, it's possible when the output exactly matches the buffer
|
||||
* space available that curpos == endpos will be true when
|
||||
* apr_vformatter returns.
|
||||
*
|
||||
* apr_vformatter does not call out to any other code, it is entirely
|
||||
* self-contained. This allows the callers to do things which are
|
||||
* otherwise "unsafe". For example, apr_psprintf uses the "scratch"
|
||||
* space at the unallocated end of a block, and doesn't actually
|
||||
* complete the allocation until apr_vformatter returns. apr_psprintf
|
||||
* would be completely broken if apr_vformatter were to call anything
|
||||
* that used this same pool. Similarly http_bprintf() uses the "scratch"
|
||||
* space at the end of its output buffer, and doesn't actually note
|
||||
* that the space is in use until it either has to flush the buffer
|
||||
* or until apr_vformatter returns.
|
||||
* </PRE>
|
||||
|
||||
APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *b),
|
||||
apr_vformatter_buff_t *c, const char *fmt,
|
||||
va_list ap);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Display a prompt and read in the password from stdin.
|
||||
* @param prompt The prompt to display
|
||||
* @param pwbuf Buffer to store the password
|
||||
* @param bufsize The length of the password buffer.
|
||||
* @remark If the password entered must be truncated to fit in
|
||||
* the provided buffer, APR_ENAMETOOLONG will be returned.
|
||||
* Note that the bufsize paramater is passed by reference for no
|
||||
* reason; its value will never be modified by the apr_password_get()
|
||||
* function.
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_password_get(const char *prompt, char *pwbuf,
|
||||
apr_size_t *bufsize);
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_ctype ctype functions
|
||||
* These macros allow correct support of 8-bit characters on systems which
|
||||
* support 8-bit characters. Pretty dumb how the cast is required, but
|
||||
* that's legacy libc for ya. These new macros do not support EOF like
|
||||
* the standard macros do. Tough.
|
||||
* @{
|
||||
*/
|
||||
/** @see isalnum */
|
||||
#define apr_isalnum(c) (isalnum(((unsigned char)(c))))
|
||||
/** @see isalpha */
|
||||
#define apr_isalpha(c) (isalpha(((unsigned char)(c))))
|
||||
/** @see iscntrl */
|
||||
#define apr_iscntrl(c) (iscntrl(((unsigned char)(c))))
|
||||
/** @see isdigit */
|
||||
#define apr_isdigit(c) (isdigit(((unsigned char)(c))))
|
||||
/** @see isgraph */
|
||||
#define apr_isgraph(c) (isgraph(((unsigned char)(c))))
|
||||
/** @see islower*/
|
||||
#define apr_islower(c) (islower(((unsigned char)(c))))
|
||||
/** @see isascii */
|
||||
#ifdef isascii
|
||||
#define apr_isascii(c) (isascii(((unsigned char)(c))))
|
||||
#else
|
||||
#define apr_isascii(c) (((c) & ~0x7f)==0)
|
||||
#endif
|
||||
/** @see isprint */
|
||||
#define apr_isprint(c) (isprint(((unsigned char)(c))))
|
||||
/** @see ispunct */
|
||||
#define apr_ispunct(c) (ispunct(((unsigned char)(c))))
|
||||
/** @see isspace */
|
||||
#define apr_isspace(c) (isspace(((unsigned char)(c))))
|
||||
/** @see isupper */
|
||||
#define apr_isupper(c) (isupper(((unsigned char)(c))))
|
||||
/** @see isxdigit */
|
||||
#define apr_isxdigit(c) (isxdigit(((unsigned char)(c))))
|
||||
/** @see tolower */
|
||||
#define apr_tolower(c) (tolower(((unsigned char)(c))))
|
||||
/** @see toupper */
|
||||
#define apr_toupper(c) (toupper(((unsigned char)(c))))
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_LIB_H */
|
817
code/application/source/sf_app/code/include/apr_pools.h
Executable file
817
code/application/source/sf_app/code/include/apr_pools.h
Executable file
|
@ -0,0 +1,817 @@
|
|||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_POOLS_H
|
||||
#define APR_POOLS_H
|
||||
|
||||
/**
|
||||
* @file apr_pools.h
|
||||
* @brief APR memory allocation
|
||||
*
|
||||
* Resource allocation routines...
|
||||
*
|
||||
* designed so that we don't have to keep track of EVERYTHING so that
|
||||
* it can be explicitly freed later (a fundamentally unsound strategy ---
|
||||
* particularly in the presence of die()).
|
||||
*
|
||||
* Instead, we maintain pools, and allocate items (both memory and I/O
|
||||
* handlers) from the pools --- currently there are two, one for
|
||||
* per-transaction info, and one for config info. When a transaction is
|
||||
* over, we can delete everything in the per-transaction apr_pool_t without
|
||||
* fear, and without thinking too hard about it either.
|
||||
*
|
||||
* Note that most operations on pools are not thread-safe: a single pool
|
||||
* should only be accessed by a single thread at any given time. The one
|
||||
* exception to this rule is creating a subpool of a given pool: one or more
|
||||
* threads can safely create subpools at the same time that another thread
|
||||
* accesses the parent pool.
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_general.h" /* for APR_STRINGIFY */
|
||||
#define APR_WANT_MEMFUNC /**< for no good reason? */
|
||||
#include "apr_want.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_pools Memory Pool Functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** The fundamental pool type */
|
||||
typedef struct apr_pool_t apr_pool_t;
|
||||
|
||||
|
||||
/**
|
||||
* Declaration helper macro to construct apr_foo_pool_get()s.
|
||||
*
|
||||
* This standardized macro is used by opaque (APR) data types to return
|
||||
* the apr_pool_t that is associated with the data type.
|
||||
*
|
||||
* APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the
|
||||
* accessor function. A typical usage and result would be:
|
||||
* <pre>
|
||||
* APR_POOL_DECLARE_ACCESSOR(file);
|
||||
* becomes:
|
||||
* APR_DECLARE(apr_pool_t *) apr_file_pool_get(const apr_file_t *thefile);
|
||||
* </pre>
|
||||
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide
|
||||
* actual help for each specific occurrence of apr_foo_pool_get.
|
||||
* @remark the linkage is specified for APR. It would be possible to expand
|
||||
* the macros to support other linkages.
|
||||
*/
|
||||
#define APR_POOL_DECLARE_ACCESSOR(type) \
|
||||
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
|
||||
(const apr_##type##_t *the##type)
|
||||
|
||||
/**
|
||||
* Implementation helper macro to provide apr_foo_pool_get()s.
|
||||
*
|
||||
* In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to
|
||||
* actually define the function. It assumes the field is named "pool".
|
||||
*/
|
||||
#define APR_POOL_IMPLEMENT_ACCESSOR(type) \
|
||||
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
|
||||
(const apr_##type##_t *the##type) \
|
||||
{ return the##type->pool; }
|
||||
|
||||
|
||||
/**
|
||||
* Pool debug levels
|
||||
*
|
||||
* <pre>
|
||||
* | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
||||
* ---------------------------------
|
||||
* | | | | | | | | x | General debug code enabled (useful in
|
||||
* combination with --with-efence).
|
||||
*
|
||||
* | | | | | | | x | | Verbose output on stderr (report
|
||||
* CREATE, CLEAR, DESTROY).
|
||||
*
|
||||
* | | | | x | | | | | Verbose output on stderr (report
|
||||
* PALLOC, PCALLOC).
|
||||
*
|
||||
* | | | | | | x | | | Lifetime checking. On each use of a
|
||||
* pool, check its lifetime. If the pool
|
||||
* is out of scope, abort().
|
||||
* In combination with the verbose flag
|
||||
* above, it will output LIFE in such an
|
||||
* event prior to aborting.
|
||||
*
|
||||
* | | | | | x | | | | Pool owner checking. On each use of a
|
||||
* pool, check if the current thread is the
|
||||
* pool's owner. If not, abort(). In
|
||||
* combination with the verbose flag above,
|
||||
* it will output OWNER in such an event
|
||||
* prior to aborting. Use the debug
|
||||
* function apr_pool_owner_set() to switch
|
||||
* a pool's ownership.
|
||||
*
|
||||
* When no debug level was specified, assume general debug mode.
|
||||
* If level 0 was specified, debugging is switched off.
|
||||
* </pre>
|
||||
*/
|
||||
#if defined(APR_POOL_DEBUG)
|
||||
/* If APR_POOL_DEBUG is blank, we get 1; if it is a number, we get -1. */
|
||||
#if (APR_POOL_DEBUG - APR_POOL_DEBUG -1 == 1)
|
||||
#undef APR_POOL_DEBUG
|
||||
#define APR_POOL_DEBUG 1
|
||||
#endif
|
||||
#else
|
||||
#define APR_POOL_DEBUG 0
|
||||
#endif
|
||||
|
||||
/** the place in the code where the particular function was called */
|
||||
#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
|
||||
|
||||
|
||||
#if 0
|
||||
/** A function that is called when allocation fails. */
|
||||
typedef int (*apr_abortfunc_t)(int retcode);
|
||||
|
||||
/*
|
||||
* APR memory structure manipulators (pools, tables, and arrays).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
|
||||
/**
|
||||
* Setup all of the internal structures required to use pools
|
||||
* @remark Programs do NOT need to call this directly. APR will call this
|
||||
* automatically from apr_initialize.
|
||||
* @internal
|
||||
*/
|
||||
//APR_DECLARE(apr_status_t) apr_pool_initialize(void);
|
||||
|
||||
/**
|
||||
* Tear down all of the internal structures required to use pools
|
||||
* @remark Programs do NOT need to call this directly. APR will call this
|
||||
* automatically from apr_terminate.
|
||||
* @internal
|
||||
*/
|
||||
//APR_DECLARE(void) apr_pool_terminate(void);
|
||||
|
||||
|
||||
/*
|
||||
* Pool creation/destruction
|
||||
*/
|
||||
|
||||
//#include "apr_allocator.h"
|
||||
|
||||
/**
|
||||
* Create a new pool.
|
||||
* @param newpool The pool we have just created.
|
||||
* @param parent The parent pool. If this is NULL, the new pool is a root
|
||||
* pool. If it is non-NULL, the new pool will inherit all
|
||||
* of its parent pool's attributes, except the apr_pool_t will
|
||||
* be a sub-pool.
|
||||
* @param abort_fn A function to use if the pool cannot allocate more memory.
|
||||
* @param allocator The allocator to use with the new pool. If NULL the
|
||||
* allocator of the parent pool will be used.
|
||||
* @remark This function is thread-safe, in the sense that multiple threads
|
||||
* can safely create subpools of the same parent pool concurrently.
|
||||
* Similarly, a subpool can be created by one thread at the same
|
||||
* time that another thread accesses the parent pool.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
|
||||
apr_pool_t *parent,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Create a new pool.
|
||||
* @deprecated @see apr_pool_create_unmanaged_ex.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator);
|
||||
|
||||
/**
|
||||
* Create a new unmanaged pool.
|
||||
* @param newpool The pool we have just created.
|
||||
* @param abort_fn A function to use if the pool cannot allocate more memory.
|
||||
* @param allocator The allocator to use with the new pool. If NULL a
|
||||
* new allocator will be created with the new pool as owner.
|
||||
* @remark An unmanaged pool is a special pool without a parent; it will
|
||||
* NOT be destroyed upon apr_terminate. It must be explicitly
|
||||
* destroyed by calling apr_pool_destroy, to prevent memory leaks.
|
||||
* Use of this function is discouraged, think twice about whether
|
||||
* you really really need it.
|
||||
* @warning Any child cleanups registered against the new pool, or
|
||||
* against sub-pools thereof, will not be executed during an
|
||||
* invocation of apr_proc_create(), so resources created in an
|
||||
* "unmanaged" pool hierarchy will leak to child processes.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_create_ex.
|
||||
* @param newpool @see apr_pool_create.
|
||||
* @param parent @see apr_pool_create.
|
||||
* @param abort_fn @see apr_pool_create.
|
||||
* @param allocator @see apr_pool_create.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have your apr_pool_create_ex
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_create_ex in a wrapper, trust the macro
|
||||
* and don't call apr_pool_create_ex_debug directly.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool,
|
||||
apr_pool_t *parent,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator,
|
||||
const char *file_line)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create_ex(newpool, parent, abort_fn, allocator) \
|
||||
apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_create_core_ex.
|
||||
* @deprecated @see apr_pool_create_unmanaged_ex_debug.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator,
|
||||
const char *file_line);
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_create_unmanaged_ex.
|
||||
* @param newpool @see apr_pool_create_unmanaged.
|
||||
* @param abort_fn @see apr_pool_create_unmanaged.
|
||||
* @param allocator @see apr_pool_create_unmanaged.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have your apr_pool_create_unmanaged_ex
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_create_core_ex in a wrapper, trust the macro
|
||||
* and don't call apr_pool_create_core_ex_debug directly.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator,
|
||||
const char *file_line)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create_core_ex(newpool, abort_fn, allocator) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
|
||||
#define apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a new pool.
|
||||
* @param newpool The pool we have just created.
|
||||
* @param parent The parent pool. If this is NULL, the new pool is a root
|
||||
* pool. If it is non-NULL, the new pool will inherit all
|
||||
* of its parent pool's attributes, except the apr_pool_t will
|
||||
* be a sub-pool.
|
||||
* @remark This function is thread-safe, in the sense that multiple threads
|
||||
* can safely create subpools of the same parent pool concurrently.
|
||||
* Similarly, a subpool can be created by one thread at the same
|
||||
* time that another thread accesses the parent pool.
|
||||
*/
|
||||
#if defined(DOXYGEN)
|
||||
APR_DECLARE(apr_status_t) apr_pool_create(apr_pool_t **newpool,
|
||||
apr_pool_t *parent);
|
||||
#else
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create(newpool, parent) \
|
||||
apr_pool_create_ex_debug(newpool, parent, NULL, NULL, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#else
|
||||
#define apr_pool_create(newpool, parent) \
|
||||
apr_pool_create_ex(newpool, parent, NULL, NULL)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a new unmanaged pool.
|
||||
* @param newpool The pool we have just created.
|
||||
*/
|
||||
#if defined(DOXYGEN)
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_core(apr_pool_t **newpool);
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_unmanaged(apr_pool_t **newpool);
|
||||
#else
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create_core(newpool) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#define apr_pool_create_unmanaged(newpool) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#else
|
||||
#define apr_pool_create_core(newpool) \
|
||||
apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
|
||||
#define apr_pool_create_unmanaged(newpool) \
|
||||
apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Find the pool's allocator
|
||||
* @param pool The pool to get the allocator from.
|
||||
*/
|
||||
APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Clear all memory in the pool and run all the cleanups. This also destroys all
|
||||
* subpools.
|
||||
* @param p The pool to clear
|
||||
* @remark This does not actually free the memory, it just allows the pool
|
||||
* to re-use this memory for the next allocation.
|
||||
* @see apr_pool_destroy()
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_clear(apr_pool_t *p) __attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_clear.
|
||||
* @param p See: apr_pool_clear.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have your apr_pool_clear
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_clear in a wrapper, trust the macro
|
||||
* and don't call apr_pool_destroy_clear directly.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *p,
|
||||
const char *file_line)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_clear(p) \
|
||||
apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Destroy the pool. This takes similar action as apr_pool_clear() and then
|
||||
* frees all the memory.
|
||||
* @param p The pool to destroy
|
||||
* @remark This will actually free the memory
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p) __attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_destroy.
|
||||
* @param p See: apr_pool_destroy.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have your apr_pool_destroy
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_destroy in a wrapper, trust the macro
|
||||
* and don't call apr_pool_destroy_debug directly.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p,
|
||||
const char *file_line)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_destroy(p) \
|
||||
apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Memory allocation
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allocate a block of memory from a pool
|
||||
* @param p The pool to allocate from
|
||||
* @param size The amount of memory to allocate
|
||||
* @return The allocated memory
|
||||
*/
|
||||
APR_DECLARE(void *) apr_palloc(apr_pool_t *p, apr_size_t size)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
|
||||
__attribute__((alloc_size(2)))
|
||||
#endif
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Debug version of apr_palloc
|
||||
* @param p See: apr_palloc
|
||||
* @param size See: apr_palloc
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @return See: apr_palloc
|
||||
*/
|
||||
APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *p, apr_size_t size,
|
||||
const char *file_line)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
|
||||
__attribute__((alloc_size(2)))
|
||||
#endif
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_palloc(p, size) \
|
||||
apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocate a block of memory from a pool and set all of the memory to 0
|
||||
* @param p The pool to allocate from
|
||||
* @param size The amount of memory to allocate
|
||||
* @return The allocated memory
|
||||
*/
|
||||
#if defined(DOXYGEN)
|
||||
APR_DECLARE(void *) apr_pcalloc(apr_pool_t *p, apr_size_t size);
|
||||
#elif !APR_POOL_DEBUG
|
||||
#define apr_pcalloc(p, size) memset(apr_palloc(p, size), 0, size)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Debug version of apr_pcalloc
|
||||
* @param p See: apr_pcalloc
|
||||
* @param size See: apr_pcalloc
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @return See: apr_pcalloc
|
||||
*/
|
||||
APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size,
|
||||
const char *file_line)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pcalloc(p, size) \
|
||||
apr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Pool Properties
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the function to be called when an allocation failure occurs.
|
||||
* @remark If the program wants APR to exit on a memory allocation error,
|
||||
* then this function can be called to set the callback to use (for
|
||||
* performing cleanup and then exiting). If this function is not called,
|
||||
* then APR will return an error and expect the calling program to
|
||||
* deal with the error accordingly.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_abort_set(apr_abortfunc_t abortfunc,
|
||||
apr_pool_t *pool)
|
||||
__attribute__((nonnull(2)));
|
||||
|
||||
/**
|
||||
* Get the abort function associated with the specified pool.
|
||||
* @param pool The pool for retrieving the abort function.
|
||||
* @return The abort function for the given pool.
|
||||
*/
|
||||
APR_DECLARE(apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Get the parent pool of the specified pool.
|
||||
* @param pool The pool for retrieving the parent pool.
|
||||
* @return The parent of the given pool.
|
||||
*/
|
||||
APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Determine if pool a is an ancestor of pool b.
|
||||
* @param a The pool to search
|
||||
* @param b The pool to search for
|
||||
* @return True if a is an ancestor of b, NULL is considered an ancestor
|
||||
* of all pools.
|
||||
* @remark if compiled with APR_POOL_DEBUG, this function will also
|
||||
* return true if A is a pool which has been guaranteed by the caller
|
||||
* (using apr_pool_join) to have a lifetime at least as long as some
|
||||
* ancestor of pool B.
|
||||
*/
|
||||
APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b);
|
||||
|
||||
/**
|
||||
* Tag a pool (give it a name)
|
||||
* @param pool The pool to tag
|
||||
* @param tag The tag
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
|
||||
/*
|
||||
* User data management
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the data associated with the current pool
|
||||
* @param data The user data associated with the pool.
|
||||
* @param key The key to use for association
|
||||
* @param cleanup The cleanup program to use to cleanup the data (NULL if none)
|
||||
* @param pool The current pool
|
||||
* @warning The data to be attached to the pool should have a life span
|
||||
* at least as long as the pool it is being attached to.
|
||||
*
|
||||
* Users of APR must take EXTREME care when choosing a key to
|
||||
* use for their data. It is possible to accidentally overwrite
|
||||
* data by choosing a key that another part of the program is using.
|
||||
* Therefore it is advised that steps are taken to ensure that unique
|
||||
* keys are used for all of the userdata objects in a particular pool
|
||||
* (the same key in two different pools or a pool and one of its
|
||||
* subpools is okay) at all times. Careful namespace prefixing of
|
||||
* key names is a typical way to help ensure this uniqueness.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_userdata_set(const void *data,
|
||||
const char *key,
|
||||
apr_status_t (*cleanup)(void *),
|
||||
apr_pool_t *pool)
|
||||
__attribute__((nonnull(2,4)));
|
||||
|
||||
/**
|
||||
* Set the data associated with the current pool
|
||||
* @param data The user data associated with the pool.
|
||||
* @param key The key to use for association
|
||||
* @param cleanup The cleanup program to use to cleanup the data (NULL if none)
|
||||
* @param pool The current pool
|
||||
* @note same as apr_pool_userdata_set(), except that this version doesn't
|
||||
* make a copy of the key (this function is useful, for example, when
|
||||
* the key is a string literal)
|
||||
* @warning This should NOT be used if the key could change addresses by
|
||||
* any means between the apr_pool_userdata_setn() call and a
|
||||
* subsequent apr_pool_userdata_get() on that key, such as if a
|
||||
* static string is used as a userdata key in a DSO and the DSO could
|
||||
* be unloaded and reloaded between the _setn() and the _get(). You
|
||||
* MUST use apr_pool_userdata_set() in such cases.
|
||||
* @warning More generally, the key and the data to be attached to the
|
||||
* pool should have a life span at least as long as the pool itself.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_userdata_setn(
|
||||
const void *data, const char *key,
|
||||
apr_status_t (*cleanup)(void *),
|
||||
apr_pool_t *pool)
|
||||
__attribute__((nonnull(2,4)));
|
||||
|
||||
/**
|
||||
* Return the data associated with the current pool.
|
||||
* @param data The user data associated with the pool.
|
||||
* @param key The key for the data to retrieve
|
||||
* @param pool The current pool.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key,
|
||||
apr_pool_t *pool)
|
||||
__attribute__((nonnull(1,2,3)));
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup PoolCleanup Pool Cleanup Functions
|
||||
*
|
||||
* Cleanups are performed in the reverse order they were registered. That is:
|
||||
* Last In, First Out. A cleanup function can safely allocate memory from
|
||||
* the pool that is being cleaned up. It can also safely register additional
|
||||
* cleanups which will be run LIFO, directly after the current cleanup
|
||||
* terminates. Cleanups have to take caution in calling functions that
|
||||
* create subpools. Subpools, created during cleanup will NOT automatically
|
||||
* be cleaned up. In other words, cleanups are to clean up after themselves.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register a function to be called when a pool is cleared or destroyed
|
||||
* @param p The pool to register the cleanup with
|
||||
* @param data The data to pass to the cleanup function.
|
||||
* @param plain_cleanup The function to call when the pool is cleared
|
||||
* or destroyed
|
||||
* @param child_cleanup The function to call when a child process is about
|
||||
* to exec - this function is called in the child, obviously!
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_cleanup_register(
|
||||
apr_pool_t *p, const void *data,
|
||||
apr_status_t (*plain_cleanup)(void *),
|
||||
apr_status_t (*child_cleanup)(void *))
|
||||
__attribute__((nonnull(3,4)));
|
||||
|
||||
/**
|
||||
* Register a function to be called when a pool is cleared or destroyed.
|
||||
*
|
||||
* Unlike apr_pool_cleanup_register which registers a cleanup
|
||||
* that is called AFTER all subpools are destroyed, this function registers
|
||||
* a function that will be called before any of the subpools are destroyed.
|
||||
*
|
||||
* @param p The pool to register the cleanup with
|
||||
* @param data The data to pass to the cleanup function.
|
||||
* @param plain_cleanup The function to call when the pool is cleared
|
||||
* or destroyed
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_pre_cleanup_register(
|
||||
apr_pool_t *p, const void *data,
|
||||
apr_status_t (*plain_cleanup)(void *))
|
||||
__attribute__((nonnull(3)));
|
||||
|
||||
/**
|
||||
* Remove a previously registered cleanup function.
|
||||
*
|
||||
* The cleanup most recently registered with @a p having the same values of
|
||||
* @a data and @a cleanup will be removed.
|
||||
*
|
||||
* @param p The pool to remove the cleanup from
|
||||
* @param data The data of the registered cleanup
|
||||
* @param cleanup The function to remove from cleanup
|
||||
* @remarks For some strange reason only the plain_cleanup is handled by this
|
||||
* function
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,
|
||||
apr_status_t (*cleanup)(void *))
|
||||
__attribute__((nonnull(3)));
|
||||
|
||||
/**
|
||||
* Replace the child cleanup function of a previously registered cleanup.
|
||||
*
|
||||
* The cleanup most recently registered with @a p having the same values of
|
||||
* @a data and @a plain_cleanup will have the registered child cleanup
|
||||
* function replaced with @a child_cleanup.
|
||||
*
|
||||
* @param p The pool of the registered cleanup
|
||||
* @param data The data of the registered cleanup
|
||||
* @param plain_cleanup The plain cleanup function of the registered cleanup
|
||||
* @param child_cleanup The function to register as the child cleanup
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_child_cleanup_set(
|
||||
apr_pool_t *p, const void *data,
|
||||
apr_status_t (*plain_cleanup)(void *),
|
||||
apr_status_t (*child_cleanup)(void *))
|
||||
__attribute__((nonnull(3,4)));
|
||||
|
||||
/**
|
||||
* Run the specified cleanup function immediately and unregister it.
|
||||
*
|
||||
* The cleanup most recently registered with @a p having the same values of
|
||||
* @a data and @a cleanup will be removed and @a cleanup will be called
|
||||
* with @a data as the argument.
|
||||
*
|
||||
* @param p The pool to remove the cleanup from
|
||||
* @param data The data to remove from cleanup
|
||||
* @param cleanup The function to remove from cleanup
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_cleanup_run(apr_pool_t *p, void *data,
|
||||
apr_status_t (*cleanup)(void *))
|
||||
__attribute__((nonnull(3)));
|
||||
|
||||
/**
|
||||
* An empty cleanup function.
|
||||
*
|
||||
* Passed to apr_pool_cleanup_register() when no cleanup is required.
|
||||
*
|
||||
* @param data The data to cleanup, will not be used by this function.
|
||||
*/
|
||||
APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data);
|
||||
|
||||
/**
|
||||
* Run all registered child cleanups, in preparation for an exec()
|
||||
* call in a forked child -- close files, etc., but *don't* flush I/O
|
||||
* buffers, *don't* wait for subprocesses, and *don't* free any
|
||||
* memory.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_cleanup_for_exec(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup PoolDebug Pool Debugging functions.
|
||||
*
|
||||
* pools have nested lifetimes -- sub_pools are destroyed when the
|
||||
* parent pool is cleared. We allow certain liberties with operations
|
||||
* on things such as tables (and on other structures in a more general
|
||||
* sense) where we allow the caller to insert values into a table which
|
||||
* were not allocated from the table's pool. The table's data will
|
||||
* remain valid as long as all the pools from which its values are
|
||||
* allocated remain valid.
|
||||
*
|
||||
* For example, if B is a sub pool of A, and you build a table T in
|
||||
* pool B, then it's safe to insert data allocated in A or B into T
|
||||
* (because B lives at most as long as A does, and T is destroyed when
|
||||
* B is cleared/destroyed). On the other hand, if S is a table in
|
||||
* pool A, it is safe to insert data allocated in A into S, but it
|
||||
* is *not safe* to insert data allocated from B into S... because
|
||||
* B can be cleared/destroyed before A is (which would leave dangling
|
||||
* pointers in T's data structures).
|
||||
*
|
||||
* In general we say that it is safe to insert data into a table T
|
||||
* if the data is allocated in any ancestor of T's pool. This is the
|
||||
* basis on which the APR_POOL_DEBUG code works -- it tests these ancestor
|
||||
* relationships for all data inserted into tables. APR_POOL_DEBUG also
|
||||
* provides tools (apr_pool_find, and apr_pool_is_ancestor) for other
|
||||
* folks to implement similar restrictions for their own data
|
||||
* structures.
|
||||
*
|
||||
* However, sometimes this ancestor requirement is inconvenient --
|
||||
* sometimes it's necessary to create a sub pool where the sub pool is
|
||||
* guaranteed to have the same lifetime as the parent pool. This is a
|
||||
* guarantee implemented by the *caller*, not by the pool code. That
|
||||
* is, the caller guarantees they won't destroy the sub pool
|
||||
* individually prior to destroying the parent pool.
|
||||
*
|
||||
* In this case the caller must call apr_pool_join() to indicate this
|
||||
* guarantee to the APR_POOL_DEBUG code.
|
||||
*
|
||||
* These functions are only implemented when #APR_POOL_DEBUG is set.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#if APR_POOL_DEBUG || defined(DOXYGEN)
|
||||
/**
|
||||
* Guarantee that a subpool has the same lifetime as the parent.
|
||||
* @param p The parent pool
|
||||
* @param sub The subpool
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub)
|
||||
__attribute__((nonnull(2)));
|
||||
|
||||
/**
|
||||
* Find a pool from something allocated in it.
|
||||
* @param mem The thing allocated in the pool
|
||||
* @return The pool it is allocated in
|
||||
*/
|
||||
APR_DECLARE(apr_pool_t *) apr_pool_find(const void *mem);
|
||||
|
||||
/**
|
||||
* Report the number of bytes currently in the pool
|
||||
* @param p The pool to inspect
|
||||
* @param recurse Recurse/include the subpools' sizes
|
||||
* @return The number of bytes
|
||||
*/
|
||||
APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *p, int recurse)
|
||||
__attribute__((nonnull(1)));
|
||||
|
||||
/**
|
||||
* Lock a pool
|
||||
* @param pool The pool to lock
|
||||
* @param flag The flag
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_lock(apr_pool_t *pool, int flag);
|
||||
|
||||
/* @} */
|
||||
|
||||
#else /* APR_POOL_DEBUG or DOXYGEN */
|
||||
|
||||
#ifdef apr_pool_join
|
||||
#undef apr_pool_join
|
||||
#endif
|
||||
#define apr_pool_join(a,b)
|
||||
|
||||
#ifdef apr_pool_lock
|
||||
#undef apr_pool_lock
|
||||
#endif
|
||||
#define apr_pool_lock(pool, lock)
|
||||
|
||||
#endif /* APR_POOL_DEBUG or DOXYGEN */
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_POOLS_H */
|
122
code/application/source/sf_app/code/include/apr_sha1.h
Executable file
122
code/application/source/sf_app/code/include/apr_sha1.h
Executable file
|
@ -0,0 +1,122 @@
|
|||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* NIST Secure Hash Algorithm
|
||||
* heavily modified by Uwe Hollerbach uh@alumni.caltech edu
|
||||
* from Peter C. Gutmann's implementation as found in
|
||||
* Applied Cryptography by Bruce Schneier
|
||||
* This code is hereby placed in the public domain
|
||||
*/
|
||||
|
||||
#ifndef APR_SHA1_H
|
||||
#define APR_SHA1_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_general.h"
|
||||
#include "sf_type.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file apr_sha1.h
|
||||
* @brief APR-UTIL SHA1 library
|
||||
*/
|
||||
|
||||
/** size of the SHA1 DIGEST */
|
||||
#define APR_SHA1_DIGESTSIZE 20
|
||||
|
||||
/**
|
||||
* Define the Magic String prefix that identifies a password as being
|
||||
* hashed using our algorithm.
|
||||
*/
|
||||
#define APR_SHA1PW_ID "{SHA}"
|
||||
|
||||
/** length of the SHA Password */
|
||||
#define APR_SHA1PW_IDLEN 5
|
||||
|
||||
/** @see apr_sha1_ctx_t */
|
||||
typedef struct apr_sha1_ctx_t apr_sha1_ctx_t;
|
||||
|
||||
/**
|
||||
* SHA1 context structure
|
||||
*/
|
||||
struct apr_sha1_ctx_t {
|
||||
/** message digest */
|
||||
UINT32 digest[5];
|
||||
/** 64-bit bit counts */
|
||||
UINT32 count_lo, count_hi;
|
||||
/** SHA data buffer */
|
||||
UINT32 data[16];
|
||||
/** unprocessed amount in data */
|
||||
int local;
|
||||
};
|
||||
|
||||
/**
|
||||
* Provide a means to SHA1 crypt/encode a plaintext password in a way which
|
||||
* makes password file compatible with those commonly use in netscape web
|
||||
* and ldap installations.
|
||||
* @param clear The plaintext password
|
||||
* @param len The length of the plaintext password
|
||||
* @param out The encrypted/encoded password
|
||||
* @note SHA1 support is useful for migration purposes, but is less
|
||||
* secure than Apache's password format, since Apache's (MD5)
|
||||
* password format uses a random eight character salt to generate
|
||||
* one of many possible hashes for the same password. Netscape
|
||||
* uses plain SHA1 without a salt, so the same password
|
||||
* will always generate the same hash, making it easier
|
||||
* to break since the search space is smaller.
|
||||
*/
|
||||
APU_DECLARE(void) apr_sha1_base64(const char *clear, int len, char *out);
|
||||
|
||||
/**
|
||||
* Initialize the SHA digest
|
||||
* @param context The SHA context to initialize
|
||||
*/
|
||||
APU_DECLARE(void) apr_sha1_init(apr_sha1_ctx_t *context);
|
||||
|
||||
/**
|
||||
* Update the SHA digest
|
||||
* @param context The SHA1 context to update
|
||||
* @param input The buffer to add to the SHA digest
|
||||
* @param inputLen The length of the input buffer
|
||||
*/
|
||||
APU_DECLARE(void) apr_sha1_update(apr_sha1_ctx_t *context, const char *input,
|
||||
unsigned int inputLen);
|
||||
|
||||
/**
|
||||
* Update the SHA digest with binary data
|
||||
* @param context The SHA1 context to update
|
||||
* @param input The buffer to add to the SHA digest
|
||||
* @param inputLen The length of the input buffer
|
||||
*/
|
||||
APU_DECLARE(void) apr_sha1_update_binary(apr_sha1_ctx_t *context,
|
||||
const unsigned char *input,
|
||||
unsigned int inputLen);
|
||||
|
||||
/**
|
||||
* Finish computing the SHA digest
|
||||
* @param digest the output buffer in which to store the digest
|
||||
* @param context The context to finalize
|
||||
*/
|
||||
APU_DECLARE(void) apr_sha1_final(unsigned char digest[APR_SHA1_DIGESTSIZE],
|
||||
apr_sha1_ctx_t *context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_SHA1_H */
|
390
code/application/source/sf_app/code/include/apr_strings.h
Executable file
390
code/application/source/sf_app/code/include/apr_strings.h
Executable file
|
@ -0,0 +1,390 @@
|
|||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Portions of this file are covered by */
|
||||
/* -*- mode: c; c-file-style: "k&r" -*-
|
||||
|
||||
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
|
||||
Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef APR_STRINGS_H
|
||||
#define APR_STRINGS_H
|
||||
|
||||
/**
|
||||
* @file apr_strings.h
|
||||
* @brief APR Strings library
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_pools.h"
|
||||
#define APR_WANT_IOVEC
|
||||
#include "apr_want.h"
|
||||
|
||||
#if APR_HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_strings String routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Do a natural order comparison of two strings.
|
||||
* @param a The first string to compare
|
||||
* @param b The second string to compare
|
||||
* @return Either <0, 0, or >0. If the first string is less than the second
|
||||
* this returns <0, if they are equivalent it returns 0, and if the
|
||||
* first string is greater than second string it retuns >0.
|
||||
*/
|
||||
//APR_DECLARE(int) apr_strnatcmp(char const *a, char const *b);
|
||||
|
||||
/**
|
||||
* Do a natural order comparison of two strings ignoring the case of the
|
||||
* strings.
|
||||
* @param a The first string to compare
|
||||
* @param b The second string to compare
|
||||
* @return Either <0, 0, or >0. If the first string is less than the second
|
||||
* this returns <0, if they are equivalent it returns 0, and if the
|
||||
* first string is greater than second string it retuns >0.
|
||||
*/
|
||||
//APR_DECLARE(int) apr_strnatcasecmp(char const *a, char const *b);
|
||||
|
||||
/**
|
||||
* duplicate a string into memory allocated out of a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param s The string to duplicate
|
||||
* @return The new string or NULL if s == NULL
|
||||
*/
|
||||
//APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s);
|
||||
|
||||
/**
|
||||
* Create a null-terminated string by making a copy of a sequence
|
||||
* of characters and appending a null byte
|
||||
* @param p The pool to allocate out of
|
||||
* @param s The block of characters to duplicate
|
||||
* @param n The number of characters to duplicate
|
||||
* @return The new string or NULL if s == NULL
|
||||
* @remark This is a faster alternative to apr_pstrndup, for use
|
||||
* when you know that the string being duplicated really
|
||||
* has 'n' or more characters. If the string might contain
|
||||
* fewer characters, use apr_pstrndup.
|
||||
|
||||
APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
|
||||
__attribute__((alloc_size(3)))
|
||||
#endif
|
||||
;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Duplicate at most n characters of a string into memory allocated
|
||||
* out of a pool; the new string will be NUL-terminated
|
||||
* @param p The pool to allocate out of
|
||||
* @param s The string to duplicate
|
||||
* @param n The maximum number of characters to duplicate
|
||||
* @return The new string or NULL if s == NULL
|
||||
* @remark The amount of memory allocated from the pool is the length
|
||||
* of the returned string including the NUL terminator
|
||||
*/
|
||||
//APR_DECLARE(char *) apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n);
|
||||
|
||||
/**
|
||||
* Duplicate a block of memory.
|
||||
*
|
||||
* @param p The pool to allocate from
|
||||
* @param m The memory to duplicate
|
||||
* @param n The number of bytes to duplicate
|
||||
* @return The new block of memory or NULL if m == NULL
|
||||
|
||||
APR_DECLARE(void *) apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
|
||||
__attribute__((alloc_size(3)))
|
||||
#endif
|
||||
;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Concatenate multiple strings, allocating memory out a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param ... The strings to concatenate. The final string must be NULL
|
||||
* @return The new string
|
||||
|
||||
APR_DECLARE_NONSTD(char *) apr_pstrcat(apr_pool_t *p, ...)
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
__attribute__((sentinel))
|
||||
#endif
|
||||
;
|
||||
*/
|
||||
|
||||
/**
|
||||
* Concatenate multiple strings specified in a writev-style vector
|
||||
* @param p The pool from which to allocate
|
||||
* @param vec The strings to concatenate
|
||||
* @param nvec The number of strings to concatenate
|
||||
* @param nbytes (output) strlen of new string (pass in NULL to omit)
|
||||
* @return The new string
|
||||
|
||||
APR_DECLARE(char *) apr_pstrcatv(apr_pool_t *p, const struct iovec *vec,
|
||||
apr_size_t nvec, apr_size_t *nbytes);
|
||||
*/
|
||||
|
||||
/**
|
||||
* printf-style style printing routine. The data is output to a string
|
||||
* allocated from a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param fmt The format of the string
|
||||
* @param ap The arguments to use while printing the data
|
||||
* @return The new string
|
||||
*/
|
||||
//APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap);
|
||||
|
||||
/**
|
||||
* printf-style style printing routine. The data is output to a string
|
||||
* allocated from a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param fmt The format of the string
|
||||
* @param ... The arguments to use while printing the data
|
||||
* @return The new string
|
||||
|
||||
APR_DECLARE_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...)
|
||||
__attribute__((format(printf,2,3)));
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copy up to dst_size characters from src to dst; does not copy
|
||||
* past a NUL terminator in src, but always terminates dst with a NUL
|
||||
* regardless.
|
||||
* @param dst The destination string
|
||||
* @param src The source string
|
||||
* @param dst_size The space available in dst; dst always receives
|
||||
* NUL termination, so if src is longer than
|
||||
* dst_size, the actual number of characters copied is
|
||||
* dst_size - 1.
|
||||
* @return Pointer to the NUL terminator of the destination string, dst
|
||||
* @remark
|
||||
* <PRE>
|
||||
* Note the differences between this function and strncpy():
|
||||
* 1) strncpy() doesn't always NUL terminate; apr_cpystrn() does.
|
||||
* 2) strncpy() pads the destination string with NULs, which is often
|
||||
* unnecessary; apr_cpystrn() does not.
|
||||
* 3) strncpy() returns a pointer to the beginning of the dst string;
|
||||
* apr_cpystrn() returns a pointer to the NUL terminator of dst,
|
||||
* to allow a check for truncation.
|
||||
* </PRE>
|
||||
|
||||
APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src,
|
||||
apr_size_t dst_size);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Remove all whitespace from a string
|
||||
* @param dest The destination string. It is okay to modify the string
|
||||
* in place. Namely dest == src
|
||||
* @param src The string to rid the spaces from.
|
||||
* @return A pointer to the destination string's null terminator.
|
||||
*/
|
||||
//APR_DECLARE(char *) apr_collapse_spaces(char *dest, const char *src);
|
||||
|
||||
/**
|
||||
* Convert the arguments to a program from one string to an array of
|
||||
* strings terminated by a NULL pointer
|
||||
* @param arg_str The arguments to convert
|
||||
* @param argv_out Output location. This is a pointer to an array of strings.
|
||||
* @param token_context Pool to use.
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str,
|
||||
char ***argv_out,
|
||||
apr_pool_t *token_context);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Split a string into separate null-terminated tokens. The tokens are
|
||||
* delimited in the string by one or more characters from the sep
|
||||
* argument.
|
||||
* @param str The string to separate; this should be specified on the
|
||||
* first call to apr_strtok() for a given string, and NULL
|
||||
* on subsequent calls.
|
||||
* @param sep The set of delimiters
|
||||
* @param last State saved by apr_strtok() between calls.
|
||||
* @return The next token from the string
|
||||
* @note the 'last' state points to the trailing NUL char of the final
|
||||
* token, otherwise it points to the character following the current
|
||||
* token (all successive or empty occurances of sep are skiped on the
|
||||
* subsequent call to apr_strtok). Therefore it is possible to avoid
|
||||
* a strlen() determination, with the following logic;
|
||||
* toklen = last - retval; if (*last) --toklen;
|
||||
*/
|
||||
//APR_DECLARE(char *) apr_strtok(char *str, const char *sep, char **last);
|
||||
|
||||
/**
|
||||
* @defgroup APR_Strings_Snprintf snprintf implementations
|
||||
* @warning
|
||||
* These are snprintf implementations based on apr_vformatter().
|
||||
*
|
||||
* Note that various standards and implementations disagree on the return
|
||||
* value of snprintf, and side-effects due to %n in the formatting string.
|
||||
* apr_snprintf (and apr_vsnprintf) behaves as follows:
|
||||
*
|
||||
* Process the format string until the entire string is exhausted, or
|
||||
* the buffer fills. If the buffer fills then stop processing immediately
|
||||
* (so no further %n arguments are processed), and return the buffer
|
||||
* length. In all cases the buffer is NUL terminated. It will return the
|
||||
* number of characters inserted into the buffer, not including the
|
||||
* terminating NUL. As a special case, if len is 0, apr_snprintf will
|
||||
* return the number of characters that would have been inserted if
|
||||
* the buffer had been infinite (in this case, *buffer can be NULL)
|
||||
*
|
||||
* In no event does apr_snprintf return a negative number.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* snprintf routine based on apr_vformatter. This means it understands the
|
||||
* same extensions.
|
||||
* @param buf The buffer to write to
|
||||
* @param len The size of the buffer
|
||||
* @param format The format string
|
||||
* @param ... The arguments to use to fill out the format string.
|
||||
|
||||
APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len,
|
||||
const char *format, ...)
|
||||
__attribute__((format(printf,3,4)));
|
||||
*/
|
||||
|
||||
/**
|
||||
* vsnprintf routine based on apr_vformatter. This means it understands the
|
||||
* same extensions.
|
||||
* @param buf The buffer to write to
|
||||
* @param len The size of the buffer
|
||||
* @param format The format string
|
||||
* @param ap The arguments to use to fill out the format string.
|
||||
|
||||
APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format,
|
||||
va_list ap);
|
||||
*/
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* create a string representation of an int, allocated from a pool
|
||||
* @param p The pool from which to allocate
|
||||
* @param n The number to format
|
||||
* @return The string representation of the number
|
||||
*/
|
||||
//APR_DECLARE(char *) apr_itoa(apr_pool_t *p, int n);
|
||||
|
||||
/**
|
||||
* create a string representation of a long, allocated from a pool
|
||||
* @param p The pool from which to allocate
|
||||
* @param n The number to format
|
||||
* @return The string representation of the number
|
||||
*/
|
||||
//APR_DECLARE(char *) apr_ltoa(apr_pool_t *p, long n);
|
||||
|
||||
/**
|
||||
* create a string representation of an apr_off_t, allocated from a pool
|
||||
* @param p The pool from which to allocate
|
||||
* @param n The number to format
|
||||
* @return The string representation of the number
|
||||
*/
|
||||
//APR_DECLARE(char *) apr_off_t_toa(apr_pool_t *p, apr_off_t n);
|
||||
|
||||
/**
|
||||
* Convert a numeric string into an apr_off_t numeric value.
|
||||
* @param offset The value of the parsed string.
|
||||
* @param buf The string to parse. It may contain optional whitespace,
|
||||
* followed by an optional '+' (positive, default) or '-' (negative)
|
||||
* character, followed by an optional '0x' prefix if base is 0 or 16,
|
||||
* followed by numeric digits appropriate for base.
|
||||
* @param end A pointer to the end of the valid character in buf. If
|
||||
* not NULL, it is set to the first invalid character in buf.
|
||||
* @param base A numeric base in the range between 2 and 36 inclusive,
|
||||
* or 0. If base is zero, buf will be treated as base ten unless its
|
||||
* digits are prefixed with '0x', in which case it will be treated as
|
||||
* base 16.
|
||||
* @bug *end breaks type safety; where *buf is const, *end needs to be
|
||||
* declared as const in APR 2.0
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *buf,
|
||||
char **end, int base);
|
||||
*/
|
||||
|
||||
/**
|
||||
* parse a numeric string into a 64-bit numeric value
|
||||
* @param buf The string to parse. It may contain optional whitespace,
|
||||
* followed by an optional '+' (positive, default) or '-' (negative)
|
||||
* character, followed by an optional '0x' prefix if base is 0 or 16,
|
||||
* followed by numeric digits appropriate for base.
|
||||
* @param end A pointer to the end of the valid character in buf. If
|
||||
* not NULL, it is set to the first invalid character in buf.
|
||||
* @param base A numeric base in the range between 2 and 36 inclusive,
|
||||
* or 0. If base is zero, buf will be treated as base ten unless its
|
||||
* digits are prefixed with '0x', in which case it will be treated as
|
||||
* base 16.
|
||||
* @return The numeric value of the string. On overflow, errno is set
|
||||
* to ERANGE. On success, errno is set to 0.
|
||||
*/
|
||||
//APR_DECLARE(apr_int64_t) apr_strtoi64(const char *buf, char **end, int base);
|
||||
|
||||
/**
|
||||
* parse a base-10 numeric string into a 64-bit numeric value.
|
||||
* Equivalent to apr_strtoi64(buf, (char**)NULL, 10).
|
||||
* @param buf The string to parse
|
||||
* @return The numeric value of the string. On overflow, errno is set
|
||||
* to ERANGE. On success, errno is set to 0.
|
||||
*/
|
||||
//APR_DECLARE(apr_int64_t) apr_atoi64(const char *buf);
|
||||
|
||||
/**
|
||||
* Format a binary size (magnitiudes are 2^10 rather than 10^3) from an apr_off_t,
|
||||
* as bytes, K, M, T, etc, to a four character compacted human readable string.
|
||||
* @param size The size to format
|
||||
* @param buf The 5 byte text buffer (counting the trailing null)
|
||||
* @return The buf passed to apr_strfsize()
|
||||
* @remark All negative sizes report ' - ', apr_strfsize only formats positive values.
|
||||
*/
|
||||
//APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_STRINGS_H */
|
126
code/application/source/sf_app/code/include/apr_want.h
Executable file
126
code/application/source/sf_app/code/include/apr_want.h
Executable file
|
@ -0,0 +1,126 @@
|
|||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr.h" /* configuration data */
|
||||
/**
|
||||
* @file apr_want.h
|
||||
* @brief APR Standard Headers Support
|
||||
*
|
||||
* <PRE>
|
||||
* Features:
|
||||
*
|
||||
* APR_WANT_STRFUNC: strcmp, strcat, strcpy, etc
|
||||
* APR_WANT_MEMFUNC: memcmp, memcpy, etc
|
||||
* APR_WANT_STDIO: <stdio.h> and related bits
|
||||
* APR_WANT_IOVEC: struct iovec
|
||||
* APR_WANT_BYTEFUNC: htons, htonl, ntohl, ntohs
|
||||
*
|
||||
* Typical usage:
|
||||
*
|
||||
* \#define APR_WANT_STRFUNC
|
||||
* \#define APR_WANT_MEMFUNC
|
||||
* \#include "apr_want.h"
|
||||
*
|
||||
* The appropriate headers will be included.
|
||||
*
|
||||
* Note: it is safe to use this in a header (it won't interfere with other
|
||||
* headers' or source files' use of apr_want.h)
|
||||
* </PRE>
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_STRFUNC
|
||||
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_STRFUNC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_MEMFUNC
|
||||
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_MEMFUNC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_STDIO
|
||||
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_STDIO
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_IOVEC
|
||||
|
||||
#if APR_HAVE_IOVEC
|
||||
|
||||
#if APR_HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifndef APR_IOVEC_DEFINED
|
||||
#define APR_IOVEC_DEFINED
|
||||
#if 0
|
||||
struct iovec
|
||||
{
|
||||
void *iov_base;
|
||||
size_t iov_len;
|
||||
};
|
||||
#endif
|
||||
#endif /* !APR_IOVEC_DEFINED */
|
||||
|
||||
#endif /* APR_HAVE_IOVEC */
|
||||
|
||||
#undef APR_WANT_IOVEC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_BYTEFUNC
|
||||
|
||||
/* Single Unix says they are in arpa/inet.h. Linux has them in
|
||||
* netinet/in.h. FreeBSD has them in arpa/inet.h but requires that
|
||||
* netinet/in.h be included first.
|
||||
*/
|
||||
#if APR_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#if APR_HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_BYTEFUNC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
164
code/application/source/sf_app/code/include/apr_xlate.h
Executable file
164
code/application/source/sf_app/code/include/apr_xlate.h
Executable file
|
@ -0,0 +1,164 @@
|
|||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_XLATE_H
|
||||
#define APR_XLATE_H
|
||||
|
||||
#include "apu.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @file apr_xlate.h
|
||||
* @brief APR I18N translation library
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup APR_XLATE I18N translation library
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
/** Opaque translation buffer */
|
||||
typedef struct apr_xlate_t apr_xlate_t;
|
||||
|
||||
/**
|
||||
* Set up for converting text from one charset to another.
|
||||
* @param convset The handle to be filled in by this function
|
||||
* @param topage The name of the target charset
|
||||
* @param frompage The name of the source charset
|
||||
* @param pool The pool to use
|
||||
* @remark
|
||||
* Specify APR_DEFAULT_CHARSET for one of the charset
|
||||
* names to indicate the charset of the source code at
|
||||
* compile time. This is useful if there are literal
|
||||
* strings in the source code which must be translated
|
||||
* according to the charset of the source code.
|
||||
* APR_DEFAULT_CHARSET is not useful if the source code
|
||||
* of the caller was not encoded in the same charset as
|
||||
* APR at compile time.
|
||||
*
|
||||
* @remark
|
||||
* Specify APR_LOCALE_CHARSET for one of the charset
|
||||
* names to indicate the charset of the current locale.
|
||||
*
|
||||
* @remark
|
||||
* Return APR_EINVAL if unable to procure a convset, or APR_ENOTIMPL
|
||||
* if charset transcoding is not available in this instance of
|
||||
* apr-util at all (i.e., APR_HAS_XLATE is undefined).
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xlate_open(apr_xlate_t **convset,
|
||||
const char *topage,
|
||||
const char *frompage,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* This is to indicate the charset of the sourcecode at compile time
|
||||
* names to indicate the charset of the source code at
|
||||
* compile time. This is useful if there are literal
|
||||
* strings in the source code which must be translated
|
||||
* according to the charset of the source code.
|
||||
*/
|
||||
#define APR_DEFAULT_CHARSET (const char *)0
|
||||
/**
|
||||
* To indicate charset names of the current locale
|
||||
*/
|
||||
#define APR_LOCALE_CHARSET (const char *)1
|
||||
|
||||
/**
|
||||
* Find out whether or not the specified conversion is single-byte-only.
|
||||
* @param convset The handle allocated by apr_xlate_open, specifying the
|
||||
* parameters of conversion
|
||||
* @param onoff Output: whether or not the conversion is single-byte-only
|
||||
* @remark
|
||||
* Return APR_ENOTIMPL if charset transcoding is not available
|
||||
* in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xlate_sb_get(apr_xlate_t *convset, int *onoff);
|
||||
|
||||
/**
|
||||
* Convert a buffer of text from one codepage to another.
|
||||
* @param convset The handle allocated by apr_xlate_open, specifying
|
||||
* the parameters of conversion
|
||||
* @param inbuf The address of the source buffer
|
||||
* @param inbytes_left Input: the amount of input data to be translated
|
||||
* Output: the amount of input data not yet translated
|
||||
* @param outbuf The address of the destination buffer
|
||||
* @param outbytes_left Input: the size of the output buffer
|
||||
* Output: the amount of the output buffer not yet used
|
||||
* @remark
|
||||
* Returns APR_ENOTIMPL if charset transcoding is not available
|
||||
* in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
|
||||
* Returns APR_INCOMPLETE if the input buffer ends in an incomplete
|
||||
* multi-byte character.
|
||||
*
|
||||
* To correctly terminate the output buffer for some multi-byte
|
||||
* character set encodings, a final call must be made to this function
|
||||
* after the complete input string has been converted, passing
|
||||
* the inbuf and inbytes_left parameters as NULL. (Note that this
|
||||
* mode only works from version 1.1.0 onwards)
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xlate_conv_buffer(apr_xlate_t *convset,
|
||||
const char *inbuf,
|
||||
UINT32 *inbytes_left,
|
||||
char *outbuf,
|
||||
UINT32 *outbytes_left);
|
||||
|
||||
/* @see apr_file_io.h the comment in apr_file_io.h about this hack */
|
||||
#ifdef APR_NOT_DONE_YET
|
||||
/**
|
||||
* The purpose of apr_xlate_conv_char is to translate one character
|
||||
* at a time. This needs to be written carefully so that it works
|
||||
* with double-byte character sets.
|
||||
* @param convset The handle allocated by apr_xlate_open, specifying the
|
||||
* parameters of conversion
|
||||
* @param inchar The character to convert
|
||||
* @param outchar The converted character
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xlate_conv_char(apr_xlate_t *convset,
|
||||
char inchar, char outchar);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Convert a single-byte character from one charset to another.
|
||||
* @param convset The handle allocated by apr_xlate_open, specifying the
|
||||
* parameters of conversion
|
||||
* @param inchar The single-byte character to convert.
|
||||
* @warning This only works when converting between single-byte character sets.
|
||||
* -1 will be returned if the conversion can't be performed.
|
||||
*/
|
||||
//APU_DECLARE(apr_int32_t) apr_xlate_conv_byte(apr_xlate_t *convset,
|
||||
// unsigned char inchar);
|
||||
|
||||
/**
|
||||
* Close a codepage translation handle.
|
||||
* @param convset The codepage translation handle to close
|
||||
* @remark
|
||||
* Return APR_ENOTIMPL if charset transcoding is not available
|
||||
* in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
|
||||
*/
|
||||
APU_DECLARE(apr_status_t) apr_xlate_close(apr_xlate_t *convset);
|
||||
|
||||
/** @} */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_XLATE_H */
|
146
code/application/source/sf_app/code/include/apu.h
Executable file
146
code/application/source/sf_app/code/include/apu.h
Executable file
|
@ -0,0 +1,146 @@
|
|||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* apu.h is duplicated from apu.hw at build time -- do not edit apu.h
|
||||
*/
|
||||
/* @file apu.h
|
||||
* @brief APR-Utility main file
|
||||
*/
|
||||
/**
|
||||
* @defgroup APR_Util APR Utility Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#ifndef APU_H
|
||||
#define APU_H
|
||||
|
||||
/**
|
||||
* APU_DECLARE_EXPORT is defined when building the APR-UTIL dynamic library,
|
||||
* so that all public symbols are exported.
|
||||
*
|
||||
* APU_DECLARE_STATIC is defined when including the APR-UTIL public headers,
|
||||
* to provide static linkage when the dynamic library may be unavailable.
|
||||
*
|
||||
* APU_DECLARE_STATIC and APU_DECLARE_EXPORT are left undefined when
|
||||
* including the APR-UTIL public headers, to import and link the symbols from
|
||||
* the dynamic APR-UTIL library and assure appropriate indirection and calling
|
||||
* conventions at compile time.
|
||||
*/
|
||||
|
||||
/* Make sure we have our platform identifier macro defined we ask for later.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(WIN32)
|
||||
#define WIN32 1
|
||||
#endif
|
||||
|
||||
#if defined(DOXYGEN) || !defined(WIN32)
|
||||
/**
|
||||
* The public APR-UTIL functions are declared with APU_DECLARE(), so they may
|
||||
* use the most appropriate calling convention. Public APR functions with
|
||||
* variable arguments must use APU_DECLARE_NONSTD().
|
||||
*
|
||||
* @fn APU_DECLARE(rettype) apr_func(args);
|
||||
*/
|
||||
#define APU_DECLARE(type) type
|
||||
/**
|
||||
* The public APR-UTIL functions using variable arguments are declared with
|
||||
* APU_DECLARE_NONSTD(), as they must use the C language calling convention.
|
||||
*
|
||||
* @fn APU_DECLARE_NONSTD(rettype) apr_func(args, ...);
|
||||
*/
|
||||
#define APU_DECLARE_NONSTD(type) type
|
||||
/**
|
||||
* The public APR-UTIL variables are declared with APU_DECLARE_DATA.
|
||||
* This assures the appropriate indirection is invoked at compile time.
|
||||
*
|
||||
* @fn APU_DECLARE_DATA type apr_variable;
|
||||
* @note extern APU_DECLARE_DATA type apr_variable; syntax is required for
|
||||
* declarations within headers to properly import the variable.
|
||||
*/
|
||||
#define APU_DECLARE_DATA
|
||||
#elif defined(APU_DECLARE_STATIC)
|
||||
#define APU_DECLARE(type) type __stdcall
|
||||
#define APU_DECLARE_NONSTD(type) type __cdecl
|
||||
#define APU_DECLARE_DATA
|
||||
#elif defined(APU_DECLARE_EXPORT)
|
||||
#define APU_DECLARE(type) __declspec(dllexport) type __stdcall
|
||||
#define APU_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
|
||||
#define APU_DECLARE_DATA __declspec(dllexport)
|
||||
#else
|
||||
#define APU_DECLARE(type) __declspec(dllimport) type __stdcall
|
||||
#define APU_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
|
||||
#define APU_DECLARE_DATA __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#if !defined(WIN32) || defined(APU_MODULE_DECLARE_STATIC)
|
||||
/**
|
||||
* Declare a dso module's exported module structure as APU_MODULE_DECLARE_DATA.
|
||||
*
|
||||
* Unless APU_MODULE_DECLARE_STATIC is defined at compile time, symbols
|
||||
* declared with APU_MODULE_DECLARE_DATA are always exported.
|
||||
* @code
|
||||
* module APU_MODULE_DECLARE_DATA mod_tag
|
||||
* @endcode
|
||||
*/
|
||||
#define APU_MODULE_DECLARE_DATA
|
||||
#else
|
||||
#define APU_MODULE_DECLARE_DATA __declspec(dllexport)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* we always have SDBM (it's in our codebase)
|
||||
*/
|
||||
#define APU_HAVE_SDBM 1
|
||||
|
||||
#ifndef APU_DSO_MODULE_BUILD
|
||||
#define APU_HAVE_GDBM 0
|
||||
#define APU_HAVE_NDBM 0
|
||||
#define APU_HAVE_DB 0
|
||||
|
||||
#if APU_HAVE_DB
|
||||
#define APU_HAVE_DB_VERSION 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* we always enable dynamic driver loads within apr_dbd
|
||||
* Win32 always has odbc (it's always installed)
|
||||
*/
|
||||
#ifndef APU_DSO_MODULE_BUILD
|
||||
#define APU_HAVE_PGSQL 0
|
||||
#define APU_HAVE_MYSQL 0
|
||||
#define APU_HAVE_SQLITE3 0
|
||||
#define APU_HAVE_SQLITE2 0
|
||||
#define APU_HAVE_ORACLE 0
|
||||
#define APU_HAVE_FREETDS 0
|
||||
#define APU_HAVE_ODBC 1
|
||||
#endif
|
||||
|
||||
#define APU_HAVE_CRYPTO 0
|
||||
|
||||
#ifndef APU_DSO_MODULE_BUILD
|
||||
#define APU_HAVE_OPENSSL 0
|
||||
#define APU_HAVE_NSS 0
|
||||
#endif
|
||||
|
||||
#define APU_HAVE_APR_ICONV 0
|
||||
#define APU_HAVE_ICONV 0
|
||||
#define APR_HAS_XLATE (APU_HAVE_APR_ICONV || APU_HAVE_ICONV)
|
||||
|
||||
#endif /* APU_H */
|
||||
/** @} */
|
52
code/application/source/sf_app/code/include/apu_config.h
Executable file
52
code/application/source/sf_app/code/include/apu_config.h
Executable file
|
@ -0,0 +1,52 @@
|
|||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Note: This is a Windows specific version of apu_config.hw. It is copied
|
||||
* as apu_config.h at the start of a Windows build.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#ifndef APU_CONFIG_H
|
||||
#define APU_CONFIG_H
|
||||
|
||||
/* Compile win32 with DSO support for .dll builds */
|
||||
#ifdef APU_DECLARE_STATIC
|
||||
#define APU_DSO_BUILD 0
|
||||
#else
|
||||
#define APU_DSO_BUILD 1
|
||||
#endif
|
||||
|
||||
/* Presume a standard, modern (5.x) mysql sdk/
|
||||
#define HAVE_MY_GLOBAL_H 1
|
||||
|
||||
/* my_sys.h is broken on VC/Win32, and apparently not required */
|
||||
/* #undef HAVE_MY_SYS_H 0 */
|
||||
|
||||
/*
|
||||
* Windows does not have GDBM, and we always use the bundled (new) Expat
|
||||
*/
|
||||
|
||||
/* Define if you have the gdbm library (-lgdbm). */
|
||||
/* #undef HAVE_LIBGDBM */
|
||||
|
||||
/* define if Expat 1.0 or 1.1 was found */
|
||||
/* #undef APR_HAVE_OLD_EXPAT */
|
||||
|
||||
|
||||
#endif /* APU_CONFIG_H */
|
||||
#endif /* WIN32 */
|
48
code/application/source/sf_app/code/include/bitstream.h
Executable file
48
code/application/source/sf_app/code/include/bitstream.h
Executable file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Binary sequence class.
|
||||
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __BITSTREAM_H__
|
||||
#define __BITSTREAM_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int length;
|
||||
unsigned char *data;
|
||||
} BitStream;
|
||||
|
||||
extern BitStream *BitStream_new(void);
|
||||
extern int BitStream_append(BitStream *bstream, BitStream *arg);
|
||||
extern int BitStream_appendNum(BitStream *bstream, int bits, unsigned int num);
|
||||
extern int BitStream_appendBytes(BitStream *bstream, int size, unsigned char *data);
|
||||
#define BitStream_size(__bstream__) (__bstream__->length)
|
||||
extern unsigned char *BitStream_toByte(BitStream *bstream);
|
||||
extern void BitStream_free(BitStream *bstream);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __BITSTREAM_H__ */
|
276
code/application/source/sf_app/code/include/cJSON.h
Executable file
276
code/application/source/sf_app/code/include/cJSON.h
Executable file
|
@ -0,0 +1,276 @@
|
|||
/*
|
||||
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef cJSON__h
|
||||
#define cJSON__h
|
||||
#include "sf_type.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* project version */
|
||||
#define CJSON_VERSION_MAJOR 1
|
||||
#define CJSON_VERSION_MINOR 7
|
||||
#define CJSON_VERSION_PATCH 1
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* cJSON Types: */
|
||||
#define cJSON_Invalid (0)
|
||||
#define cJSON_False (1 << 0)
|
||||
#define cJSON_True (1 << 1)
|
||||
#define cJSON_NULL (1 << 2)
|
||||
#define cJSON_Number (1 << 3)
|
||||
#define cJSON_String (1 << 4)
|
||||
#define cJSON_Array (1 << 5)
|
||||
#define cJSON_Object (1 << 6)
|
||||
#define cJSON_Raw (1 << 7) /* raw json */
|
||||
|
||||
#define cJSON_IsReference 256
|
||||
#define cJSON_StringIsConst 512
|
||||
|
||||
/* The cJSON structure: */
|
||||
typedef struct cJSON
|
||||
{
|
||||
/* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||
struct cJSON *next;
|
||||
struct cJSON *prev;
|
||||
/* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||
struct cJSON *child;
|
||||
|
||||
/* The type of the item, as above. */
|
||||
int type;
|
||||
|
||||
/* The item's string, if type==cJSON_String and type == cJSON_Raw */
|
||||
char *valuestring;
|
||||
/* writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead */
|
||||
int valueint;
|
||||
/* The item's number, if type==cJSON_Number */
|
||||
SINT32 valueSINT32;
|
||||
|
||||
/* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||
char *string;
|
||||
} cJSON;
|
||||
|
||||
typedef struct cJSON_Hooks
|
||||
{
|
||||
void *(*malloc_fn)(size_t sz);
|
||||
void (*free_fn)(void *ptr);
|
||||
} cJSON_Hooks;
|
||||
|
||||
typedef int cJSON_bool;
|
||||
|
||||
#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32))
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
/* When compiling for windows, we specify a specific calling convention to avoid issues where we are being called from a project with a different default calling convention. For windows you have 2 define options:
|
||||
|
||||
CJSON_HIDE_SYMBOLS - Define this in the case where you don't want to ever dllexport symbols
|
||||
CJSON_EXPORT_SYMBOLS - Define this on library build when you want to dllexport symbols (default)
|
||||
CJSON_IMPORT_SYMBOLS - Define this if you want to dllimport symbol
|
||||
|
||||
For *nix builds that support visibility attribute, you can define similar behavior by
|
||||
|
||||
setting default visibility to hidden by adding
|
||||
-fvisibility=hidden (for gcc)
|
||||
or
|
||||
-xldscope=hidden (for sun cc)
|
||||
to CFLAGS
|
||||
|
||||
then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJSON_EXPORT_SYMBOLS does
|
||||
|
||||
*/
|
||||
|
||||
/* export symbols by default, this is necessary for copy pasting the C and header file */
|
||||
#if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_EXPORT_SYMBOLS
|
||||
#endif
|
||||
|
||||
#if defined(CJSON_HIDE_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) type __stdcall
|
||||
#elif defined(CJSON_EXPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllexport) type __stdcall
|
||||
#elif defined(CJSON_IMPORT_SYMBOLS)
|
||||
#define CJSON_PUBLIC(type) __declspec(dllimport) type __stdcall
|
||||
#endif
|
||||
#else /* !WIN32 */
|
||||
#if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(CJSON_API_VISIBILITY)
|
||||
#define CJSON_PUBLIC(type) __attribute__((visibility("default"))) type
|
||||
#else
|
||||
#define CJSON_PUBLIC(type) type
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Limits how deeply nested arrays/objects can be before cJSON rejects to parse them.
|
||||
* This is to prevent stack overflows. */
|
||||
#ifndef CJSON_NESTING_LIMIT
|
||||
#define CJSON_NESTING_LIMIT 1000
|
||||
#endif
|
||||
|
||||
/* returns the version of cJSON as a string */
|
||||
CJSON_PUBLIC(const char*) cJSON_Version(void);
|
||||
|
||||
/* Supply malloc, realloc and free functions to cJSON */
|
||||
CJSON_PUBLIC(void) cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||
|
||||
/* Memory Management: the caller is always responsible to free the results from all variants of cJSON_Parse (with cJSON_Delete) and cJSON_Print (with stdlib free, cJSON_Hooks.free_fn, or cJSON_free as appropriate). The exception is cJSON_PrintPreallocated, where the caller has full responsibility of the buffer. */
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value);
|
||||
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||
/* If you supply a ptr in return_parse_end and parsing fails, then return_parse_end will contain a pointer to the error so will match cJSON_GetErrorPtr(). */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated);
|
||||
|
||||
/* Render a cJSON entity to text for transfer/storage. */
|
||||
CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting. */
|
||||
CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item);
|
||||
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||
CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt);
|
||||
/* Render a cJSON entity to text using a buffer already allocated in memory with given length. Returns 1 on success and 0 on failure. */
|
||||
/* NOTE: cJSON is not always 100% accurate in estimating how much memory it will use, so to be safe allocate 5 bytes more than you actually need */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buffer, const int length, const cJSON_bool format);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
CJSON_PUBLIC(void) cJSON_Delete(cJSON *c);
|
||||
|
||||
/* Returns the number of items in an array (or object). */
|
||||
CJSON_PUBLIC(int) cJSON_GetArraySize(const cJSON *array);
|
||||
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetArrayItem(const cJSON *array, int index);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string);
|
||||
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void);
|
||||
|
||||
/* Check if the item is a string and return its valuestring */
|
||||
CJSON_PUBLIC(char *) cJSON_GetStringValue(cJSON *item);
|
||||
|
||||
/* These functions check the type of an item */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item);
|
||||
|
||||
/* These calls create a cJSON item of the appropriate type. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateNull(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateTrue(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateFalse(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateBool(cJSON_bool boolean);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateNumber(SINT32 num);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string);
|
||||
/* raw json */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateRaw(const char *raw);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateArray(void);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateObject(void);
|
||||
|
||||
/* Create a string where valuestring references a string so
|
||||
* it will not be freed by cJSON_Delete */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string);
|
||||
/* Create an object/arrray that only references it's elements so
|
||||
* they will not be freed by cJSON_Delete */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateObjectReference(const cJSON *child);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateArrayReference(const cJSON *child);
|
||||
|
||||
/* These utilities create an Array of count items. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateIntArray(const int *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateSINT32Array(const SINT32 *numbers, int count);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_CreateStringArray(const char **strings, int count);
|
||||
|
||||
/* Append item to the specified array/object. */
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item);
|
||||
/* Use this when string is definitely const (i.e. a literal, or as good as), and will definitely survive the cJSON object.
|
||||
* WARNING: When this function was used, make sure to always check that (item->type & cJSON_StringIsConst) is zero before
|
||||
* writing to `item->string` */
|
||||
CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item);
|
||||
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||
CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||
CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
|
||||
|
||||
/* Remove/Detatch items from Arrays/Objects. */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string);
|
||||
CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string);
|
||||
|
||||
/* Update array items. */
|
||||
CJSON_PUBLIC(void) cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSON * replacement);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||
CJSON_PUBLIC(void) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object,const char *string,cJSON *newitem);
|
||||
|
||||
/* Duplicate a cJSON item */
|
||||
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse);
|
||||
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||
need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||
The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||
/* Recursively compare two cJSON items for equality. If either a or b is NULL or invalid, they will be considered unequal.
|
||||
* case_sensitive determines if object keys are treated case sensitive (1) or case insensitive (0) */
|
||||
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive);
|
||||
|
||||
|
||||
CJSON_PUBLIC(void) cJSON_Minify(char *json);
|
||||
|
||||
/* Helper functions for creating and adding items to an object at the same time.
|
||||
* They return the added item or NULL on failure. */
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddTrueToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddFalseToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddBoolToObject(cJSON * const object, const char * const name, const cJSON_bool boolean);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddNumberToObject(cJSON * const object, const char * const name, const SINT32 number);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddRawToObject(cJSON * const object, const char * const name, const char * const raw);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddObjectToObject(cJSON * const object, const char * const name);
|
||||
CJSON_PUBLIC(cJSON*) cJSON_AddArrayToObject(cJSON * const object, const char * const name);
|
||||
|
||||
/* When assigning an integer value, it needs to be propagated to valueSINT32 too. */
|
||||
#define cJSON_SetIntValue(object, number) ((object) ? (object)->valueint = (object)->valueSINT32 = (number) : (number))
|
||||
/* helper for the cJSON_SetNumberValue macro */
|
||||
CJSON_PUBLIC(SINT32) cJSON_SetNumberHelper(cJSON *object, SINT32 number);
|
||||
#define cJSON_SetNumberValue(object, number) ((object != NULL) ? cJSON_SetNumberHelper(object, (SINT32)number) : (number))
|
||||
|
||||
/* Macro for iterating over an array or object */
|
||||
#define cJSON_ArrayForEach(element, array) for(element = (array != NULL) ? (array)->child : NULL; element != NULL; element = element->next)
|
||||
|
||||
/* malloc/free objects using the malloc/free functions that have been set with cJSON_InitHooks */
|
||||
CJSON_PUBLIC(void *) cJSON_malloc(size_t size);
|
||||
CJSON_PUBLIC(void) cJSON_free(void *object);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
47
code/application/source/sf_app/code/include/mask.h
Executable file
47
code/application/source/sf_app/code/include/mask.h
Executable file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Masking.
|
||||
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __MASK_H__
|
||||
#define __MASK_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, QRecLevel level);
|
||||
extern unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level);
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
extern int Mask_calcN2(int width, unsigned char *frame);
|
||||
extern int Mask_calcN1N3(int length, int *runLength);
|
||||
extern int Mask_calcRunLength(int width, unsigned char *frame, int dir, int *runLength);
|
||||
extern int Mask_evaluateSymbol(int width, unsigned char *frame);
|
||||
extern int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level);
|
||||
extern unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, int mask);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __MASK_H__ */
|
25941
code/application/source/sf_app/code/include/mbedtls.h
Executable file
25941
code/application/source/sf_app/code/include/mbedtls.h
Executable file
File diff suppressed because it is too large
Load Diff
44
code/application/source/sf_app/code/include/mmask.h
Executable file
44
code/application/source/sf_app/code/include/mmask.h
Executable file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Masking for Micro QR Code.
|
||||
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __MMASK_H__
|
||||
#define __MMASK_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern unsigned char *MMask_makeMask(int version, unsigned char *frame, int mask, QRecLevel level);
|
||||
extern unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level);
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
extern int MMask_evaluateSymbol(int width, unsigned char *frame);
|
||||
extern void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level);
|
||||
extern unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, int mask);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __MMASK_H__ */
|
167
code/application/source/sf_app/code/include/mqrspec.h
Executable file
167
code/application/source/sf_app/code/include/mqrspec.h
Executable file
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Micro QR Code specification in convenient format.
|
||||
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __MQRSPEC_H__
|
||||
#define __MQRSPEC_H__
|
||||
|
||||
#include "qrencode.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* Version and capacity
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Maximum width of a symbol
|
||||
*/
|
||||
#define MQRSPEC_WIDTH_MAX 17
|
||||
|
||||
/**
|
||||
* Return maximum data code length (bits) for the version.
|
||||
* @param version
|
||||
* @param level
|
||||
* @return maximum size (bits)
|
||||
*/
|
||||
extern int MQRspec_getDataLengthBit(int version, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Return maximum data code length (bytes) for the version.
|
||||
* @param version
|
||||
* @param level
|
||||
* @return maximum size (bytes)
|
||||
*/
|
||||
extern int MQRspec_getDataLength(int version, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Return maximum error correction code length (bytes) for the version.
|
||||
* @param version
|
||||
* @param level
|
||||
* @return ECC size (bytes)
|
||||
*/
|
||||
extern int MQRspec_getECCLength(int version, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Return a version number that satisfies the input code length.
|
||||
* @param size input code length (byte)
|
||||
* @param level
|
||||
* @return version number
|
||||
*/
|
||||
extern int MQRspec_getMinimumVersion(int size, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Return the width of the symbol for the version.
|
||||
* @param version
|
||||
* @return width
|
||||
*/
|
||||
extern int MQRspec_getWidth(int version);
|
||||
|
||||
/**
|
||||
* Return the numer of remainder bits.
|
||||
* @param version
|
||||
* @return number of remainder bits
|
||||
*/
|
||||
extern int MQRspec_getRemainder(int version);
|
||||
|
||||
/******************************************************************************
|
||||
* Length indicator
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Return the size of lenght indicator for the mode and version.
|
||||
* @param mode
|
||||
* @param version
|
||||
* @return the size of the appropriate length indicator (bits).
|
||||
*/
|
||||
extern int MQRspec_lengthIndicator(QRencodeMode mode, int version);
|
||||
|
||||
/**
|
||||
* Return the maximum length for the mode and version.
|
||||
* @param mode
|
||||
* @param version
|
||||
* @return the maximum length (bytes)
|
||||
*/
|
||||
extern int MQRspec_maximumWords(QRencodeMode mode, int version);
|
||||
|
||||
/******************************************************************************
|
||||
* Version information pattern
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Return BCH encoded version information pattern that is used for the symbol
|
||||
* of version 7 or greater. Use lower 18 bits.
|
||||
* @param version
|
||||
* @return BCH encoded version information pattern
|
||||
*/
|
||||
extern unsigned int MQRspec_getVersionPattern(int version);
|
||||
|
||||
/******************************************************************************
|
||||
* Format information
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Return BCH encoded format information pattern.
|
||||
* @param mask
|
||||
* @param version
|
||||
* @param level
|
||||
* @return BCH encoded format information pattern
|
||||
*/
|
||||
extern unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level);
|
||||
|
||||
/******************************************************************************
|
||||
* Frame
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Return a copy of initialized frame.
|
||||
* When the same version is requested twice or more, a copy of cached frame
|
||||
* is returned.
|
||||
* @param version
|
||||
* @return Array of unsigned char. You can free it by free().
|
||||
*/
|
||||
extern unsigned char *MQRspec_newFrame(int version);
|
||||
|
||||
/**
|
||||
* Clear the frame cache. Typically for debug.
|
||||
*/
|
||||
extern void MQRspec_clearCache(void);
|
||||
|
||||
/******************************************************************************
|
||||
* Mode indicator
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Mode indicator. See Table 2 in Appendix 1 of JIS X0510:2004, pp.107.
|
||||
*/
|
||||
#define MQRSPEC_MODEID_NUM 0
|
||||
#define MQRSPEC_MODEID_AN 1
|
||||
#define MQRSPEC_MODEID_8 2
|
||||
#define MQRSPEC_MODEID_KANJI 3
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __MQRSPEC_H__ */
|
44
code/application/source/sf_app/code/include/qrenc.h
Executable file
44
code/application/source/sf_app/code/include/qrenc.h
Executable file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* QR Code encoding tool
|
||||
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
//#include "getopt.h"
|
||||
//#include "jpeglib.h"
|
||||
|
||||
#include "qrencode.h"
|
||||
|
||||
#define INCHES_PER_METER (100.0/2.54)
|
||||
|
||||
QRcode *encode(const unsigned char *intext, int length);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
415
code/application/source/sf_app/code/include/qrencode.h
Executable file
415
code/application/source/sf_app/code/include/qrencode.h
Executable file
|
@ -0,0 +1,415 @@
|
|||
/**
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute 重新分配 it and/or
|
||||
* modify修改 it under the terms of根据什么什么的条款 the GNU Lesser General Public
|
||||
* License (GNU公共授权许可)as published (出版,发布)by the Free Software Foundation(基础); either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/** \mainpage
|
||||
* Libqrencode is a library for encoding data in a QR Code symbol, a kind of 2D
|
||||
* symbology. Libqrencode是用于在QR码符号的编码数据,一种2D符号的文库
|
||||
*
|
||||
* \section encoding Encoding 部分编码的编码
|
||||
*
|
||||
* There are two ways to encode data:这有两种方式来编码 <b>encoding a string 为字符串进行编码</b> or
|
||||
* <b>encoding a structured data为混合数据进行编码</b>.
|
||||
*
|
||||
* \subsection encoding-string Encoding a string encoding-string这一块为字符串进行编码
|
||||
* You can encode a string by calling QRcode_encodeString().你可以通过调用QRcode_encodeString()来为字符串进行编码
|
||||
* The given string is parsed automatically and encoded.给定的字符串被自动解析和编码 If you want to encode
|
||||
* data that can be represented as代表 a C string style (NUL terminated 结束终止), you can
|
||||
* simply use this way.
|
||||
*
|
||||
* If the input data contains Kanji包含汉字 (Shift-JIS) characters and you want to
|
||||
* encode them as Kanji in QR Code, you should give QR_MODE_KANJI as a hint.提示暗示
|
||||
* Otherwise, all of non-alphanumeric 非字母数字字符 characters are encoded as 8 bit data.
|
||||
* If you want to encode a whole string in 8 bit mode, use
|
||||
* QRcode_encodeString8bit() instead.
|
||||
*
|
||||
* Please note that a C string can not contain NUL character. If your data
|
||||
* contains NUL, you should chose the second way. 请注意,C字符串不能包含NULL字符。如果您的数据中包含NUL,你应该选择第二种方式。
|
||||
*
|
||||
* \subsection encoding-input Encoding a structured data encoding-input这一块为混合数据进行编码
|
||||
* You can construct a structured input data manually. 您可以手动构建一个结构化的输入数据。If the structure of the
|
||||
* input data is known, you can use this way.
|
||||
* At first, create a ::QRinput object by QRinput_new(). Then add input data
|
||||
* to the QRinput object by QRinput_append(). Finally call QRcode_encodeInput()
|
||||
* to encode the QRinput data.
|
||||
* You can reuse 重用 the QRinput data again to encode it in other symbols with
|
||||
* different parameters.不同参数的其他符号
|
||||
*
|
||||
* \section result Result
|
||||
* The encoded symbol is resulted as a ::QRcode object. It will contain
|
||||
* its version number版本号, width of the symbol符号的宽度 and an array represents the symbol 数组表示符号.
|
||||
* See ::QRcode for the details. You can free the object by QRcode_free().
|
||||
*
|
||||
* Please note that the version of the result may be larger than specified.
|
||||
* In such cases, the input data would be too large to be encoded in a
|
||||
* symbol of the specified version.输入的数据会因为太大而不被编码在指定版本的符号中
|
||||
*
|
||||
* \section structured Structured append
|
||||
* Libqrencode can generate 产生 "Structured-appended" symbols that enables to split
|
||||
* a large data set into mulitple QR codes.把一个很大数据分成多个QRcode。 A QR code reader concatenates
|
||||
* multiple QR code symbols into a string.QR码阅读器符连接多个QR码符号转换成字符串。
|
||||
* Just like QRcode_encodeString(), you can use QRcode_encodeStringStructured()
|
||||
* to generate structured-appended symbols. This functions returns an instance
|
||||
* of ::QRcode_List. The returned list is a singly-linked list of QRcode: you
|
||||
* can retrieve each QR code in this way:
|
||||
*
|
||||
* \code
|
||||
* QRcode_List *qrcodes;
|
||||
* QRcode_List *entry;
|
||||
* QRcode *qrcode;
|
||||
*
|
||||
* qrcodes = QRcode_encodeStringStructured(...);
|
||||
* entry = qrcodes;
|
||||
* while(entry != NULL) {
|
||||
* qrcode = entry->code;
|
||||
* // do something
|
||||
* entry = entry->next;
|
||||
* }
|
||||
* QRcode_List_free(entry);
|
||||
* \endcode
|
||||
*
|
||||
* Instead of using auto-parsing functions, you can construct your own
|
||||
* structured input. At first, instantiate an object of ::QRinput_Struct
|
||||
* by calling QRinput_Struct_new(). This object can hold multiple ::QRinput,
|
||||
* and one QR code is generated for a ::QRinput.
|
||||
* QRinput_Struct_appendInput() appends a ::QRinput to a ::QRinput_Struct
|
||||
* object. In order to generate structured-appended symbols, it is required to
|
||||
* embed headers to each symbol. You can use
|
||||
* QRinput_Struct_insertStructuredAppendHeaders() to insert appropriate
|
||||
* headers to each symbol. You should call this function just once before
|
||||
* encoding symbols.
|
||||
*可以构建自己的input结构来取代自动分析函数。首先,调用QRinput_Struct_new()函数来实例化一个QRinput_Struct对象。
|
||||
*这个对象可以保存多个QRinput。QRinput_Struct_appendInput()添加一个QRinput到QRinput_Struct对象中。
|
||||
*为了生成structured-appended符号,需要嵌入头到每个符号中。可以使用QRinput_Struct_insertStructuredAppendHeaders()来插入合适的头到每个符号中。
|
||||
*必须在编码符号钱调用这个方法一次。
|
||||
*/
|
||||
|
||||
#ifndef __QRENCODE_H__
|
||||
#define __QRENCODE_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Encoding mode.
|
||||
*/
|
||||
typedef enum {
|
||||
QR_MODE_NUL = -1, ///< Terminator (NUL character). Internal use only
|
||||
QR_MODE_NUM = 0, ///< Numeric mode 数字模式
|
||||
QR_MODE_AN, ///< Alphabet-numeric mode 字母数字模式
|
||||
QR_MODE_8, ///< 8-bit data mode 8位数据模式
|
||||
QR_MODE_KANJI, ///< Kanji (shift-jis) mode 汉字模式
|
||||
QR_MODE_STRUCTURE, ///< Internal use only
|
||||
QR_MODE_ECI, ///< ECI mode
|
||||
QR_MODE_FNC1FIRST, ///< FNC1, first position
|
||||
QR_MODE_FNC1SECOND, ///< FNC1, second position
|
||||
} QRencodeMode;
|
||||
|
||||
/**
|
||||
* Level of error correction.
|
||||
*/
|
||||
typedef enum {
|
||||
QR_ECLEVEL_L = 0, ///< lowest
|
||||
QR_ECLEVEL_M,
|
||||
QR_ECLEVEL_Q,
|
||||
QR_ECLEVEL_H ///< highest
|
||||
} QRecLevel;
|
||||
|
||||
/**
|
||||
* Maximum version (size) of QR-code symbol.
|
||||
*/
|
||||
#define QRSPEC_VERSION_MAX 40
|
||||
|
||||
/**
|
||||
* Maximum version (size) of QR-code symbol.
|
||||
*/
|
||||
#define MQRSPEC_VERSION_MAX 4
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Input data (qrinput.c)
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Singly linked list to contain input strings. An instance of this class
|
||||
* contains its version and error correction level too. It is required to
|
||||
* set them by QRinput_setVersion() and QRinput_setErrorCorrectionLevel(),
|
||||
* or use QRinput_new2() to instantiate an object.
|
||||
*/
|
||||
typedef struct _QRinput QRinput;
|
||||
|
||||
/**
|
||||
* Instantiate an input data object.实例化一个输入数据对象 The version is set to 0 (auto-select)
|
||||
* and the error correction level is set to QR_ECLEVEL_L.
|
||||
* @return an input object (initialized)返回一个实例化后输入对象. On error, NULL is returned and errno
|
||||
* is set to indicate the error.
|
||||
* @throw ENOMEM unable to allocate memory.
|
||||
*/
|
||||
extern QRinput *QRinput_new(void);
|
||||
|
||||
/**
|
||||
* Instantiate an input data object.
|
||||
* @param version version number.
|
||||
* @param level Error correction level.
|
||||
* @return an input object (initialized). On error, NULL is returned and errno
|
||||
* is set to indicate the error.
|
||||
* @throw ENOMEM unable to allocate memory for input objects.
|
||||
* @throw EINVAL invalid arguments.
|
||||
*/
|
||||
extern QRinput *QRinput_new2(int version, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Instantiate an input data object. Object's Micro QR Code (另外一种二维码的名字,他只有一个定位矩形,存储数据量比较小,但适用于打印空间小场合)flag is set.
|
||||
* Unlike with full-sized QR Code, version number must be specified (>0).
|
||||
* @param version version number (1--4).
|
||||
* @param level Error correction level.
|
||||
* @return an input object (initialized). On error, NULL is returned and errno
|
||||
* is set to indicate the error.
|
||||
* @throw ENOMEM unable to allocate memory for input objects.
|
||||
* @throw EINVAL invalid arguments.
|
||||
*/
|
||||
extern QRinput *QRinput_newMQR(int version, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Append data to an input object.
|
||||
* The data is copied and appended to the input object.
|
||||
* @param input input object.
|
||||
* @param mode encoding mode.
|
||||
* @param size size of data (byte).
|
||||
* @param data a pointer to the memory area of the input data.
|
||||
* @retval 0 success.
|
||||
* @retval -1 an error occurred and errno is set to indeicate the error.
|
||||
* See Execptions for the details.
|
||||
* @throw ENOMEM unable to allocate memory.
|
||||
* @throw EINVAL input data is invalid.
|
||||
*
|
||||
*/
|
||||
extern int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data);
|
||||
|
||||
/**
|
||||
* Append ECI header.特殊的字符集
|
||||
* @param input input object.
|
||||
* @param ecinum ECI indicator number (0 - 999999)
|
||||
* @retval 0 success.
|
||||
* @retval -1 an error occurred and errno is set to indeicate the error.
|
||||
* See Execptions for the details.
|
||||
* @throw ENOMEM unable to allocate memory.
|
||||
* @throw EINVAL input data is invalid.
|
||||
*
|
||||
*/
|
||||
extern int QRinput_appendECIheader(QRinput *input, unsigned int ecinum);
|
||||
|
||||
/**
|
||||
* Get current version.
|
||||
* @param input input object.
|
||||
* @return current version.
|
||||
*/
|
||||
extern int QRinput_getVersion(QRinput *input);
|
||||
|
||||
/**
|
||||
* Set version of the QR code that is to be encoded.
|
||||
* This function cannot be applied to Micro QR Code.这设置版本号不适用于Micro QR Code
|
||||
* @param input input object.
|
||||
* @param version version number (0 = auto)
|
||||
* @retval 0 success.
|
||||
* @retval -1 invalid argument.
|
||||
*/
|
||||
extern int QRinput_setVersion(QRinput *input, int version);
|
||||
|
||||
/**
|
||||
* Get current error correction level.
|
||||
* @param input input object.
|
||||
* @return Current error correcntion level.
|
||||
*/
|
||||
extern QRecLevel QRinput_getErrorCorrectionLevel(QRinput *input);
|
||||
|
||||
/**
|
||||
* Set error correction level of the QR code that is to be encoded.
|
||||
* This function cannot be applied to Micro QR Code.
|
||||
* @param input input object.
|
||||
* @param level Error correction level.
|
||||
* @retval 0 success.
|
||||
* @retval -1 invalid argument.
|
||||
*/
|
||||
extern int QRinput_setErrorCorrectionLevel(QRinput *input, QRecLevel level);
|
||||
|
||||
/**
|
||||
*适用于给Micro QR Code 设置版本号和纠错级别
|
||||
* Set version and error correction level of the QR code at once.
|
||||
* This function is recommened for Micro QR Code.
|
||||
* @param input input object.
|
||||
* @param version version number (0 = auto)
|
||||
* @param level Error correction level.
|
||||
* @retval 0 success.
|
||||
* @retval -1 invalid argument.
|
||||
*/
|
||||
extern int QRinput_setVersionAndErrorCorrectionLevel(QRinput *input, int version, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Free the input object.
|
||||
* All of data chunks in the input object are freed too.
|
||||
* @param input input object.
|
||||
*/
|
||||
extern void QRinput_free(QRinput *input);
|
||||
|
||||
/**
|
||||
* Validate the input data.检验输入的数据
|
||||
* @param mode encoding mode.
|
||||
* @param size size of data (byte).
|
||||
* @param data a pointer to the memory area of the input data.
|
||||
* @retval 0 success.
|
||||
* @retval -1 invalid arguments.
|
||||
*/
|
||||
extern int QRinput_check(QRencodeMode mode, int size, const unsigned char *data);
|
||||
|
||||
|
||||
/**
|
||||
* Free all of QRinput in the set.
|
||||
* @param s a structured input object.
|
||||
*/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* QRcode output (qrencode.c)
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* QRcode class.
|
||||
* Symbol data is represented as an array contains width*width uchars.
|
||||
* Each uchar represents a module (dot). If the less significant bit不显著位 of
|
||||
* the uchar is 1, the corresponding module is black. The other bits are
|
||||
* meaningless for usual applications, but here its specification is described.
|
||||
*
|
||||
* <pre>
|
||||
* MSB 76543210 LSB
|
||||
* |||||||`- 1=black/0=white
|
||||
* ||||||`-- data and ecc code area
|
||||
* |||||`--- format information
|
||||
* ||||`---- version information
|
||||
* |||`----- timing pattern
|
||||
* ||`------ alignment pattern
|
||||
* |`------- finder pattern and separator
|
||||
* `-------- non-data modules (format, timing, etc.)
|
||||
* </pre>
|
||||
*/
|
||||
typedef struct {
|
||||
int version; ///< version of the symbol
|
||||
int width; ///< width of the symbol
|
||||
unsigned char *data; ///< symbol data
|
||||
} QRcode;
|
||||
|
||||
/**
|
||||
* Singly-linked list of QRcode. Used to represent a structured symbols.
|
||||
* A list is terminated with NULL.
|
||||
*/
|
||||
typedef struct _QRcode_List QRcode_List;
|
||||
|
||||
struct _QRcode_List {
|
||||
QRcode *code;
|
||||
QRcode_List *next;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a symbol from the input data.
|
||||
* @warning This function is THREAD UNSAFE when pthread is disabled.
|
||||
* @param input input data.
|
||||
* @return an instance of QRcode class. The version of the result QRcode may
|
||||
* be larger than the designated version. On error, NULL is returned,
|
||||
* and errno is set to indicate the error. See Exceptions for the
|
||||
* details.
|
||||
* @throw EINVAL invalid input object.
|
||||
* @throw ENOMEM unable to allocate memory for input objects.
|
||||
*/
|
||||
extern QRcode *QRcode_encodeInput(QRinput *input);
|
||||
|
||||
/**
|
||||
* Create a symbol from the string. The library automatically parses the input
|
||||
* string and encodes in a QR Code symbol.通过字符串创建一个符号,字符库会自动分析输入的字符串然后为它进行编码。
|
||||
* @warning This function is THREAD UNSAFE when pthread is disabled.
|
||||
* @param string input string. It must be NUL terminated.
|
||||
* @param version version of the symbol. If 0, the library chooses the minimum
|
||||
* version for the given input data.
|
||||
* @param level error correction level.
|
||||
* @param hint tell the library how non-alphanumerical characters should be
|
||||
* encoded. If QR_MODE_KANJI is given, kanji characters will be
|
||||
* encoded as Shif-JIS characters. If QR_MODE_8 is given, all of
|
||||
* non-alphanumerical characters will be encoded as is. If you want
|
||||
* to embed UTF-8 string, choose this.
|
||||
* @param casesensitive case-sensitive(1) or not(0).
|
||||
* @return an instance of QRcode class. The version of the result QRcode may
|
||||
* be larger than the designated version. On error, NULL is returned,
|
||||
* and errno is set to indicate the error. See Exceptions for the
|
||||
* details.
|
||||
* @throw EINVAL invalid input object.
|
||||
* @throw ENOMEM unable to allocate memory for input objects.
|
||||
* @throw ERANGE input data is too large.
|
||||
*/
|
||||
extern QRcode *QRcode_encodeString(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive);
|
||||
|
||||
/**
|
||||
* Same to QRcode_encodeString(), but encode whole data in 8-bit mode.
|
||||
* @warning This function is THREAD UNSAFE when pthread is disabled.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Micro QR Code version of QRcode_encodeString().
|
||||
* @warning This function is THREAD UNSAFE when pthread is disabled.
|
||||
*/
|
||||
extern QRcode *QRcode_encodeStringMQR(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive);
|
||||
|
||||
/**
|
||||
* Encode byte stream (may include '\0') in 8-bit mode.在8位模式下对字节流进行编码
|
||||
* @warning This function is THREAD UNSAFE when pthread is disabled.
|
||||
* @param size size of the input data.
|
||||
* @param data input data.
|
||||
* @param version version of the symbol. If 0, the library chooses the minimum
|
||||
* version for the given input data.
|
||||
* @param level error correction level.
|
||||
* @throw EINVAL invalid input object.
|
||||
* @throw ENOMEM unable to allocate memory for input objects.
|
||||
* @throw ERANGE input data is too large.
|
||||
*/
|
||||
extern QRcode *QRcode_encodeData(int size, const unsigned char *data, int version, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Micro QR Code version of QRcode_encodeData().
|
||||
* @warning This function is THREAD UNSAFE when pthread is disabled.
|
||||
*/
|
||||
extern QRcode *QRcode_encodeDataMQR(int size, const unsigned char *data, int version, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Free the instance of QRcode class.
|
||||
* @param qrcode an instance of QRcode class.
|
||||
*/
|
||||
extern void QRcode_free(QRcode *qrcode);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __QRENCODE_H__ */
|
97
code/application/source/sf_app/code/include/qrencode_inner.h
Executable file
97
code/application/source/sf_app/code/include/qrencode_inner.h
Executable file
|
@ -0,0 +1,97 @@
|
|||
/**
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Header for test use
|
||||
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __QRENCODE_INNER_H__
|
||||
#define __QRENCODE_INNER_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This header file includes definitions for test use.
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Raw code
|
||||
*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
int dataLength;
|
||||
unsigned char *data;
|
||||
int eccLength;
|
||||
unsigned char *ecc;
|
||||
} RSblock;
|
||||
|
||||
typedef struct {
|
||||
int version;
|
||||
int dataLength;
|
||||
int eccLength;
|
||||
unsigned char *datacode;
|
||||
unsigned char *ecccode;
|
||||
int b1;
|
||||
int blocks;
|
||||
RSblock *rsblock;
|
||||
int count;
|
||||
} QRRawCode;
|
||||
|
||||
extern QRRawCode *QRraw_new(QRinput *input);
|
||||
extern unsigned char QRraw_getCode(QRRawCode *raw);
|
||||
extern void QRraw_free(QRRawCode *raw);
|
||||
|
||||
/******************************************************************************
|
||||
* Raw code for Micro QR Code
|
||||
*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
int version;
|
||||
int dataLength;
|
||||
int eccLength;
|
||||
unsigned char *datacode;
|
||||
unsigned char *ecccode;
|
||||
RSblock *rsblock;
|
||||
int oddbits;
|
||||
int count;
|
||||
} MQRRawCode;
|
||||
|
||||
extern MQRRawCode *MQRraw_new(QRinput *input);
|
||||
extern unsigned char MQRraw_getCode(MQRRawCode *raw);
|
||||
extern void MQRraw_free(MQRRawCode *raw);
|
||||
|
||||
/******************************************************************************
|
||||
* Frame filling
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* QR-code encoding
|
||||
*****************************************************************************/
|
||||
extern QRcode *QRcode_encodeMask(QRinput *input, int mask);
|
||||
extern QRcode *QRcode_encodeMaskMQR(QRinput *input, int mask);
|
||||
extern QRcode *QRcode_new(int version, int width, unsigned char *data);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __QRENCODE_INNER_H__ */
|
132
code/application/source/sf_app/code/include/qrinput.h
Executable file
132
code/application/source/sf_app/code/include/qrinput.h
Executable file
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Input data chunk class
|
||||
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __QRINPUT_H__
|
||||
#define __QRINPUT_H__
|
||||
|
||||
#include "qrencode.h"
|
||||
#include "bitstream.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int QRinput_isSplittableMode(QRencodeMode mode);
|
||||
|
||||
/******************************************************************************
|
||||
* Entry of input data
|
||||
*****************************************************************************/
|
||||
typedef struct _QRinput_List QRinput_List;
|
||||
|
||||
struct _QRinput_List {
|
||||
QRencodeMode mode;
|
||||
int size; ///< Size of data chunk (byte).
|
||||
unsigned char *data; ///< Data chunk.
|
||||
BitStream *bstream;
|
||||
QRinput_List *next;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Input Data
|
||||
*****************************************************************************/
|
||||
struct _QRinput {
|
||||
int version;
|
||||
QRecLevel level;
|
||||
QRinput_List *head;
|
||||
QRinput_List *tail;
|
||||
int mqr;
|
||||
int fnc1;
|
||||
unsigned char appid;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Structured append input data
|
||||
*****************************************************************************/
|
||||
typedef struct _QRinput_InputList QRinput_InputList;
|
||||
|
||||
struct _QRinput_InputList {
|
||||
QRinput *input;
|
||||
QRinput_InputList *next;
|
||||
};
|
||||
|
||||
struct _QRinput_Struct {
|
||||
int size; ///< number of structured symbols
|
||||
int parity;
|
||||
QRinput_InputList *head;
|
||||
QRinput_InputList *tail;
|
||||
};
|
||||
|
||||
/**
|
||||
* Pack all bit streams padding bits into a byte array.
|
||||
* @param input input data.
|
||||
* @return padded merged byte stream
|
||||
*/
|
||||
extern unsigned char *QRinput_getByteStream(QRinput *input);
|
||||
|
||||
|
||||
extern int QRinput_estimateBitsModeNum(int size);
|
||||
extern int QRinput_estimateBitsModeAn(int size);
|
||||
extern int QRinput_estimateBitsMode8(int size);
|
||||
extern int QRinput_estimateBitsModeKanji(int size);
|
||||
|
||||
extern QRinput *QRinput_dup(QRinput *input);
|
||||
|
||||
extern const signed char QRinput_anTable[128];
|
||||
|
||||
/**
|
||||
* Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19).
|
||||
* @param __c__ character
|
||||
* @return value
|
||||
*/
|
||||
#define QRinput_lookAnTable(__c__) \
|
||||
((__c__ & 0x80)?-1:QRinput_anTable[(int)__c__])
|
||||
|
||||
/**
|
||||
* Length of a standard mode indicator in bits.
|
||||
*/
|
||||
|
||||
#define MODE_INDICATOR_SIZE 4
|
||||
|
||||
/**
|
||||
* Length of a segment of structured-append header.
|
||||
*/
|
||||
#define STRUCTURE_HEADER_SIZE 20
|
||||
|
||||
/**
|
||||
* Maximum number of symbols in a set of structured-appended symbols.
|
||||
*/
|
||||
#define MAX_STRUCTURED_SYMBOLS 16
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
extern BitStream *QRinput_mergeBitStream(QRinput *input);
|
||||
extern BitStream *QRinput_getBitStream(QRinput *input);
|
||||
extern int QRinput_estimateBitStreamSize(QRinput *input, int version);
|
||||
extern int QRinput_lengthOfCode(QRencodeMode mode, int version, int bits);
|
||||
extern int QRinput_insertStructuredAppendHeader(QRinput *input, int size, int index, unsigned char parity);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __QRINPUT_H__ */
|
190
code/application/source/sf_app/code/include/qrspec.h
Executable file
190
code/application/source/sf_app/code/include/qrspec.h
Executable file
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* QR Code specification in convenient format.
|
||||
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __QRSPEC_H__
|
||||
#define __QRSPEC_H__
|
||||
|
||||
#include "qrencode.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* Version and capacity
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Maximum width of a symbol
|
||||
*/
|
||||
#define QRSPEC_WIDTH_MAX 177
|
||||
|
||||
/**
|
||||
* Return maximum data code length (bytes) for the version.
|
||||
* @param version
|
||||
* @param level
|
||||
* @return maximum size (bytes)
|
||||
*/
|
||||
extern int QRspec_getDataLength(int version, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Return maximum error correction code length (bytes) for the version.
|
||||
* @param version
|
||||
* @param level
|
||||
* @return ECC size (bytes)
|
||||
*/
|
||||
extern int QRspec_getECCLength(int version, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Return a version number that satisfies the input code length.
|
||||
* @param size input code length (byte)
|
||||
* @param level
|
||||
* @return version number
|
||||
*/
|
||||
extern int QRspec_getMinimumVersion(int size, QRecLevel level);
|
||||
|
||||
/**
|
||||
* Return the width of the symbol for the version.
|
||||
* @param version
|
||||
* @return width
|
||||
*/
|
||||
extern int QRspec_getWidth(int version);
|
||||
|
||||
/**
|
||||
* Return the numer of remainder bits.
|
||||
* @param version
|
||||
* @return number of remainder bits
|
||||
*/
|
||||
extern int QRspec_getRemainder(int version);
|
||||
|
||||
/******************************************************************************
|
||||
* Length indicator
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Return the size of lenght indicator for the mode and version.
|
||||
* @param mode
|
||||
* @param version
|
||||
* @return the size of the appropriate length indicator (bits).
|
||||
*/
|
||||
extern int QRspec_lengthIndicator(QRencodeMode mode, int version);
|
||||
|
||||
/**
|
||||
* Return the maximum length for the mode and version.
|
||||
* @param mode
|
||||
* @param version
|
||||
* @return the maximum length (bytes)
|
||||
*/
|
||||
extern int QRspec_maximumWords(QRencodeMode mode, int version);
|
||||
|
||||
/******************************************************************************
|
||||
* Error correction code
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Return an array of ECC specification.
|
||||
* @param version
|
||||
* @param level
|
||||
* @param spec an array of ECC specification contains as following:
|
||||
* {# of type1 blocks, # of data code, # of ecc code,
|
||||
* # of type2 blocks, # of data code}
|
||||
*/
|
||||
void QRspec_getEccSpec(int version, QRecLevel level, int spec[5]);
|
||||
|
||||
#define QRspec_rsBlockNum(__spec__) (__spec__[0] + __spec__[3])
|
||||
#define QRspec_rsBlockNum1(__spec__) (__spec__[0])
|
||||
#define QRspec_rsDataCodes1(__spec__) (__spec__[1])
|
||||
#define QRspec_rsEccCodes1(__spec__) (__spec__[2])
|
||||
#define QRspec_rsBlockNum2(__spec__) (__spec__[3])
|
||||
#define QRspec_rsDataCodes2(__spec__) (__spec__[4])
|
||||
#define QRspec_rsEccCodes2(__spec__) (__spec__[2])
|
||||
|
||||
#define QRspec_rsDataLength(__spec__) \
|
||||
((QRspec_rsBlockNum1(__spec__) * QRspec_rsDataCodes1(__spec__)) + \
|
||||
(QRspec_rsBlockNum2(__spec__) * QRspec_rsDataCodes2(__spec__)))
|
||||
#define QRspec_rsEccLength(__spec__) \
|
||||
(QRspec_rsBlockNum(__spec__) * QRspec_rsEccCodes1(__spec__))
|
||||
|
||||
/******************************************************************************
|
||||
* Version information pattern
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Return BCH encoded version information pattern that is used for the symbol
|
||||
* of version 7 or greater. Use lower 18 bits.
|
||||
* @param version
|
||||
* @return BCH encoded version information pattern
|
||||
*/
|
||||
extern unsigned int QRspec_getVersionPattern(int version);
|
||||
|
||||
/******************************************************************************
|
||||
* Format information
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Return BCH encoded format information pattern.
|
||||
* @param mask
|
||||
* @param level
|
||||
* @return BCH encoded format information pattern
|
||||
*/
|
||||
extern unsigned int QRspec_getFormatInfo(int mask, QRecLevel level);
|
||||
|
||||
/******************************************************************************
|
||||
* Frame
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Return a copy of initialized frame.
|
||||
* When the same version is requested twice or more, a copy of cached frame
|
||||
* is returned.
|
||||
* @param version
|
||||
* @return Array of unsigned char. You can free it by free().
|
||||
*/
|
||||
extern unsigned char *QRspec_newFrame(int version);
|
||||
|
||||
/**
|
||||
* Clear the frame cache. Typically for debug.
|
||||
*/
|
||||
extern void QRspec_clearCache(void);
|
||||
|
||||
/******************************************************************************
|
||||
* Mode indicator
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Mode indicator. See Table 2 of JIS X0510:2004, pp.16.
|
||||
*/
|
||||
#define QRSPEC_MODEID_ECI 7
|
||||
#define QRSPEC_MODEID_NUM 1
|
||||
#define QRSPEC_MODEID_AN 2
|
||||
#define QRSPEC_MODEID_8 4
|
||||
#define QRSPEC_MODEID_KANJI 8
|
||||
#define QRSPEC_MODEID_FNC1FIRST 5
|
||||
#define QRSPEC_MODEID_FNC1SECOND 9
|
||||
#define QRSPEC_MODEID_STRUCTURE 3
|
||||
#define QRSPEC_MODEID_TERMINATOR 0
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif /* __QRSPEC_H__ */
|
51
code/application/source/sf_app/code/include/rscode.h
Executable file
51
code/application/source/sf_app/code/include/rscode.h
Executable file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Reed solomon encoder. This code is taken from Phil Karn's libfec then
|
||||
* editted and packed into a pair of .c and .h files.
|
||||
*
|
||||
* Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
|
||||
* (libfec is released under the GNU Lesser General Public License.)
|
||||
*
|
||||
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __RSCODE_H__
|
||||
#define __RSCODE_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* General purpose RS codec, 8-bit symbols.
|
||||
*/
|
||||
|
||||
typedef struct _RS RS;
|
||||
|
||||
extern RS *init_rs(int symsize, int gfpoly, int fcr, int prim, int nroots, int pad);
|
||||
extern void encode_rs_char(RS *rs, const unsigned char *data, unsigned char *parity);
|
||||
extern void free_rs_char(RS *rs);
|
||||
extern void free_rs_cache(void);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __RSCODE_H__ */
|
34
code/application/source/sf_app/code/include/sf_aes.h
Executable file
34
code/application/source/sf_app/code/include/sf_aes.h
Executable file
|
@ -0,0 +1,34 @@
|
|||
#ifndef __SF_AES_H
|
||||
#define __SF_AES_H
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_type.h"
|
||||
|
||||
|
||||
//UINT32 sf_cipher(UINT32 aesType,UINT8 operation,UINT8 *input,UINT8 *output);
|
||||
UINT32 sf_cipher(UINT32 aesType,UINT8 operation,UINT8 *input,UINT8 *output, UINT8 srcl);
|
||||
|
||||
|
||||
|
||||
extern void sf_cipher_test(void);
|
||||
extern void sf_cipher_test1(void);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
47
code/application/source/sf_app/code/include/sf_bmp.h
Executable file
47
code/application/source/sf_app/code/include/sf_bmp.h
Executable file
|
@ -0,0 +1,47 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015-2020 by WuYuan Technology, Inc.
|
||||
*
|
||||
* This software is copyrighted by and is the property of SiFar
|
||||
* Technology, Inc.. All rights are reserved by SiFar Technology, Inc..
|
||||
* This software may only be used in accordance with the corresponding
|
||||
* license agreement. Any unauthorized use, duplication, distribution,
|
||||
* or disclosure of this software is expressly forbidden.
|
||||
*
|
||||
* This Copyright notice MUST not be removed or modified without prior
|
||||
* written consent of SiFar Technology, Inc..
|
||||
*
|
||||
* WuYuan Technology, Inc. reserves the right to modify this software without notice.
|
||||
*
|
||||
* Author: jiamin
|
||||
* Ver: 1.0.0 2021.04.15
|
||||
* Description: creat
|
||||
**************************************************************************/
|
||||
#ifndef _SF_BMP_H_
|
||||
#define _SF_BMP_H_
|
||||
#include "qrencode.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct sfBMP_DATA_S
|
||||
{
|
||||
int width; //width of the symbol
|
||||
int height; //height of the symbol
|
||||
unsigned char *data; //symbol data
|
||||
|
||||
} SF_BMP_DATA_S;
|
||||
|
||||
|
||||
int sf_qrcode_bmpfile_write(QRcode *DataInfo, const char *outfile, int magnification);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
39
code/application/source/sf_app/code/include/sf_commMng.h
Executable file
39
code/application/source/sf_app/code/include/sf_commMng.h
Executable file
|
@ -0,0 +1,39 @@
|
|||
#ifndef __SF_COMMMNG_H__
|
||||
#define __SF_COMMMNG_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
|
||||
|
||||
|
||||
SINT32 sf_sem_init(SF_CHAR *pathname,SINT32 *psemid);
|
||||
|
||||
SINT32 sf_sem_down(SINT32 semid, SINT32 who);
|
||||
|
||||
SINT32 sf_sem_up(SINT32 semid, SINT32 who);
|
||||
|
||||
SINT32 sf_sem_deinit(SINT32 semid);
|
||||
|
||||
SINT32 sf_share_mem_file_init(void);
|
||||
|
||||
SINT32 sf_share_mem_file_deinit(void);
|
||||
|
||||
SINT32 sf_share_mem_customer_init(void);
|
||||
|
||||
SINT32 sf_share_mem_customer_deinit(void);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
69
code/application/source/sf_app/code/include/sf_commu_mcu.h
Executable file
69
code/application/source/sf_app/code/include/sf_commu_mcu.h
Executable file
|
@ -0,0 +1,69 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015-2020 by WuYuan Technology, Inc.
|
||||
*
|
||||
* This software is copyrighted by and is the property of SiFar
|
||||
* Technology, Inc.. All rights are reserved by SiFar Technology, Inc..
|
||||
* This software may only be used in accordance with the corresponding
|
||||
* license agreement. Any unauthorized use, duplication, distribution,
|
||||
* or disclosure of this software is expressly forbidden.
|
||||
*
|
||||
* This Copyright notice MUST not be removed or modified without prior
|
||||
* written consent of SiFar Technology, Inc..
|
||||
*
|
||||
* WuYuan Technology, Inc. reserves the right to modify this software without notice.
|
||||
*
|
||||
* Author: ljy
|
||||
* Ver: 1.0.0 2022.06.15
|
||||
* Description: creat
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef __SF_COMMU_MCU_H
|
||||
#define __SF_COMMU_MCU_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif // __cplusplus
|
||||
#include <sf_commu_mcu_reg.h>
|
||||
|
||||
#define SERIAL_DEVICE_PATH "/dev/ttyS2"
|
||||
#define BUF_REG_SIZE (REG_SIZE*2+8)
|
||||
|
||||
typedef struct {
|
||||
unsigned char buf[BUF_REG_SIZE];
|
||||
unsigned int index;
|
||||
}SMAPBUF_t;
|
||||
|
||||
|
||||
void mcubuf_reset(void);
|
||||
int sf_commu_mcu_interface_init(int speed, char flow_ctrl, int databits, int stopbits, char parity);
|
||||
int sf_commu_mcu_open(void);
|
||||
int sf_commu_mcu_close(void);
|
||||
int sf_commu_write(unsigned char * buf, int len);
|
||||
int sf_commu_read(unsigned char * buf, int len);
|
||||
int sf_set_mcu_reg(unsigned char reg, unsigned char val);
|
||||
int sf_get_mcu_reg(unsigned char reg);
|
||||
unsigned int sf_set_mcu_reg_ack_depack(unsigned int * address, unsigned int * value);
|
||||
unsigned int sf_get_mcu_reg_ack_depack(unsigned int * address, unsigned int * value);
|
||||
int sf_commu_wait(unsigned char cmd);
|
||||
void sf_commu_reset(void);
|
||||
int sf_commu_set_mcu(unsigned char reg, unsigned char val);
|
||||
int sf_commu_get_mcu(unsigned char reg);
|
||||
int sf_getRegFromMcu_depack(unsigned char * dataToParse, unsigned int datalen, unsigned char * regAddr, unsigned char * regVal);
|
||||
int sf_getRegFromMcu_ack(unsigned char regAddr, unsigned char regVal);
|
||||
unsigned char sf_commu_parse_mcu_data(unsigned char * src, unsigned int len);
|
||||
void sf_commu_mcu_task_start(void);
|
||||
void sf_commu_mcu_task_stop(void);
|
||||
unsigned char sf_commu_mcu_task_running(void);
|
||||
unsigned int sf_get_mcu_reg_ack_depack_many(unsigned char reg[], unsigned char val[], unsigned int * num);
|
||||
int sf_set_mcu_reg_many(unsigned char reg[], unsigned char val[], unsigned int num);
|
||||
int sf_get_mcu_reg_many(unsigned char reg[], unsigned int num);
|
||||
int sf_commu_set_mcu_many(unsigned char reg[], unsigned char val[], unsigned int *num);
|
||||
int sf_commu_get_mcu_many(unsigned char reg[], unsigned char val[], unsigned int *num);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
|
||||
#endif
|
349
code/application/source/sf_app/code/include/sf_commu_mcu_reg.h
Executable file
349
code/application/source/sf_app/code/include/sf_commu_mcu_reg.h
Executable file
|
@ -0,0 +1,349 @@
|
|||
#ifndef __SF_COMMU_MCU_REG_H
|
||||
#define __SF_COMMU_MCU_REG_H
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2009-2018 by SiFar Technology, Inc.
|
||||
*
|
||||
* This software is copyrighted by and is the property of SiFar
|
||||
* Technology, Inc.. All rights are reserved by SiFar Technology, Inc..
|
||||
* This software may only be used in accordance with the corresponding
|
||||
* license agreement. Any unauthorized use, duplication, distribution,
|
||||
* or disclosure of this software is expressly forbidden.
|
||||
*
|
||||
* This Copyright notice MUST not be removed or modified without prior
|
||||
* written consent of SiFar Technology, Inc..
|
||||
*
|
||||
* SiFar Technology, Inc. reserves the right to modify this software without notice.
|
||||
*
|
||||
* Author: oliver
|
||||
* Ver: 1.0.0 2019.06.06
|
||||
* Description:
|
||||
**************************************************************************/
|
||||
#ifndef _SF_MCU_H_
|
||||
#define _SF_MCU_H_
|
||||
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
|
||||
|
||||
#define DIGITAL_PIR 1
|
||||
|
||||
#define REG_SIZE 91
|
||||
|
||||
#define SF_MCU_NIGHT_MODE_LUMINANCE 380
|
||||
|
||||
/*REG POWER_OFFON*/
|
||||
#define MCU_MODE_AUTO 0x00
|
||||
#define MCU_MODE_OFF 0x40
|
||||
#define MCU_MODE_SETUP 0x80
|
||||
|
||||
#define PWR_OFF 0x00
|
||||
#define PWR_ON_SETUP 0x01
|
||||
#define PWR_ON_TIMELAPSE 0x02
|
||||
#define PWR_ON_AUTO 0x03
|
||||
#define PWR_ON_SMS 0x04
|
||||
#define PWR_ON_PIR 0x05
|
||||
#define PWR_ON_LBAT 0x06
|
||||
#define PWR_ON_SERVER 0x07
|
||||
#define PWR_ON_DAILY_REPORT 0x08
|
||||
#define PWR_ON_USB 0x09
|
||||
#define PWR_ON_GPRS_INIT 0x0A
|
||||
#define PWR_ON_TIME_SYNC 0x0B
|
||||
#define PWR_ON_TIME_SEND 0x0C
|
||||
|
||||
/*REG FUNCTION_SWTICH*/
|
||||
#define PIR_OFF 0x00
|
||||
#define PIR_ON 0x01
|
||||
#define TIMELAPSE_ON 0x02
|
||||
#define PIR_DELAY_ON 0x04
|
||||
#define TIME_SYNC_ON 0x08
|
||||
#define DAILY_REPORT_ON 0x10
|
||||
#define DAILY_SEND1_ON 0x20
|
||||
#define DAILY_SEND2_ON 0x40
|
||||
#define GPS_ALWAYS_ON 0x80
|
||||
|
||||
/*REG FUNCTION_SWTICH1*/
|
||||
#define DAILY_SEND3_ON 0x01
|
||||
#define DAILY_SEND4_ON 0x02
|
||||
|
||||
/*REG FUNCTION_SWTICH2*/
|
||||
#define WDT_OFF 0x01
|
||||
#define DEBUG_MODE_ON 0x02
|
||||
|
||||
/*REG GPS_POWER_TIMER_CLEAR */
|
||||
#define GPS_COUNTDOWM_RESET 0x01
|
||||
|
||||
/*REG GPS_POWER_CTRL */
|
||||
#define GPS_PWR_ON 0x01
|
||||
|
||||
/*REG PIR_SENSITIVITY*/
|
||||
#define DIGITAL_PIR_SENSITIVITY_MASK 0xFF
|
||||
#define GPRS_ON 0x80
|
||||
#define GPRS_MODE_MASK 0x60
|
||||
#define GPRS_DAILY 0x00
|
||||
#define GPRS_INSTANT 0x40
|
||||
#define GPRS_HYBRID 0x20
|
||||
#define TIME_SYNC_RESET 0x10
|
||||
#define PIR_SEN_HIGH 0x00
|
||||
#define PIR_SEN_MIDDLE 0x01
|
||||
#define PIR_SEN_LOW 0x02
|
||||
|
||||
/*REG DSP_BUSY*/
|
||||
#define DSP_BUSY 0x01
|
||||
#define DSP_IDLE 0x00
|
||||
|
||||
/*REG SYS_STATUS*/
|
||||
#define SYS_SD_INSERT 0x01
|
||||
#define SYS_MENORY_FULL 0x02
|
||||
#define SYS_USB_INSERT 0x04
|
||||
#define SYS_SOFT_UPDATE 0x08
|
||||
#define GPRS_RESTART 0x10
|
||||
#define POWER_CYCLE 0x20
|
||||
#define SYS_CAM_OFF 0x40
|
||||
#define PIR_RESTART 0x80
|
||||
|
||||
/*REG POWEROFF_TYPE*/
|
||||
#define PWROFF_NOUSE 0x00
|
||||
#define PWROFF_GPRS_INIT 0x01
|
||||
#define PWROFF_SMS_RESTART 0x02
|
||||
#define PWROFF_LBAT 0x40
|
||||
#define PWROFF_TIMEOUT 0x80
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MCU_SUB_VER = 0,
|
||||
MCU_VER_L = 1,
|
||||
MCU_VER_H = 2,
|
||||
MCU_PRODUCT_INFO = 3,
|
||||
START_MODE = 4,
|
||||
LUMINANCE_L = 5,
|
||||
LUMINANCE_H = 6,
|
||||
RESERVER1 = 7,
|
||||
|
||||
SF_RTC_YEAR = 8,
|
||||
SF_RTC_MONTH = 9,
|
||||
SF_RTC_DAY = 10,
|
||||
SF_RTC_HOUR = 11,
|
||||
SF_RTC_MINUTE = 12,
|
||||
SF_RTC_SEC = 13,
|
||||
SF_RTC_WEEK = 14,
|
||||
FUNCTION_SWTICH0 = 15,
|
||||
FUNCTION_SWTICH1 = 16,
|
||||
FUNCTION_SWTICH2 = 17,
|
||||
RESERVER2 = 18,
|
||||
|
||||
GPS_POWER_TIMER_CLEAR = 19,
|
||||
GPS_POWER_CTRL = 20,
|
||||
ANALOG_PIR_SENSITIVITY = 21,
|
||||
DIGITAL_PIR_SENSITIVITY= 22,
|
||||
DIGITAL_PIR_CFG = 23,
|
||||
DSP_BUSY_STATUS = 24,
|
||||
SYS_STATUS = 25,
|
||||
RESERVER3 = 26,
|
||||
|
||||
POWEROFF_TYPE = 27,
|
||||
WDT_TIME = 28,
|
||||
VBAT_LOW_WARN_VAL = 29,
|
||||
VBAT_RECOVER_VAL = 30,
|
||||
RESERVER4 = 31,
|
||||
|
||||
TIMELAPSE_HOUR = 32,
|
||||
TIMELAPSE_MINUTE = 33,
|
||||
TIMELAPSE_SEC = 34,
|
||||
PIR_DELAY_HOUR = 35,
|
||||
PIR_DELAY_MINUTE = 36,
|
||||
PIR_DELAY_SEC = 37,
|
||||
TIME_SYNC_HOUR = 38,
|
||||
TIME_SYNC_MINUTE = 39,
|
||||
TIME_SYNC_SEC = 40,
|
||||
DAILY_REPORT_HOUR = 41,
|
||||
DAILY_REPORT_MINUTE = 42,
|
||||
DAILY_SEND1_HOUR = 43,
|
||||
DAILY_SEND1_MINUTE = 44,
|
||||
DAILY_SEND2_HOUR = 45,
|
||||
DAILY_SEND2_MINUTE = 46,
|
||||
DAILY_SEND3_HOUR = 47,
|
||||
DAILY_SEND3_MINUTE = 48,
|
||||
DAILY_SEND4_HOUR = 49,
|
||||
DAILY_SEND4_MINUTE = 50,
|
||||
RESERVER5 = 51,
|
||||
RESERVER6 = 52,
|
||||
RESERVER7 = 53,
|
||||
|
||||
WORKTIME1_SWITCH = 54,
|
||||
WORKTIME1_START_HOUR = 55,
|
||||
WORKTIME1_START_MINUTE = 56,
|
||||
WORKTIME1_STOP_HOUR = 57,
|
||||
WORKTIME1_STOP_MINUTE = 58,
|
||||
|
||||
WORKTIME2_SWITCH = 59,
|
||||
WORKTIME2_START_HOUR = 60,
|
||||
WORKTIME2_START_MINUTE = 61,
|
||||
WORKTIME2_STOP_HOUR = 62,
|
||||
WORKTIME2_STOP_MINUTE = 63,
|
||||
|
||||
WORKTIME3_SWITCH = 64,
|
||||
WORKTIME3_START_HOUR = 65,
|
||||
WORKTIME3_START_MINUTE = 66,
|
||||
WORKTIME3_STOP_HOUR = 67,
|
||||
WORKTIME3_STOP_MINUTE = 68,
|
||||
|
||||
WORKTIME4_SWITCH = 69,
|
||||
WORKTIME4_START_HOUR = 70,
|
||||
WORKTIME4_START_MINUTE = 71,
|
||||
WORKTIME4_STOP_HOUR = 72,
|
||||
WORKTIME4_STOP_MINUTE = 73,
|
||||
|
||||
WORKTIME5_SWITCH = 74,
|
||||
WORKTIME5_START_HOUR = 75,
|
||||
WORKTIME5_START_MINUTE = 76,
|
||||
WORKTIME5_STOP_HOUR = 77,
|
||||
WORKTIME5_STOP_MINUTE = 78,
|
||||
|
||||
WORKTIME6_SWITCH = 79,
|
||||
WORKTIME6_START_HOUR = 80,
|
||||
WORKTIME6_START_MINUTE = 81,
|
||||
WORKTIME6_STOP_HOUR = 82,
|
||||
WORKTIME6_STOP_MINUTE = 83,
|
||||
|
||||
DSP_WRITE_FLG = 84,
|
||||
|
||||
RESERVER8 = 85,
|
||||
RESERVER9 = 86,
|
||||
RESERVER10 = 87,
|
||||
RESERVER11 = 88,
|
||||
RESERVER12 = 89,
|
||||
RESERVER13 = 90,
|
||||
}PARA_REG;
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
POWEROFF_COUNTDOWN = 1,
|
||||
POWEROFF_PVDOWN,
|
||||
POWEROFF_KEYDOWN,
|
||||
POWEROFF_KEYREBOOT,
|
||||
POWEROFF_GPRSREBOOT,
|
||||
POWEROFF_KEYOFF
|
||||
}POWEROFF_MODE;
|
||||
|
||||
|
||||
typedef enum {
|
||||
SF_MCU_STARTMODE = 0,
|
||||
SF_MCU_POWERON,
|
||||
SF_MCU_POWEROFF,
|
||||
SF_MCU_CTRL_MODULE_PIR,
|
||||
SF_MCU_PARA,
|
||||
SF_MCU_RESET_MODULE,
|
||||
SF_MCU_SOFT_UPDATE,
|
||||
SF_MCU_POWER_RESTART,
|
||||
SF_MCU_PIR_RESTART,
|
||||
SF_MCU_TEST_PIR,
|
||||
SF_MCU_PARAM_MAX
|
||||
} MCUParam_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
TRIG_MOTION = 1,
|
||||
TRIG_TIMELAPSE,
|
||||
TRIG_SETUP,
|
||||
TRIG_COMMOND,
|
||||
}TRIG_TYPE;
|
||||
|
||||
|
||||
typedef enum {
|
||||
WORKING_TIME_0 = 0,
|
||||
WORKING_TIME_1,
|
||||
WORKING_TIME_2,
|
||||
WORKING_TIME_3,
|
||||
WORKING_TIME_4,
|
||||
WORKING_TIME_5,
|
||||
WORKING_TIME_ALL = 0xff,
|
||||
}WORKING_TIME_TYPE;
|
||||
#if 0
|
||||
typedef enum sfMCU_STARTUP_TYPE_E
|
||||
{
|
||||
SF_MCU_STARTUP_OFF = 0x00,/* POWER OFF*/
|
||||
SF_MCU_STARTUP_ONKEY = 0x01,/*key on SETUP*/
|
||||
SF_MCU_STARTUP_TIMELAPSE = 0x02,/*timelapse power on*/
|
||||
SF_MCU_STARTUP_NORMAL = 0x03,/*Dial the key to ON*/
|
||||
SF_MCU_STARTUP_RING = 0x04,/*ring power on*/
|
||||
SF_MCU_STARTUP_PIR = 0x05,/*pir power on*/
|
||||
SF_MCU_STARTUP_WARNING = 0x06,/*low bat worning power on*/
|
||||
SF_MCU_STARTUP_SERVER = 0x07,/*server power on(reserve)*/
|
||||
SF_MCU_STARTUP_DP = 0x08,/*DailyReport power on*/
|
||||
SF_MCU_STARTUP_USB = 0x09,/*USB power on*/
|
||||
SF_MCU_STARTUP_RESET = 0x0A,/*power on to reset(reserve)*/
|
||||
SF_MCU_STARTUP_SYN_PARAM = 0x0B,/*power on to syn param(reserve)*/
|
||||
SF_MCU_STARTUP_BATCH_SEND= 0x0C,/*power on to send batch*/
|
||||
SF_MCU_STARTUP_BUTT = 0X0D,
|
||||
} SF_STARTUP_TYPE_E;
|
||||
|
||||
typedef enum sfPOWEROFF_TYPE_E
|
||||
{
|
||||
SF_POWEROFF_NORMAL = 0x00,
|
||||
SF_POWEROFF_AUTO = 0x01, /*auto power when 3min no operation*/
|
||||
SF_POWEROFF_REBOOT = 0x02, /*poweroff to reboot*/
|
||||
SF_POWEROFF_KEYON = 0x03,
|
||||
SF_POWEROFF_KEYOFF = 0x04,
|
||||
SF_POWEROFF_SYNC_PARAM = 0x05,
|
||||
SF_POWEROFF_GPS_DP = 0x06,
|
||||
SF_POWEROFF_SD_FULL = 0x07,
|
||||
SF_POWEROFF_LOW_BAT = 0x08,
|
||||
SF_POWEROFF_NO_SD = 0x09,
|
||||
SF_POWEROFF_BUTT,
|
||||
} SF_POWEROFF_TYPE_E;
|
||||
#endif
|
||||
typedef struct sf_TIME_S {
|
||||
unsigned short Year; /* Year > 1970*/
|
||||
unsigned short Mon; /* Mon range[1-12]*/
|
||||
unsigned short Day; /*Day range[1-31]*/
|
||||
unsigned short Hour; /*Hour range[0-23]*/
|
||||
unsigned short Min; /*Min range[0-59]*/
|
||||
unsigned short Sec; /*Sec range[0-59]*/
|
||||
} SF_TIME_S;
|
||||
|
||||
unsigned char sf_mcu_power_on_para_get (MCUParam_t attrId);
|
||||
unsigned char sf_mcu_wdg_set(unsigned char value);
|
||||
void sf_mcu_poweron_4g_module(void);
|
||||
unsigned char sf_mcu_start_mode_get(void);
|
||||
|
||||
SF_BOOL sf_is_night_mode(unsigned int isRefresh);
|
||||
unsigned char sf_mcu_rtc_get (SF_TIME_S *time);
|
||||
unsigned char sf_mcu_reg_set(MCUParam_t attrId, unsigned char val);
|
||||
void sf_set_mcu_sub_ver(unsigned char mcuSubVersion);
|
||||
void sf_set_mcu_ver(unsigned short mcuVersion);
|
||||
unsigned short sf_get_light_value(void);
|
||||
unsigned char sf_get_mcu_sub_ver(void);
|
||||
unsigned short sf_get_mcu_ver(void);
|
||||
|
||||
int sf_get_ae_shutter(void);
|
||||
int sf_get_ae_sensor_gain(void);
|
||||
|
||||
|
||||
int sf_set_ae_shutter(unsigned int value);
|
||||
|
||||
int sf_set_ae_sensor_gain(unsigned int value);
|
||||
|
||||
|
||||
int sf_set_cur_light_val(unsigned int value);
|
||||
|
||||
int sf_get_last_light_val(void);
|
||||
SF_TIME_S sf_get_mcu_poweroff_date(void);
|
||||
void sf_set_mcu_poweroff_date(SF_PARA_TIME_S date);
|
||||
|
||||
|
||||
extern unsigned char PowerOnMode;
|
||||
extern unsigned short TrigType;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
90
code/application/source/sf_app/code/include/sf_dataMng.h
Executable file
90
code/application/source/sf_app/code/include/sf_dataMng.h
Executable file
|
@ -0,0 +1,90 @@
|
|||
|
||||
#ifndef __SF_DATA_PROC_H__
|
||||
#define __SF_DATA_PROC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
|
||||
|
||||
typedef enum SF_CMD_QUERYPENDING_E {
|
||||
|
||||
SF_CMD_QUERYPENDING_GETCFGFILE = 0X2000,
|
||||
SF_CMD_QUERYPENDING_GETPICTURE = 0X2002,
|
||||
SF_CMD_QUERYPENDING_GETSTATUS = 0X2004,
|
||||
SF_CMD_QUERYPENDING_GETSLEEPTIME = 0X2006,
|
||||
SF_CMD_QUERYPENDING_REBOOT = 0X2008,
|
||||
SF_CMD_QUERYPENDING_SETSYSTEMTIME = 0X200A,
|
||||
SF_CMD_QUERYPENDING_SETCAMERAMODE = 0X200C,
|
||||
SF_CMD_QUERYPENDING_SETWORKMODE = 0X200E,
|
||||
SF_CMD_QUERYPENDING_SETOTHER = 0X2010,
|
||||
SF_CMD_QUERYPENDING_SETSERVER = 0X2012,
|
||||
SF_CMD_QUERYPENDING_UPLOADCFGFILE = 0X2014,
|
||||
SF_CMD_QUERYPENDING_GETCAMERAMODE = 0X2016,
|
||||
SF_CMD_QUERYPENDING_GETMODECFG = 0X2018,
|
||||
SF_CMD_QUERYPENDING_GETOTHERCFG = 0X201A,
|
||||
SF_CMD_QUERYPENDING_GETSERVERPAREAM = 0X201C,
|
||||
SF_CMD_QUERYPENDING_SETUPLOADPICSIZE = 0X201E,
|
||||
SF_CMD_QUERYPENDING_GETUPLOADPICSIZE = 0X2020,
|
||||
SF_CMD_QUERYPENDING_SYNPARAM = 0X2022,
|
||||
SF_CMD_QUERYPENDING_VERSIONUPDATE = 0X2024,
|
||||
SF_CMD_QUERYPENDING_GETGPSINFO = 0X2026,
|
||||
SF_CMD_QUERYPENDING_SETGPSANTITHIEF = 0X2028,
|
||||
|
||||
SF_QUERYPENDING_COMMAND_RESET = 0X202A,
|
||||
SF_QUERYPENDING_COMMAND_GETPICFLAG = 0X202C,
|
||||
SF_QUERYPENDING_COMMAND_FORMAT = 0X202E,
|
||||
SF_QUERYPENDING_COMMAND_BUTT = 0X2030,
|
||||
|
||||
|
||||
}SF_CMD_QUERYPENDING_E;
|
||||
UINT16 crcCheck( UINT8 strContent[],UINT16 usDataLen,UINT16 crc);
|
||||
UINT16 makeCrc(UINT8 strContent[], UINT16 len);
|
||||
|
||||
void sf_data_subscribe_result_set(UINT16 ret);
|
||||
|
||||
UINT8 sf_data_has_command_get(void);
|
||||
|
||||
UINT8 sf_data_transfer_mode_get(void);
|
||||
|
||||
SINT32 sf_data_cam_local_time_get(SF_PARA_TIME_S* pstdata);
|
||||
|
||||
UINT32 sf_data_pendingcmd_get(void);
|
||||
|
||||
|
||||
SINT32 sf_data_grouping_login(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam);
|
||||
SINT32 sf_data_grouping_fileresult(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam,SF_VOID *pstfileAttr);
|
||||
|
||||
SINT32 sf_data_grouping_disconnection(SF_DATA_ATTR_S *pstdata,SF_VOID *Param);
|
||||
SINT32 sf_data_grouping_query_cmd(SF_DATA_ATTR_S *pstdata);
|
||||
SINT32 sf_data_grouping_query_cmd_param(SF_DATA_ATTR_S *pstdata);
|
||||
SINT32 sf_data_grouping_cmd_report(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam, SF_FILE_ATTR_S *pstfileAttr);
|
||||
SINT32 sf_data_grouping_get_bind_account(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam);
|
||||
SINT32 sf_data_grouping_sync_cfg(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_data_analysis_login(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam);
|
||||
SINT32 sf_data_analysis_fileresult(SF_DATA_ATTR_S *param);
|
||||
SINT32 sf_data_analysis_query_cmd(SF_DATA_ATTR_S *param);
|
||||
SINT32 sf_data_analysis_query_cmd_param(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam);
|
||||
SINT32 sf_data_analysis_cmd_report(SF_DATA_ATTR_S *param);
|
||||
SINT32 sf_data_analysis_bind_account(SF_DATA_ATTR_S *pstdata,SF_FN_PARAM_S *pfnParam);
|
||||
SINT32 sf_data_analysis_trigger(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam);
|
||||
SINT32 sf_data_analysis_sync_cfg(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SF_PARA_TIME_S* sf_server_time_get(void);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
56
code/application/source/sf_app/code/include/sf_datahttp.h
Executable file
56
code/application/source/sf_app/code/include/sf_datahttp.h
Executable file
|
@ -0,0 +1,56 @@
|
|||
|
||||
#ifndef __SF_TRANSDATA1_H__
|
||||
#define __SF_TRANSDATA1_H__
|
||||
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SF_DATA_ERROR_REQUEST SF_ERR_ID(SF_MOD_DATA, ERROR_REQUEST)
|
||||
#define SF_DATA_ERROR_FILE_SEND SF_ERR_ID(SF_MOD_DATA, ERROR_FILE_SEND)
|
||||
#define SF_DATA_ERROR_IP_CHANGE SF_ERR_ID(SF_MOD_DATA, ERROR_IP_CHANGE)
|
||||
#define SF_DATA_ERROR_DATA_FORMAT SF_ERR_ID(SF_MOD_DATA, ERROR_DATA_FORMAT)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char fileName[64];
|
||||
int fileType;
|
||||
}SF_RESERVE_THUMB;
|
||||
extern LOGIN_ACM_RESPONSE_S stLoginAcmResponse;
|
||||
|
||||
SINT32 sf_net_packetgrouping_login(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam);
|
||||
SINT32 sf_net_packetgrouping_fileresult(SF_DATA_ATTR_S *pstdata, SF_PDT_PARAM_STATISTICS_S *pStaticParam,SF_REPORT_FILE_ATTR_S *pstfileAttr);
|
||||
|
||||
SINT32 sf_net_packetgrouping_sync(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_net_packetgrouping_disconnection(SF_DATA_ATTR_S *pstdata,SF_VOID *Param);
|
||||
|
||||
SINT32 sf_net_packetanalysis_login(SF_DATA_ATTR_S *param, SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_net_packetanalysis_fileresult(SF_DATA_ATTR_S *param);
|
||||
|
||||
SINT32 sf_net_packetanalysis_sync(SF_DATA_ATTR_S *param, SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
LOGIN_ACM_RESPONSE_S* sf_get_login_reponse(void);
|
||||
|
||||
SF_REPORT_FILE_ATTR_S* sf_get_sub_report_file_attr(void);
|
||||
|
||||
SF_REPORT_FILE_ATTR_S* sf_get_thm_report_file_attr(void);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
68
code/application/source/sf_app/code/include/sf_debug.h
Executable file
68
code/application/source/sf_app/code/include/sf_debug.h
Executable file
|
@ -0,0 +1,68 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015-2020 by WuYuan Technology, Inc.
|
||||
*
|
||||
* This software is copyrighted by and is the property of SiFar
|
||||
* Technology, Inc.. All rights are reserved by SiFar Technology, Inc..
|
||||
* This software may only be used in accordance with the corresponding
|
||||
* license agreement. Any unauthorized use, duplication, distribution,
|
||||
* or disclosure of this software is expressly forbidden.
|
||||
*
|
||||
* This Copyright notice MUST not be removed or modified without prior
|
||||
* written consent of SiFar Technology, Inc..
|
||||
*
|
||||
* WuYuan Technology, Inc. reserves the right to modify this software without notice.
|
||||
*
|
||||
* Author: Kola
|
||||
* Ver: 1.0.0 2021.04.15
|
||||
* Description: create
|
||||
**************************************************************************/
|
||||
#ifndef _SF_DEBUG_H_
|
||||
#define _SF_DEBUG_H_
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef SINT32 (*SF_DEBUG_CALLBACK_FN_PTR)(SINT32 argc, SF_CHAR **argv[]);
|
||||
|
||||
typedef struct SF_DEBUG_CMD_ATTR_S {
|
||||
|
||||
SF_CHAR cmdStr[64];
|
||||
SF_DEBUG_CALLBACK_FN_PTR pfn_debug_cmd_exe;
|
||||
|
||||
} SF_DEBUG_CMD_ATTR_S;
|
||||
|
||||
SINT32 sf_debug_init(SF_CHAR *filepath,SINT32 *fd);
|
||||
|
||||
SINT32 sf_debug_create(SF_DEBUG_CMD_ATTR_S *pDebugCmdArray,SINT16 lenth);
|
||||
|
||||
SINT32 sf_debug_start(SINT32 fd);
|
||||
|
||||
SINT32 sf_debug_stop(void);
|
||||
|
||||
SINT32 sf_debug_deinit(SINT32 fd);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
24
code/application/source/sf_app/code/include/sf_dev_other.h
Executable file
24
code/application/source/sf_app/code/include/sf_dev_other.h
Executable file
|
@ -0,0 +1,24 @@
|
|||
#ifndef __SF_DEV_OTHER_H__
|
||||
#define __SF_DEV_OTHER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_type.h"
|
||||
#include "sf_hal_gpio.h"
|
||||
|
||||
#include "sf_param_common.h"
|
||||
SINT32 sf_dev_pir_status_get(void);
|
||||
UINT16 sf_pir_to_digit_analog(UINT8 pirs);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
35
code/application/source/sf_app/code/include/sf_dev_usb.h
Executable file
35
code/application/source/sf_app/code/include/sf_dev_usb.h
Executable file
|
@ -0,0 +1,35 @@
|
|||
#ifndef __SF_DEV_USB_H__
|
||||
#define __SF_DEV_USB_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_type.h"
|
||||
#include "sf_hal_gpio.h"
|
||||
|
||||
#include "sf_param_common.h"
|
||||
|
||||
typedef enum sf_USB_MODE_E
|
||||
{
|
||||
SF_USB_APP_CHARGE = 0,
|
||||
SF_USB_APP_MSDC,
|
||||
SF_USB_APP_UVC,
|
||||
}SF_USB_MODE_E;
|
||||
|
||||
void sf_usb_app_mode_set(SF_USB_MODE_E mode);
|
||||
|
||||
SF_USB_MODE_E sf_usb_app_mode_get(void);
|
||||
|
||||
SINT32 sf_usb_IsInsert(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
64
code/application/source/sf_app/code/include/sf_device.h
Executable file
64
code/application/source/sf_app/code/include/sf_device.h
Executable file
|
@ -0,0 +1,64 @@
|
|||
#ifndef __SF_DEVICE_H__
|
||||
#define __SF_DEVICE_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include <sf_type.h>
|
||||
#include "sf_param_common.h"
|
||||
typedef enum sfHAL_LED_GPIO_IDX_E
|
||||
{
|
||||
SF_HAL_LED_IDX_0 = 0, /**<led index 0*/
|
||||
SF_HAL_LED_IDX_1,
|
||||
SF_HAL_LED_STATUS_G = 45,
|
||||
SF_HAL_LED_WIFI = 45,
|
||||
|
||||
SF_HAL_LED_SD_G = 76,
|
||||
SF_HAL_LED_SD_R = 77,
|
||||
|
||||
SF_HAL_LED_BAT_G = 62,
|
||||
SF_HAL_LED_BAT_R = 63,
|
||||
|
||||
SF_HAL_LED_SIG1_R = 65,
|
||||
SF_HAL_LED_SIG1_G = 64,
|
||||
|
||||
|
||||
SF_HAL_LED_USERBIND_R = 47,
|
||||
SF_HAL_LED_USERBIND_G = 46,
|
||||
SF_HAL_LED_IDX_BUIT,
|
||||
} SF_LED_GPIO_IDX_E;
|
||||
typedef enum sfHAL_LED_STATE_E
|
||||
{
|
||||
SF_HAL_LED_STATE_OFF = 0,/**<led off state*/
|
||||
SF_HAL_LED_STATE_ON, /**<led on state*/
|
||||
SF_HAL_LED_STATE_BUIT,
|
||||
} SF_HAL_LED_STATE_E;
|
||||
|
||||
|
||||
|
||||
|
||||
SINT32 app_pir_monitoring_start(void);
|
||||
|
||||
SINT32 app_pir_monitoring_stop(void);
|
||||
|
||||
SINT32 app_led_all_status_set(SF_LED_STATUS_E enLedStatus,SF_LED_TYPE_E enLedType );
|
||||
|
||||
SINT32 app_led_net_reg_start(void);
|
||||
|
||||
SINT32 app_led_net_reg_stop(SINT32 s32ret);
|
||||
|
||||
SINT32 app_led_poweroff(void);
|
||||
|
||||
SINT32 app_led_sd_status_return(void);
|
||||
|
||||
SINT32 app_led_group_register(void);
|
||||
|
||||
SINT32 app_led_pin_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
75
code/application/source/sf_app/code/include/sf_eg91_gps.h
Executable file
75
code/application/source/sf_app/code/include/sf_eg91_gps.h
Executable file
|
@ -0,0 +1,75 @@
|
|||
|
||||
#ifndef _SF_EG91_GPS_H_
|
||||
#define _SF_EG91_GPS_H_
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_param_common.h"
|
||||
|
||||
#define GPS_SEARCH_MAX_FIAL_TIME 5
|
||||
#define GPS_SEARCH_TIMEOUT_TIMES 30
|
||||
|
||||
|
||||
#define SF_GPS_ERROR_QIACT SF_ERR_ID(SF_MOD_GPS, ERROR_AT_ACTIVE)
|
||||
#define SF_GPS_ERROR_AT_TIMEOUT SF_ERR_ID(SF_MOD_GPS, ERROR_AT_TIMEOUT)
|
||||
#define SF_GPS_ERROR_INS_EXIT SF_ERR_ID(SF_MOD_GPS,ERROR_INS_EXIT)
|
||||
#define SF_GPS_ERROR_NOT_MATCH SF_ERR_ID(SF_MOD_GPS, ERROR_NOT_MATCH)
|
||||
|
||||
typedef enum SIM_SEARCH_GPS_E
|
||||
{
|
||||
SIM_SEARCH_GPS_FIRST = (unsigned char)0x01,
|
||||
SIM_SEARCH_GPS_FIRST_1,
|
||||
SIM_SEARCH_GPS_FIRST_2,
|
||||
SIM_SEARCH_GPS_QGPSXTRA,
|
||||
SIM_SEARCH_GPS_CSGP,
|
||||
SIM_SEARCH_GPS_DELRAM,
|
||||
SIM_SEARCH_GPS_REQUESTHEADER,
|
||||
SIM_SEARCH_GPS_DOWNLOAD1,
|
||||
SIM_SEARCH_GPS_DOWNLOAD2,
|
||||
SIM_SEARCH_GPS_DOWNLOAD3,
|
||||
SIM_SEARCH_GPS_DOWNLOAD4,
|
||||
SIM_SEARCH_GPS_DOWNLOAD5,
|
||||
SIM_SEARCH_GPS_DOWNLOAD6,
|
||||
SIM_SEARCH_GPS_DOWNLOAD7,
|
||||
SIM_SEARCH_GPS_DOWNLOAD8,
|
||||
SIM_SEARCH_GPS_DOWNLOAD9,
|
||||
SIM_SEARCH_GPS_DOWNLOAD10,
|
||||
SIM_SEARCH_GPS_GPS_XTRADATA1,
|
||||
SIM_SEARCH_GPS_GPS_XTRADATA2,
|
||||
SIM_SEARCH_GPS_RESET,
|
||||
SIM_SEARCH_GPS_WAITREADY,
|
||||
SIM_SEARCH_GPS_ON,
|
||||
SIM_SEARCH_GPS_LOC,
|
||||
SIM_SEARCH_GPS_END,
|
||||
SIM_SEARCH_GPS_DEACT,
|
||||
SIM_SEARCH_GPS_EXIT,
|
||||
}SIM_SEARCH_GPS_e;
|
||||
|
||||
|
||||
|
||||
static unsigned long int gps_get_seconds(SF_PARA_TIME_S *pTime);
|
||||
static int gps_diffSec_from_date(SF_PARA_TIME_S *pnowDate, SF_PARA_TIME_S *poldDate);
|
||||
static void gps_infor_convert(SF_CHAR *str);
|
||||
SINT16 eg91_gps_greendate_Get(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime);
|
||||
|
||||
SINT32 eg91_gps_search_result(SF_FN_PARAM_S *pfnParam);
|
||||
SINT32 eg91_gps_preconfig(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
|
||||
SINT32 eg91_gps_search(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime,UINT8 autoModeFlag);
|
||||
|
||||
SINT32 eg91_gps_Isupdate(SF_FN_PARAM_S *pfnParam,UINT8 *pIsupdate,SF_PARA_TIME_S *pNowTime,UINT8 u8day);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
150
code/application/source/sf_app/code/include/sf_eg91_server.h
Executable file
150
code/application/source/sf_app/code/include/sf_eg91_server.h
Executable file
|
@ -0,0 +1,150 @@
|
|||
#ifndef __SF_EG91_SERVER_H__
|
||||
#define __SF_EG91_SERVER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "sf_param_common.h"
|
||||
|
||||
#define IMEI_LEN 15
|
||||
|
||||
|
||||
#define SF_PIC_NAME_LEN 12
|
||||
#define SF_VIDEO_NAME_LEN 12
|
||||
#define ERROR_LOG_NAME_LEN 10
|
||||
#define GPS_LOG_NAME_LEN 13
|
||||
#define BT_ALARM_NAME_LEN 11
|
||||
#define OTA_FTP_UPDATAFILENAME "DFOTA.zip"
|
||||
|
||||
#define READ_B (1024*1024)
|
||||
#define TCP_PDP 8
|
||||
#define TCP_PDP_TRY_TIME 7
|
||||
|
||||
#define HTTP_PDP 7
|
||||
#define PDP_TRY_TIME 7
|
||||
#define MMZBLOCKSIZE 1024
|
||||
|
||||
|
||||
#define SF_HTTP_ERROR_REQUEST SF_ERR_ID(SF_MOD_HTTP, ERROR_REQUEST)
|
||||
#define SF_HTTP_ERROR_AT_TIMEOUT SF_ERR_ID(SF_MOD_HTTP, ERROR_AT_TIMEOUT)
|
||||
#define SF_HTTP_ERROR_AT_READ SF_ERR_ID(SF_MOD_HTTP, ERROR_AT_READ)
|
||||
#define SF_HTTP_ERROR_FILE_SEND SF_ERR_ID(SF_MOD_HTTP, ERROR_FILE_SEND)
|
||||
|
||||
|
||||
|
||||
typedef enum MODULE_HTTP_CONFIG_E
|
||||
{
|
||||
MODULE_HTTP_CONFIG_AT = 0x01,
|
||||
MODULE_HTTP_CONFIG_AT_ATW,
|
||||
MODULE_HTTP_CONFIG_AT_QICSGP,
|
||||
MODULE_HTTP_CONFIG_AT_QHTTPCFG_1,
|
||||
MODULE_HTTP_CONFIG_AT_QHTTPCFG_2,
|
||||
MODULE_HTTP_CONFIG_AT_QHTTPCFG_3,
|
||||
MODULE_HTTP_CONFIG_AT_QSSLCFG_1,
|
||||
MODULE_HTTP_CONFIG_AT_QSSLCFG_2,
|
||||
MODULE_HTTP_CONFIG_AT_QSSLCFG_3,
|
||||
MODULE_HTTP_CONFIG_AT_QHTTPURL_1,
|
||||
MODULE_HTTP_CONFIG_AT_QHTTPURL_2,
|
||||
MODULE_HTTP_CONFIG_AT_QHTTPGET,
|
||||
MODULE_HTTP_CONFIG_AT_QHTTPREAD,
|
||||
MODULE_HTTP_CONFIG_AT_QIDEACT,
|
||||
MODULE_HTTP_CONFIG_AT_END,
|
||||
}MODULE_HTTP_CONFIG_E;
|
||||
|
||||
typedef enum MODULE_HTTP_AUTHEN_E
|
||||
{
|
||||
MODULE_HTTP_AUTHEN_AT_QIACT_PRE,
|
||||
MODULE_HTTP_AUTHEN_AT_QIACT,
|
||||
MODULE_HTTP_AUTHEN_AT_QHTTPURL_1,
|
||||
MODULE_HTTP_AUTHEN_AT_QHTTPURL_2,
|
||||
MODULE_HTTP_AUTHEN_AT_QHTTPGET,
|
||||
MODULE_HTTP_AUTHEN_AT_QHTTPREAD,
|
||||
MODULE_HTTP_AUTHEN_AT_QIDEACT,
|
||||
MODULE_HTTP_AUTHEN_AT_END,
|
||||
}MODULE_SERVER_AUTHEN_E;
|
||||
|
||||
typedef enum MODULE_SERVER_SENDFILE_E
|
||||
{
|
||||
MODULE_SERVER_SENDFILE_AT,
|
||||
MODULE_SERVER_SENDFILE_AT_QFLST,
|
||||
MODULE_SERVER_SENDFILE_AT_QFDEL,
|
||||
MODULE_SERVER_SENDFILE_AT_QFUPL,
|
||||
MODULE_SERVER_SENDFILE_AT_QHTTPCFG,
|
||||
MODULE_SERVER_SENDFILE_AT_QHTTPURL_1,
|
||||
MODULE_SERVER_SENDFILE_AT_QHTTPURL_2,
|
||||
MODULE_SERVER_SENDFILE_AT_QHTTPPOSTFILE,
|
||||
MODULE_SERVER_SENDFILE_AT_QHTTREAD,
|
||||
MODULE_SERVER_SENDFILE_AT_END_1,
|
||||
MODULE_SERVER_SENDFILE_AT_END,
|
||||
}MODULE_SERVER_SENDFILE_E;
|
||||
|
||||
|
||||
|
||||
typedef enum MODULE_SERVER_ACM_OPEN_E
|
||||
{
|
||||
MODULE_SERVER_ACM_OPEN_AT = 0x01,
|
||||
MODULE_SERVER_ACM_OPEN_AT_QICSGP,
|
||||
MODULE_SERVER_ACM_OPEN_AT_QISTATE,
|
||||
MODULE_SERVER_ACM_OPEN_AT_QISTATE_CHECK,
|
||||
MODULE_SERVER_ACM_OPEN_AT_QISTATE_TEST,
|
||||
MODULE_SERVER_ACM_OPEN_AT_QIDEACT,
|
||||
MODULE_SERVER_ACM_OPEN_AT_QIACT,
|
||||
MODULE_SERVER_ACM_OPEN_AT_QICFG,
|
||||
MODULE_SERVER_ACM_OPEN_AT_QIOPEN,
|
||||
MODULE_SERVER_ACM_OPEN_AT_ATE0,
|
||||
MODULE_SERVER_ACM_OPEN_AT_END,
|
||||
}MODULE_SERVER_ACM_OPEN_E;
|
||||
|
||||
typedef enum MODULE_SERVER_ACM_WRITE_E
|
||||
{
|
||||
MODULE_SERVER_ACM_WRITE_AT = 0x01,
|
||||
MODULE_SERVER_ACM_WRITE_AT_QISEND,
|
||||
MODULE_SERVER_ACM_WRITE_AT_SENDING,
|
||||
MODULE_SERVER_ACM_WRITE_AT_QIRD,
|
||||
MODULE_SERVER_ACM_WRITE_AT_ATE0,
|
||||
MODULE_SERVER_ACM_WRITE_AT_QIDEACT,
|
||||
MODULE_SERVER_ACM_WRITE_AT_END,
|
||||
}MODULE_SERVER_ACM_WRITE_E;
|
||||
|
||||
typedef enum MODULE_SERVER_ACM_CLOSE_E
|
||||
{
|
||||
MODULE_SERVER_ACM_CLOSE_AT = 0x01,
|
||||
MODULE_SERVER_ACM_CLOSE_AT_QICLOSE,
|
||||
MODULE_SERVER_ACM_CLOSE_AT_QIDEACT,
|
||||
MODULE_SERVER_ACM_CLOSE_AT_ATE0,
|
||||
|
||||
MODULE_SERVER_ACM_CLOSE_AT_END,
|
||||
}MODULE_SERVER_ACM_CLOSE_E;
|
||||
|
||||
|
||||
SINT32 eg91_http_config(SF_FN_PARAM_S *pfnParam, UINT8 sslOn, UINT8 autoReqHead);
|
||||
|
||||
SINT32 eg91_http_authenrequst(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 eg91_file_to_module(SF_CHAR *fileName, SINT32 *fileSize, SF_FILE_TYPE_E fileType);
|
||||
|
||||
SINT32 eg91_http_pushfile(SF_FILE_ATTR_S *pstFileAttr,SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 eg91_server_acm_open(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 eg91_server_acm_transfer(SF_DATA_ATTR_S *psenddate, SF_FN_PARAM_S *pfnParam, UINT8 needRepose);
|
||||
|
||||
SINT32 eg91_server_acm_close(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
118
code/application/source/sf_app/code/include/sf_eg91_sim.h
Executable file
118
code/application/source/sf_app/code/include/sf_eg91_sim.h
Executable file
|
@ -0,0 +1,118 @@
|
|||
#ifndef __SF_EG91_SIM_H__
|
||||
#define __SF_EG91_SIM_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#define IMEI_LEN 15
|
||||
|
||||
#include "sf_param_common.h"
|
||||
|
||||
|
||||
|
||||
#define EG91 "EG91"
|
||||
#define EG95 "EG95"
|
||||
|
||||
#define APNGPRS_WUYUAN "America.bics"
|
||||
#define APNGPRS_WUYUAN2 "bicsapn"
|
||||
#define APNGPRSTEMP "CTNET"
|
||||
#define APNGPRSTEMP2 "3gnet"
|
||||
#define APNGPRSTEMP3 "CMNET"
|
||||
typedef enum SIM_SLEEP_E
|
||||
{
|
||||
SIM_SLEEP_FIRST = (unsigned char)0x01,
|
||||
SIM_SLEEP_QSCLK,
|
||||
SIM_SLEEP_QSCLKEXCFG,
|
||||
SIM_SLEEP_QSCEX,
|
||||
SIM_SLEEP_EXIT,
|
||||
}SIM_SLEEP_NET_E;
|
||||
|
||||
|
||||
typedef enum SIM_INIT_e
|
||||
{
|
||||
SIM_INIT_FIRST = (unsigned char)0x01,
|
||||
SIM_INIT_ATE,
|
||||
SIM_INIT_DEBUG,
|
||||
SIM_INIT_QNTP,
|
||||
SIM_INIT_QURCCFG,
|
||||
SIM_INIT_QCFG,
|
||||
SIM_INIT_QCFG_PLUSE,
|
||||
SIM_INIT_CGDCONT,
|
||||
SIM_INIT_CGDCONT_1,
|
||||
SIM_INIT_CGDCONT_2,
|
||||
SIM_INIT_CGDCONT_3,
|
||||
SIM_INIT_CFUN,
|
||||
SIM_INIT_CFUN_1,
|
||||
SIM_INIT_QNVW,
|
||||
SIM_INIT_QLWCFG,
|
||||
SIM_INIT_QLWCFG_1,
|
||||
SIM_INIT_GSN,
|
||||
SIM_INIT_ATI,
|
||||
SIM_INIT_QGMR,
|
||||
SIM_INIT_QFLIST,
|
||||
SIM_INIT_QFLIST_1,
|
||||
SIM_INIT_QFLIST_2,
|
||||
SIM_INIT_ICCID,
|
||||
SIM_INIT_ICCID_1,
|
||||
SIM_INIT_QGPSXTRA,
|
||||
SIM_INIT_RESET_MODULE,
|
||||
SIM_INIT_CIMI,
|
||||
SIM_INIT_QNVFR,
|
||||
SIM_INIT_QNVFW,
|
||||
SIM_INIT_END,
|
||||
}SIM_INIT_E;
|
||||
typedef enum SIM_REG_NET_E
|
||||
{
|
||||
SIM_REG_NET_FIRST = (unsigned char)0x01,
|
||||
SIM_REG_NET_FIRST_1,
|
||||
SIM_REG_NET_FIRST_1_1,
|
||||
SIM_REG_NET_FIRST_1_2,
|
||||
SIM_REG_NET_FIRST_1_3,
|
||||
SIM_REG_NET_FIRST_2,
|
||||
SIM_REG_NET_FIRST_3,
|
||||
SIM_REG_NET_WSIZE1,
|
||||
SIM_REG_NET_WSIZE2,
|
||||
SIM_REG_NET_WSIZE3,
|
||||
SIM_REG_NET_CGREG,
|
||||
SIM_REG_NET_QNWINFO,
|
||||
|
||||
SIM_REG_NET_COPS,
|
||||
SIM_REG_NET_QCSQ,
|
||||
SIM_REG_NET_CSQ,
|
||||
SIM_REG_NET_SAVE,
|
||||
SIM_REG_NET_CIMI,
|
||||
}SIM_REG_NET_e;
|
||||
|
||||
typedef enum USBNET_APN_INIT_E
|
||||
{
|
||||
USBNET_APN_INIT_FIRST = (unsigned char)0x01,
|
||||
USBNET_APN_QICSGP1,
|
||||
USBNET_APN_QICSGP2,
|
||||
USBNET_APN_INIT_END,
|
||||
}USBNET_APN_INIT_e;
|
||||
|
||||
SINT32 eg91_iccid_get(SF_CHAR *iccid,SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 eg91_qsclk_set(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 eg91_other_sim_apn_cfg(SF_PDT_PARAM_STATISTICS_S *pstaticParam);
|
||||
|
||||
SINT32 eg91_sim_init(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 eg91_register_net_manual(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 eg91_register_net_auto(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 eg91_usb_net_apn_cfg(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
61
code/application/source/sf_app/code/include/sf_fileMng.h
Executable file
61
code/application/source/sf_app/code/include/sf_fileMng.h
Executable file
|
@ -0,0 +1,61 @@
|
|||
#ifndef _SF_FILEMNG_H_
|
||||
#define _SF_FILEMNG_H_
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
|
||||
#define MMZBLOCKSIZE 1024
|
||||
#define SF_VIDEO_LOOP_NUM 4 /*PIC 3 + VIDEO 1*/
|
||||
|
||||
#define SF_FILE_ERROR_NO_FILE SF_ERR_ID(SF_MOD_FILE, ERROR_NO_FILE)
|
||||
|
||||
typedef enum sf_SUBSCRIBE_TYPE_E
|
||||
{
|
||||
SF_SUBSCRIBE_LASTEST = 0X01,
|
||||
SF_SUBSCRIBE_ALL,
|
||||
SF_SUBSCRIBE_SPEC_TIME,
|
||||
SF_SUBSCRIBE_SPEC_FILE,
|
||||
SF_SUBSCRIBE_PIC,
|
||||
SF_SUBSCRIBE_VIDEO,
|
||||
SF_SUBSCRIBE_BUTT,
|
||||
}SF_SUBSCRIBE_TYPE_E;
|
||||
|
||||
SINT32 sf_file_remove(SF_CHAR *fileName);
|
||||
|
||||
SINT32 sf_file_http_header_add(SF_FILE_ATTR_S *pstFileAttr, SF_PDT_PARAM_STATISTICS_S *pstParam);
|
||||
|
||||
SINT32 sf_file_txt_fill(SF_FILE_ATTR_S *pstFileAttr);
|
||||
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
SINT32 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SUBSCRIBE_ATTR_S *pSubscribe);
|
||||
#else
|
||||
SINT16 sf_file_subscribe_check(SF_FILE_ATTR_S *pstfileAttr, SF_SEND_FILE_ATTR_S* pSendFileAttr);
|
||||
#endif
|
||||
|
||||
SINT32 sf_file_IsExsit(CHAR *fileName);
|
||||
|
||||
void sf_file_thumb_cfg_fill(char* filepath,char* fileName,SF_FILE_TYPE_E enFileType);
|
||||
|
||||
void sf_file_thumb_cfg_set(SF_SRCFILE_ATTR_S *pThumbFileCfgl);
|
||||
|
||||
void sf_file_thumb_cfg_clear(void);
|
||||
|
||||
SF_SRCFILE_ATTR_S* sf_file_thumb_cfg_get(void);
|
||||
SINT32 sf_file_size_get(SF_CHAR *filePath,UINT32 *pFileSize);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
30
code/application/source/sf_app/code/include/sf_hal_gpio.h
Executable file
30
code/application/source/sf_app/code/include/sf_hal_gpio.h
Executable file
|
@ -0,0 +1,30 @@
|
|||
|
||||
#ifndef _SF_HAL_GPIO_H_
|
||||
#define _SF_HAL_GPIO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#define GPIO_EXPORT "/sys/class/gpio/export"
|
||||
#define GPIO_ID_DIR "/sys/class/gpio/gpio%d/direction"
|
||||
#define GPIO_ID_VALUE "/sys/class/gpio/gpio%d/value"
|
||||
#define GPIO_UNEXPORT "/sys/class/gpio/unexport"
|
||||
|
||||
|
||||
SINT32 sf_hal_gpio_init(U32 gpio_num, int dir);
|
||||
|
||||
SINT32 sf_hal_gpio_set(U32 gpio_num, U32 nval);
|
||||
|
||||
SINT32 sf_hal_gpio_get(U32 gpio_num, SINT8 *nval);
|
||||
|
||||
SINT32 sf_hal_gpio_deinit(U32 gpioNum);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // _DCF_H_
|
89
code/application/source/sf_app/code/include/sf_hal_ttyusb.h
Executable file
89
code/application/source/sf_app/code/include/sf_hal_ttyusb.h
Executable file
|
@ -0,0 +1,89 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015-2020 by WuYuan Technology, Inc.
|
||||
*
|
||||
* This software is copyrighted by and is the property of SiFar
|
||||
* Technology, Inc.. All rights are reserved by SiFar Technology, Inc..
|
||||
* This software may only be used in accordance with the corresponding
|
||||
* license agreement. Any unauthorized use, duplication, distribution,
|
||||
* or disclosure of this software is expressly forbidden.
|
||||
*
|
||||
* This Copyright notice MUST not be removed or modified without prior
|
||||
* written consent of SiFar Technology, Inc..
|
||||
*
|
||||
* SiFar Technology, Inc. reserves the right to modify this software without notice.
|
||||
*
|
||||
* Author: jiamin
|
||||
* Ver: 1.0.0 2020.09.17
|
||||
* Description: creat
|
||||
**************************************************************************/
|
||||
#ifndef _SF_TTYAPI_H_
|
||||
#define _SF_TTYAPI_H_
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_param_common.h"
|
||||
|
||||
|
||||
#define SF_TTY_ERROR_OPEN SF_ERR_ID(SF_MOD_TTY, ERROR_AT_OPEN)
|
||||
#define SF_TTY_ERROR_WRITE SF_ERR_ID(SF_MOD_TTY, ERROR_AT_WRITE)
|
||||
#define SF_TTY_ERROR_READ SF_ERR_ID(SF_MOD_TTY, ERROR_AT_READ)
|
||||
|
||||
|
||||
#define GPRS_MODULE_TYPE_EG91 "EG91"
|
||||
#define GPRS_MODULE_TYPE_EG95 "EG95"
|
||||
|
||||
#define GPRS_MODULE_TYPE_EG91_V "EG91VX"
|
||||
#define GPRS_MODULE_TYPE_EG95_V "EG95VX"
|
||||
#define GPRS_MODULE_TYPE_EG91_NAXD "EG91NAXD"
|
||||
#define GPRS_MODULE_TYPE_EG95_NAXD "EG95NAXD"
|
||||
|
||||
|
||||
|
||||
#define A_MODULE_APN "nxtgenphone"
|
||||
#define V_MODULE_APN "vzwinternet"
|
||||
|
||||
|
||||
#define E_PDP_INDEX 7
|
||||
#define V_PDP_INDEX 3
|
||||
#define A_PDP_INDEX 1
|
||||
|
||||
typedef struct sf_SERIAL_DATA_FRAME_TYPE_S {
|
||||
|
||||
SF_CHAR parity;
|
||||
SF_CHAR flow_ctrl;
|
||||
|
||||
SINT8 databits;
|
||||
SINT8 stopbits;
|
||||
SINT32 speed;
|
||||
|
||||
}SF_SERIAL_DATA_FRAME_TYPE_S;
|
||||
|
||||
SINT32 sf_hal_ttyusb2_init(void);
|
||||
|
||||
SINT32 sf_hal_ttyusb2_write(SF_CHAR *sendBuf, SINT32 dataLen);
|
||||
|
||||
SINT32 sf_hal_ttyusb2_read(SF_CHAR *recvBuf, SINT32 dataLen);
|
||||
|
||||
SINT32 sf_hal_ttyusb2_deinit(void);
|
||||
|
||||
SINT32 sf_hal_uart_init(void);
|
||||
|
||||
SINT32 sf_hal_uart_write(SF_CHAR *sendBuf, SINT32 dataLen);
|
||||
|
||||
SINT32 sf_hal_uart_read(SF_CHAR *recvBuf, SINT32 dataLen);
|
||||
|
||||
SINT32 sf_hal_uart_deinit(void);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
52
code/application/source/sf_app/code/include/sf_http_server.h
Executable file
52
code/application/source/sf_app/code/include/sf_http_server.h
Executable file
|
@ -0,0 +1,52 @@
|
|||
#ifndef __SF_EG91_SERVER_H__
|
||||
#define __SF_EG91_SERVER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "sf_param_common.h"
|
||||
#define SF_HTTP_ERROR_REQUEST SF_ERR_ID(SF_MOD_HTTP, ERROR_REQUEST)
|
||||
#define SF_HTTP_ERROR_WRITE SF_ERR_ID(SF_MOD_HTTP, ERROR_WRITE)
|
||||
#define SF_HTTP_ERROR_READ SF_ERR_ID(SF_MOD_HTTP, ERROR_READ)
|
||||
|
||||
#define SF_HTTP_ERROR_DATA_FORMAT SF_ERR_ID(SF_MOD_HTTP, ERROR_DATA_FORMAT)
|
||||
#define SF_HTTP_ERROR_NO_SUPPORT SF_ERR_ID(SF_MOD_HTTP, ERROR_NO_SUPPORT)
|
||||
|
||||
|
||||
|
||||
|
||||
SINT32 http_server_creat(char *host, int *sock);
|
||||
|
||||
SINT32 http_send_to_server(int sock_fd, char *data, int length);
|
||||
|
||||
SINT32 http_recv_from_server(int sock_fd, char *data, int length);
|
||||
|
||||
SINT32 http_server_close(int sock_fd);
|
||||
|
||||
SINT32 sf_usbnet_http_authenrequst(SF_PDT_PARAM_STATISTICS_S *pStaticParam);
|
||||
|
||||
SINT32 sf_usbnet_http_pushfile(SF_FILE_ATTR_S *pstFileAttr,SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_usbnet_server_acm_open(SF_PDT_PARAM_STATISTICS_S *pStaticParam);
|
||||
|
||||
SINT32 sf_usbnet_server_acm_transfer(SF_DATA_ATTR_S *psenddate);
|
||||
|
||||
SINT32 sf_usbnet_server_acm_close();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
72
code/application/source/sf_app/code/include/sf_keymng.h
Executable file
72
code/application/source/sf_app/code/include/sf_keymng.h
Executable file
|
@ -0,0 +1,72 @@
|
|||
#ifndef __SF_KEYMNG_H__
|
||||
#define __SF_KEYMNG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_type.h"
|
||||
#include "sf_hal_gpio.h"
|
||||
|
||||
#include "sf_param_common.h"
|
||||
|
||||
|
||||
|
||||
typedef enum sf_KEY_PIN_E
|
||||
{
|
||||
SF_KEY_PIN_RESET = 69,
|
||||
SF_KEY_PIN_SYNC = 7,
|
||||
SF_KEY_PIN_FORMAT = 66,
|
||||
SF_KEY_PIN_DATAREADY = 6,
|
||||
SF_KEY_PIN_FILESTATUS = 128,/*virtual key*/
|
||||
} SF_KEY_PIN_E;
|
||||
typedef enum sf_KEY_TYPE_E
|
||||
{
|
||||
SF_KEY_TYPE_CLICK = 0,
|
||||
SF_KEY_TYPE_HOLD,
|
||||
} SF_KEY_TYPE_E;
|
||||
|
||||
typedef enum sf_KEY_STATE_E
|
||||
{
|
||||
SF_KEY_STATE_DOWN = 0,
|
||||
SF_KEY_STATE_UP,
|
||||
SF_KEY_STATE_BUIT
|
||||
} SF_KEY_STATE_E;
|
||||
typedef enum sf_MESSAGE_CMD_KEY_e
|
||||
{
|
||||
SF_EVENT_KEY_SHORT_CLICK = 0x01,
|
||||
SF_EVENT_KEY_LONG_CLICK,
|
||||
SF_EVENT_KEY_HOLD_DOWN,
|
||||
SF_EVENT_KEY_HOLD_UP,
|
||||
SF_EVENT_KEY_GROUP,
|
||||
SF_EVENT_KEY_BUTT
|
||||
}SF_MESSAGE_CMD_KEY_E;
|
||||
|
||||
typedef struct tagKEYMNG_INFO_S
|
||||
{
|
||||
SF_KEY_PIN_E u8keyIdx; /* serial number*/
|
||||
SF_BOOL u32status; /* PIN state*/
|
||||
SINT16 u32keycount; /* Count value*/
|
||||
SINT16 ShortLongMaxCount; /* Pin number*/
|
||||
SF_KEY_STATE_E enState; /* Initial state*/
|
||||
} SF_KEYMNG_INFO_S;
|
||||
const SF_CHAR* sf_keyctrl_getstatusstring(SF_MESSAGE_CMD_KEY_E enType);
|
||||
|
||||
const SF_CHAR* sf_keypin_getstatusstring(SF_KEY_PIN_E enType);
|
||||
|
||||
SINT32 sf_Key_ctrl_init(void);
|
||||
SINT32 sf_Key_ctrl_deinit(void);
|
||||
SINT32 sf_Key_ctrl_Start(void);
|
||||
SINT32 sf_Key_ctrl_Stop(void);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
94
code/application/source/sf_app/code/include/sf_ledmng.h
Executable file
94
code/application/source/sf_app/code/include/sf_ledmng.h
Executable file
|
@ -0,0 +1,94 @@
|
|||
#ifndef __SF_LEDMNG_H__
|
||||
#define __SF_LEDMNG_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
|
||||
#define LED_GRPOUP_MAX 100
|
||||
|
||||
typedef enum _SF_LED_STATUS_E
|
||||
{
|
||||
LED_STATUS_HOLD_OFF = 0,
|
||||
LED_STATUS_HOLD_ON,
|
||||
LED_STATUS_SLOWFLASH_ON,
|
||||
LED_STATUS_QUICKFLASH_ON,
|
||||
LED_STATUS_FLASH_OFF,
|
||||
LED_STATUS_BUIT
|
||||
} SF_LED_STATUS_E;
|
||||
typedef enum _SF_LED_TYPE_E
|
||||
{
|
||||
LED_TYPE_OFF = 0,
|
||||
LED_TYPE_GREEN,
|
||||
LED_TYPE_YELLOW,
|
||||
LED_TYPE_RED,
|
||||
LED_TYPE_ON,
|
||||
LED_TYPE_BUIT
|
||||
} SF_LED_TYPE_E;
|
||||
|
||||
typedef enum sf_LED_GROUP_E
|
||||
{
|
||||
LED_GROUP_SD = 0,
|
||||
LED_GROUP_BAT,
|
||||
LED_GROUP_SIGNAL,
|
||||
LED_GROUP_ACCOUNT,
|
||||
LED_GROUP_STATUS,
|
||||
LED_GROUP_BUIT
|
||||
|
||||
} SF_LED_GROUD_E;
|
||||
|
||||
typedef SINT32 (*SF_LED_EVENT_CALLBACK_FN_PTR)(SF_LED_GROUD_E enGroupType,SINT32 enstatus);
|
||||
|
||||
typedef struct sf_LED_REG_S {
|
||||
SF_BOOL IsUsed;
|
||||
SF_BOOL IsRun;
|
||||
SINT8 LedGroupID;
|
||||
SINT8 enStatusType;
|
||||
SINT32 FlashTimeUs;
|
||||
pthread_t TskId;
|
||||
} SF_LED_REG_S;
|
||||
|
||||
typedef struct sf_LED_EVENT_S {
|
||||
SF_LED_REG_S stLedGroupReg[LED_GRPOUP_MAX];
|
||||
SF_LED_EVENT_CALLBACK_FN_PTR pfn_led_event_exe;
|
||||
pthread_mutex_t LEDMNGMutex;
|
||||
|
||||
} SF_LED_EVENT_S;
|
||||
const SF_CHAR* sf_led_status_getstatusstring(SF_LED_STATUS_E enType);
|
||||
|
||||
const SF_CHAR* sf_led_type_getstatusstring(SF_LED_TYPE_E enType);
|
||||
|
||||
const SF_CHAR* sf_led_group_getstatusstring(SF_LED_GROUD_E enType);
|
||||
|
||||
SINT32 sf_led_add_exe(SF_LED_EVENT_CALLBACK_FN_PTR pfn_led_event_exe);
|
||||
|
||||
SINT32 sf_led_remove_exe(SF_LED_EVENT_CALLBACK_FN_PTR pfn_led_event_exe);
|
||||
|
||||
SINT32 sf_led_event_register(SINT8 enLedEvent);
|
||||
|
||||
SINT32 sf_led_event_unregister(SINT8 enLedEvent);
|
||||
|
||||
SINT32 sf_led_flash_start(SF_LED_REG_S *pLedGroupReg);
|
||||
|
||||
SINT32 sf_led_flash_stop(SF_LED_GROUD_E enLedGroupType);
|
||||
|
||||
SINT32 sf_led_event_process(SINT32 arg1,SINT32 arg2,SINT32 arg3);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
113
code/application/source/sf_app/code/include/sf_log.h
Executable file
113
code/application/source/sf_app/code/include/sf_log.h
Executable file
|
@ -0,0 +1,113 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015-2020 by WuYuan Technology, Inc.
|
||||
*
|
||||
* This software is copyrighted by and is the property of SiFar
|
||||
* Technology, Inc.. All rights are reserved by SiFar Technology, Inc..
|
||||
* This software may only be used in accordance with the corresponding
|
||||
* license agreement. Any unauthorized use, duplication, distribution,
|
||||
* or disclosure of this software is expressly forbidden.
|
||||
*
|
||||
* This Copyright notice MUST not be removed or modified without prior
|
||||
* written consent of SiFar Technology, Inc..
|
||||
*
|
||||
* WuYuan Technology, Inc. reserves the right to modify this software without notice.
|
||||
*
|
||||
* Author: Kola
|
||||
* Ver: 1.0.0 2021.04.15
|
||||
* Description: create
|
||||
**************************************************************************/
|
||||
#ifndef _SF_LOG_H_
|
||||
#define _SF_LOG_H_
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#define LOG_TMP_MOD_FILE_PATH SF_SD_ROOT"SF_GPS.TXT"
|
||||
#define LOG_AT_FILE_PATH SF_SD_ROOT"SF_GPS.TXT"
|
||||
#define WARNING_FILE_PATH SF_SD_ROOT"warning.txt"
|
||||
#define INFO_FILE_PATH SF_SD_ROOT"info.txt"
|
||||
|
||||
#define SF_ENCRYPTION_ENBLE 1
|
||||
|
||||
typedef enum SF_LOG_LEVEL_E
|
||||
{
|
||||
SF_LOG_LEVEL_ERROR = 0, /**<error conditions */
|
||||
SF_LOG_LEVEL_WARNING, /**<warning conditions */
|
||||
SF_LOG_LEVEL_INFO, /**<informational */
|
||||
SF_LOG_LEVEL_DEBUG, /**<debug-level */
|
||||
} SF_LOG_LEVEL_e;
|
||||
|
||||
|
||||
#define NONE "\033[m"
|
||||
#define RED "\033[0;32;31m"
|
||||
#define LIGHT_RED "\033[1;31m"
|
||||
#define GREEN "\033[0;32;32m"
|
||||
#define LIGHT_GREEN "\033[1;32m"
|
||||
#define BLUE "\033[0;32;34m"
|
||||
#define LIGHT_BLUE "\033[1;34m"
|
||||
#define DARY_GRAY "\033[1;30m"
|
||||
#define CYAN "\033[0;36m"
|
||||
#define LIGHT_CYAN "\033[1;36m"
|
||||
#define PURPLE "\033[0;35m"
|
||||
#define LIGHT_PURPLE "\033[1;35m"
|
||||
#define BROWN "\033[0;33m"
|
||||
#define YELLOW "\033[1;33m"
|
||||
#define LIGHT_GRAY "\033[0;37m"
|
||||
#define WHITE "\033[1;37m"
|
||||
|
||||
//#define MLOGI(format, args...) (printf( LIGHT_GREEN "[INFO]: %s[%d]:"NONE format, __FUNCTION__ , __LINE__, ##args))
|
||||
//
|
||||
//#define MLOGD(format, args...) (printf( LIGHT_PURPLE "[DEBUG]: %s[%d]:"NONE format, __FUNCTION__ , __LINE__, ##args))
|
||||
//
|
||||
//#define MLOGW(format, args...) (printf( YELLOW "[WARN]: %s[%d]:"NONE format, __FUNCTION__ , __LINE__, ##args))
|
||||
//
|
||||
//#define MLOGE(format, args...) (printf( LIGHT_RED "[ERROR]: %s[%d]:"NONE format, __FUNCTION__ , __LINE__, ##args))
|
||||
|
||||
|
||||
#define MLOGE(fmt, args...) sf_log_file(SF_LOG_LEVEL_ERROR, __FUNCTION__, __LINE__, fmt, ##args)
|
||||
#define MLOGW(fmt, args...) sf_log_file(SF_LOG_LEVEL_WARNING, __FUNCTION__, __LINE__, fmt, ##args)
|
||||
#define MLOGI(fmt, args...) sf_log_file(SF_LOG_LEVEL_INFO, __FUNCTION__, __LINE__, fmt, ##args)
|
||||
#define MLOGD(fmt, args...) sf_log_file(SF_LOG_LEVEL_DEBUG, __FUNCTION__, __LINE__, fmt, ##args)
|
||||
|
||||
#define SLOGE(fmt, args...) sf_log_file(SF_LOG_LEVEL_ERROR, __FUNCTION__, __LINE__, fmt, ##args)
|
||||
#define SLOGW(fmt, args...) sf_log_file(SF_LOG_LEVEL_WARNING, __FUNCTION__, __LINE__, fmt, ##args)
|
||||
#define SLOGI(fmt, args...) sf_log_file(SF_LOG_LEVEL_INFO, __FUNCTION__, __LINE__, fmt, ##args)
|
||||
#define SLOGD(fmt, args...) sf_log_file(SF_LOG_LEVEL_DEBUG, __FUNCTION__, __LINE__, fmt, ##args)
|
||||
|
||||
#define SLOG_DM(fmt, args...) sf_log_module(__FUNCTION__, __LINE__, fmt, ##args)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SINT32 sf_log_Level_set(SF_LOG_LEVEL_e enLevel);
|
||||
|
||||
SF_LOG_LEVEL_e sf_log_Level_get(void);
|
||||
|
||||
void sf_log_module(const char *pszFunc, U32 u32Line, const char *pszFmt, ...);
|
||||
|
||||
void sf_log_file(SF_LOG_LEVEL_e enLevel,const char *pszFunc, U32 u32Line,char *pszFmt, ...);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
29
code/application/source/sf_app/code/include/sf_message_queue.h
Executable file
29
code/application/source/sf_app/code/include/sf_message_queue.h
Executable file
|
@ -0,0 +1,29 @@
|
|||
#ifndef __SF_MESSAGE_QUEUE_H__
|
||||
#define __SF_MESSAGE_QUEUE_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_enum.h"
|
||||
#include "sf_param_struct.h"
|
||||
|
||||
SINT32 sf_com_message_app_init(void);
|
||||
SINT32 sf_com_message_send_to_app(SF_MESSAGE_BUF_S *pMessageBuf);
|
||||
SINT32 sf_com_message_recv_from_app(SF_MESSAGE_BUF_S *pMessageBuf);
|
||||
|
||||
|
||||
SINT32 sf_com_message_cardv_init(void);
|
||||
SINT32 sf_com_message_send_to_cardv(SF_MESSAGE_BUF_S *pMessageBuf);
|
||||
SINT32 sf_com_message_recv_from_cardv(SF_MESSAGE_BUF_S *pMessageBuf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
130
code/application/source/sf_app/code/include/sf_module.h
Executable file
130
code/application/source/sf_app/code/include/sf_module.h
Executable file
|
@ -0,0 +1,130 @@
|
|||
#ifndef __SF_MODULE_H__
|
||||
#define __SF_MODULE_H__
|
||||
#include "sf_param_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#define IMEI_LEN 15
|
||||
|
||||
|
||||
#define EG91 "EG91"
|
||||
#define EG95 "EG95"
|
||||
|
||||
#define APNGPRS_WUYUAN "America.bics"
|
||||
#define APNGPRS_WUYUAN2 "bicsapn"
|
||||
#define APNGPRSTEMP "CTNET"
|
||||
#define APNGPRSTEMP2 "3gnet"
|
||||
#define APNGPRSTEMP3 "CMNET"
|
||||
|
||||
|
||||
|
||||
#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_4G_ERROR_AT_APN SF_ERR_ID(SF_MOD_4G, ERROR_AT_APN)
|
||||
#define SF_4G_ERROR_AT_TIMEOUT SF_ERR_ID(SF_MOD_4G, ERROR_AT_TIMEOUT)
|
||||
#define SF_4G_ERROR_AT_ACTIVE SF_ERR_ID(SF_MOD_4G, ERROR_AT_ACTIVE)
|
||||
#define SF_4G_ERROR_AT_READ SF_ERR_ID(SF_MOD_4G, ERROR_AT_READ)
|
||||
#define SF_4G_ERROR_AT_OPEN SF_ERR_ID(SF_MOD_4G, ERROR_AT_OPEN)
|
||||
#define SF_4G_ERROR_AT_DISCONNECT SF_ERR_ID(SF_MOD_4G, ERROR_AT_DISCONNECT)
|
||||
#define SF_4G_ERROR_NO_SIMCARD SF_ERR_ID(SF_MOD_4G, ERROR_NO_SIMCARD)
|
||||
#define SF_4G_ERROR_NO_SUPPOET SF_ERR_ID(SF_MOD_4G, ERROR_NO_SUPPORT)
|
||||
#define SF_4G_ERROR_NO_SIGNAL SF_ERR_ID(SF_MOD_4G, ERROR_NO_SIGNAL)
|
||||
#define SF_4G_ERROR_FILE_SEND SF_ERR_ID(SF_MOD_4G, ERROR_FILE_SEND)
|
||||
#define SF_4G_ERROR_IP_ADDR SF_ERR_ID(SF_MOD_4G, ERROR_IP_ADDR)
|
||||
#define SF_4G_ERROR_MODULE_OPEN SF_ERR_ID(SF_MOD_4G, ERROR_MODULE_OPEN)
|
||||
#define SF_4G_ERROR_REG_NET SF_ERR_ID(SF_MOD_4G, ERROR_REG_NET)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum sf4G_STATUS_E
|
||||
{
|
||||
SF_4G_OK = 0x01,
|
||||
SF_4G_FAIL = 0x02,
|
||||
SF_4G_FREE = 0x03,
|
||||
SF_4G_SENDING = 0x04,
|
||||
SF_4G_SEARCHING = 0X05,
|
||||
SF_4G_REBOOT = 0x06,
|
||||
SF_4G_BUTT = 0x07,
|
||||
} SF_4G_STATUS_E;
|
||||
|
||||
//SINT32 sf_4G_cfun_set();
|
||||
|
||||
//SINT32 sf_4G_qsclk_set();
|
||||
|
||||
|
||||
|
||||
SINT32 sf_4G_signal_level_get(SINT8 net,SINT8 signal,UINT8* value);
|
||||
|
||||
void sf_4G_usb_init(void);
|
||||
|
||||
SF_4G_STATUS_E sf_4G_status_get(void);
|
||||
|
||||
void sf_4G_status_set(SF_4G_STATUS_E enStatus);
|
||||
|
||||
SINT32 sf_4G_sim_IsInsert(void);
|
||||
|
||||
SINT32 sf_4G_file_transfer(SF_CHAR *fileName, SINT32 *fileSize, SF_FILE_TYPE_E fileType);
|
||||
|
||||
SINT32 sf_4G_http_config(SF_FN_PARAM_S *pfnParam, UINT8 sslOn, UINT8 autoReqHead);
|
||||
|
||||
SINT32 sf_4G_http_authenrequst(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_http_pushfile(SF_FILE_ATTR_S *pstFileAttr,SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_server_open(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_server_transferdata(SF_DATA_ATTR_S *psenddate, SF_FN_PARAM_S *pfnParam, UINT8 needRepose);
|
||||
|
||||
SINT32 sf_4G_server_close(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_gps_greendate_Get(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime);
|
||||
|
||||
SINT32 sf_4G_gps_Isupdate(SF_FN_PARAM_S *pfnParam,UINT8 *pIsupdate,SF_PARA_TIME_S *pNowTime,UINT8 u8day);
|
||||
|
||||
SINT32 sf_4G_gps_preconfig(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_gps_search(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime,UINT8 autoModeFlag);
|
||||
|
||||
SINT32 sf_4G_gps_search_result(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_iccid_get(SF_CHAR *iccid,SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_qsclk_set(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_sim_init(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_register_net_manual(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_register_net_auto(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_usb_net_apn_cfg(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_acm_tcp_server_open(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_acm_tcp_server_transferdata(SF_DATA_ATTR_S *psenddate, SF_FN_PARAM_S *pfnParam, UINT8 needRepose);
|
||||
|
||||
SINT32 sf_4G_acm_tcp_server_close(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_4G_other_sim_apn_cfg(SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
39
code/application/source/sf_app/code/include/sf_opera_adapt.h
Executable file
39
code/application/source/sf_app/code/include/sf_opera_adapt.h
Executable file
|
@ -0,0 +1,39 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015-2020 by WuYuan Technology, Inc.
|
||||
*
|
||||
* This software is copyrighted by and is the property of SiFar
|
||||
* Technology, Inc.. All rights are reserved by SiFar Technology, Inc..
|
||||
* This software may only be used in accordance with the corresponding
|
||||
* license agreement. Any unauthorized use, duplication, distribution,
|
||||
* or disclosure of this software is expressly forbidden.
|
||||
*
|
||||
* This Copyright notice MUST not be removed or modified without prior
|
||||
* written consent of SiFar Technology, Inc..
|
||||
*
|
||||
* WuYuan Technology, Inc. reserves the right to modify this software without notice.
|
||||
*
|
||||
* Author: jiamin
|
||||
* Ver: 1.0.0 2020.09.17
|
||||
* Description: creat
|
||||
**************************************************************************/
|
||||
#ifndef _SF_OPERATION_ADAPTATION_H_
|
||||
#define _SF_OPERATION_ADAPTATION_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_param_common.h"
|
||||
#include "sf_module.h"
|
||||
|
||||
UINT16 sf_auto_operation_adaptation(SF_CHAR *operatorName, SF_PDT_PARAM_STATISTICS_S *sim_info_t);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
67
code/application/source/sf_app/code/include/sf_param_common.h
Executable file
67
code/application/source/sf_app/code/include/sf_param_common.h
Executable file
|
@ -0,0 +1,67 @@
|
|||
#ifndef __SF_PARAM_COMMON_H__
|
||||
#define __SF_PARAM_COMMON_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_enum.h"
|
||||
#include "sf_param_struct.h"
|
||||
#include "UIInfo/UIInfo.h"
|
||||
|
||||
void sf_sleep_ms(S32 millisecond);
|
||||
|
||||
void sf_sleep_s(S32 second);
|
||||
|
||||
const SF_CHAR* sf_poweron_type_string(SF_STARTUP_TYPE_E enType);
|
||||
|
||||
SF_STARTUP_TYPE_E sf_poweron_type_get(void);
|
||||
|
||||
SINT32 sf_poweron_type_set(SF_STARTUP_TYPE_E enType);
|
||||
|
||||
void sf_customer_param_init(void);
|
||||
|
||||
SF_PDT_PARAM_CFG_S* sf_customer_param_get(void);
|
||||
|
||||
void sf_customer_param_set(SF_PDT_PARAM_CFG_S *pSfCustomerPara);
|
||||
|
||||
void sf_customer_param_reset(SF_PDT_PARAM_CFG_S *psfpdtparam,UINT8 sysRet);
|
||||
|
||||
SINT32 sf_customer_param_save(SF_PDT_PARAM_CFG_S *pSfCustomerPara);
|
||||
|
||||
int sf_customer_param_load(void);
|
||||
|
||||
|
||||
void sf_statistics_param_init(void);
|
||||
|
||||
SF_PDT_PARAM_STATISTICS_S* sf_statistics_param_get(void);
|
||||
|
||||
void sf_statistics_param_reset(SF_PDT_PARAM_STATISTICS_S *pSfPara);
|
||||
|
||||
void sf_statistics_param_specify(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam);
|
||||
|
||||
SINT32 sf_statistics_param_save(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam);
|
||||
|
||||
SINT32 sf_statistics_param_load(SF_PDT_PARAM_STATISTICS_S* pStatisticsParam);
|
||||
|
||||
void sf_all_param_reset(void);
|
||||
|
||||
void sf_cap_status_set(UINT8 capStatus);
|
||||
|
||||
UINT8 sf_cap_status_get(void);
|
||||
|
||||
SF_URL_S* sf_ota_url_get(void);
|
||||
|
||||
extern void SysSetFlag(UINT32 uiFlag, UINT32 uiValue);
|
||||
extern UINT32 SysGetFlag(UINT32 uiFlag);
|
||||
extern UIMenuStoreInfo* sf_ui_para_get(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
434
code/application/source/sf_app/code/include/sf_param_enum.h
Executable file
434
code/application/source/sf_app/code/include/sf_param_enum.h
Executable file
|
@ -0,0 +1,434 @@
|
|||
#ifndef __SF_PARAM_ENUM_H__
|
||||
#define __SF_PARAM_ENUM_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#include <io/gpio.h>
|
||||
|
||||
#define SF_MUTEX_INIT_LOCK(mutex) \
|
||||
do { \
|
||||
(void)pthread_mutex_init(&mutex, NULL); \
|
||||
} while (0)
|
||||
|
||||
#define SF_MUTEX_LOCK(mutex) \
|
||||
do { \
|
||||
(void)pthread_mutex_lock(&mutex); \
|
||||
} while (0)
|
||||
|
||||
#define SF_MUTEX_UNLOCK(mutex) \
|
||||
do { \
|
||||
(void)pthread_mutex_unlock(&mutex); \
|
||||
} while (0)
|
||||
|
||||
#define SF_MUTEX_DESTROY(mutex) \
|
||||
do { \
|
||||
(void)pthread_mutex_destroy(&mutex); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define SF_APPCOMM_CHECK_RETURN(ret, errcode) \
|
||||
do { \
|
||||
if (SF_SUCCESS != ret) { \
|
||||
MLOGE("Error Code: [0x%08X]\n\n", ret); \
|
||||
return errcode; \
|
||||
} \
|
||||
} while (0)
|
||||
#define SF_APPCOMM_CHECK_OPENFILE_RETURN(ret, str,errcode) \
|
||||
do { \
|
||||
if (ret < 0) { \
|
||||
MLOGE("open file: [%s] failed!!!\n\n", str); \
|
||||
return errcode; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define SF_CS_CHECK_BERAK(ret) \
|
||||
if (SF_SUCCESS != ret) { \
|
||||
MLOGE("Error Code: [0x%08X]\n\n", ret); \
|
||||
break; \
|
||||
}
|
||||
#define SF_COMM_CHECK_POINTER(p, errcode) \
|
||||
do { \
|
||||
if (!(p)) { \
|
||||
MLOGE("pointer[%s] is NULL\n", #p); \
|
||||
return errcode; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define SF_TTYUSB_RECV_MAX 580
|
||||
#define SF_HTTP_RECV_MAX 4096
|
||||
|
||||
|
||||
#define CFG_FLAT_ANGLE_LEN
|
||||
//#define CFG_WIDE_ANGLE_LEN
|
||||
|
||||
|
||||
#define SF_VER_MAX_LEN 12
|
||||
|
||||
|
||||
|
||||
#define SF_BATCH_MAX_NUMBER (2)
|
||||
|
||||
#define SF_CAMERA_NAME_MAX_LEN (12)
|
||||
#define SF_ICCID_MAX_LEN (22)
|
||||
#define SF_DAILY_MAX_NUMBER (2)
|
||||
#define SF_IMEI_MAX_LEN (32)
|
||||
#define SF_OPERATOR_CODE_MAX_LEN (8)
|
||||
#define SF_APN_MAX_LEN (40)
|
||||
#define SF_APN_PASSWORD_MAX_LEN (20)
|
||||
#define SF_FTP_MAX_LEN (40)
|
||||
#define SF_FTP_PORT_MAX_LEN (5)
|
||||
#define SF_GPS_INFO_MAX_LEN (16)
|
||||
#define SF_MODULE_VER_MAX_LEN (50)
|
||||
#define SF_BIND_ACCOUNT_MAX_LEN (50)
|
||||
#define SF_TOKEN_MAX_LEN (64)
|
||||
#define SF_ALIVE_IP_MAX_LEN (32)
|
||||
#define SF_UUID_MAX_LEN (32)
|
||||
|
||||
|
||||
#define SF_MAX_PATH_LEN 128
|
||||
#define SF_MAX_PIC_LEN 64
|
||||
#define SF_SRCFILE_MAX 4
|
||||
#define SF_THUMB_FILE_MAX_LEN 20
|
||||
|
||||
|
||||
#define GPIOID_PIR_TEST 3
|
||||
#define GPIOID_SIM_INSRET 4
|
||||
#define GPIOID_USB_INSERT 61
|
||||
#define GPIOID_WIFI_POWER 6
|
||||
#define GPIOID_USB_MUX1 16 //t100 only one usb mux
|
||||
#define GPIOID_USB_MUX2 16
|
||||
|
||||
#define GPIOID_ADC_MUXA 52
|
||||
#define GPIOID_ADC_MUXB 53
|
||||
|
||||
#define GPIOID_IRCUT_MEN1 50
|
||||
#define GPIOID_IRCUT_MEN2 51
|
||||
|
||||
|
||||
#define SD_WARNING_SPACE 30 /*30MB*/
|
||||
|
||||
|
||||
|
||||
#define HTTP_PORT 80
|
||||
#define HTTPS_PORT 443
|
||||
#define HTTPCLIENT_REV_SIZE 512
|
||||
#define BUFFER_SIZE 2048
|
||||
|
||||
|
||||
#define SF_DEV_NOT_EXIST 20002
|
||||
#define SF_DEV_NOT_BIND 20006
|
||||
#define SF_SYS_ERR 1
|
||||
#define SF_PARA_ERR 3
|
||||
#define SF_USER_NOT_EXIST 10006
|
||||
#define SF_SIM_NOT_EXIST 30002
|
||||
#define SF_SIM_NET_NOT_TURN_ON 30004
|
||||
#define SF_SIM_DEV_NOT_BIND 20011
|
||||
#define SF_DEV_DETAILS_NOT_VILLAGE 20009
|
||||
#define SF_DEV_AUTH_INVALID 401
|
||||
|
||||
|
||||
#define MSYS_IOCTL_MAGIC 'S'
|
||||
#define IOCTL_MSYS_GET_RTOSSTATUS _IO(MSYS_IOCTL_MAGIC, 0x95)
|
||||
#define IOCTL_MSYS_GET_MODULE_DATA _IO(MSYS_IOCTL_MAGIC, 0x96)
|
||||
#define IOCTL_MSYS_GET_SY_RTOS_DATA _IO(MSYS_IOCTL_MAGIC, 0x97)
|
||||
#define IOCTL_MSYS_SET_RTOS_CMD _IO(MSYS_IOCTL_MAGIC, 0x98)
|
||||
|
||||
#define DEFAULT_RTC_DEVICE "/dev/rtc0"
|
||||
|
||||
#define SF_SD_ROOT "/mnt/sd/"
|
||||
|
||||
#define SIFAR_CUSTOMER_PARAM_PATH "/misc/sfSysParm.bin"
|
||||
#define SIFAR_STATISTICS_PARAM_PATH "/mnt/sd/DCIM/THUMB/sfStatisticsParm.bin"
|
||||
|
||||
|
||||
|
||||
#define GPIO_DIR_OUT 1
|
||||
#define GPIO_DIR_IN 0
|
||||
|
||||
#define AMZ_HOST "s3.amazonaws.com"
|
||||
#define AMZ_PW_TITLE "AWS4"
|
||||
#define SECRET_TYPE "AWS4-HMAC-SHA256"
|
||||
#define SECRET_VER "aws4_request"
|
||||
#define AMZ "s3"
|
||||
|
||||
#define SF_4G_PIC_THUMB_PATH SF_SD_ROOT"DCIM/THUMB/"
|
||||
#define SF_4G_SMALL_VIDEO_STREAM_PATH SF_SD_ROOT"DCIM/SMALL/"
|
||||
#define SIM_AUTO_MATCH_FILE_PATH SF_SD_ROOT"SIM Auto Match.TXT"
|
||||
|
||||
#define SF_DCF_DIR_NAME_SUFFIX "SYCAM" /**< DCF Directory Name (it must be 5-characters) */
|
||||
#define SF_DCF_ROOT_DIR_NAME "DCIM" /**< DCF Root Directory Name */
|
||||
#define SF_DCF_THM_DIR_NAME "THUMB" /**< DCF Directory Name (it must be 5-characters) */
|
||||
|
||||
#define SF_DCF_EXT_PHOTO "jpg" /**< File extenstion name for Date DB */
|
||||
#define SF_DCF_EXT_MOV "mp4" /**< File extenstion name for Date DB */
|
||||
#define SF_DCF_EXT_AUDIO "WAV" /**< File extenstion name for Date DB */
|
||||
#define SF_DCF_EXT_THM "jpg" /**< File extenstion name for Date DB */
|
||||
|
||||
#if defined(CFG_FLAT_ANGLE_LEN)
|
||||
#define SF_DCF_FILE_NAME_PREFIX "HRT1"
|
||||
#elif defined(CFG_WIDE_ANGLE_LEN)
|
||||
#define SF_DCF_FILE_NAME_PREFIX "SWT1"
|
||||
#else
|
||||
#define SF_DCF_FILE_NAME_PREFIX "SYEW"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#define SF_QLOG_ENABLE 1
|
||||
//#define SF_VERSION_RELEASE
|
||||
//#define SF_HARDWARE_TEST
|
||||
//#define SF_FACTORY_TEST
|
||||
//#define SF_GPS_TEST
|
||||
#define SF_EMC_TEST
|
||||
|
||||
#define CMD_SHORT_LONG_CLICK_OFFSET (128)
|
||||
|
||||
#ifdef SF_VERSION_RELEASE
|
||||
#define ACCESS_KEY "ACT1CSHKRO01"
|
||||
#else
|
||||
#define ACCESS_KEY "AC40CSHKRO01"
|
||||
#endif
|
||||
|
||||
#define SF_ERR_ID(module, err) ((SINT16)(((module) << 8) | (err)))
|
||||
/** SF Module ID */
|
||||
typedef enum SF_MOD_e {
|
||||
|
||||
SF_MOD_4G = 1,
|
||||
SF_MOD_GPS,
|
||||
SF_MOD_FILE,
|
||||
SF_MOD_HTTP,
|
||||
SF_MOD_TTY,
|
||||
SF_MOD_DATA,
|
||||
SF_MOD_COM,
|
||||
SF_MOD_LOG,
|
||||
SF_MOD_STORE,
|
||||
SF_MOD_SYS,
|
||||
SF_MOD_APP,
|
||||
SF_MOD_BUTT,
|
||||
} SF_MOD_E;
|
||||
|
||||
typedef enum ERR_CODE_e{
|
||||
ERROR_AT_APN,
|
||||
ERROR_AT_TIMEOUT,
|
||||
ERROR_AT_ACTIVE,
|
||||
ERROR_AT_READ,
|
||||
ERROR_AT_WRITE,
|
||||
ERROR_AT_OPEN,
|
||||
ERROR_AT_DISCONNECT,
|
||||
ERROR_NO_SIMCARD,
|
||||
ERROR_NO_SUPPORT,
|
||||
ERROR_NO_SIGNAL,
|
||||
ERROR_NO_FILE,
|
||||
ERROR_FILE_SEND,
|
||||
ERROR_INS_EXIT,
|
||||
ERROR_NOT_MATCH,
|
||||
ERROR_IP_ADDR,
|
||||
ERROR_IP_CHANGE,
|
||||
ERROR_REQUEST,
|
||||
ERROR_WRITE,
|
||||
ERROR_DATA_FORMAT,
|
||||
ERROR_MODULE_OPEN,
|
||||
ERROR_REG_NET,
|
||||
ERROR_BUTT,
|
||||
}ERR_CODE_E;
|
||||
typedef enum sf_FILE_TYPE_E
|
||||
|
||||
{
|
||||
SF_FILE_TYPE_PIC_THUM_3M = 0x00,
|
||||
SF_FILE_TYPE_PIC_3M = 0x01,
|
||||
SF_FILE_TYPE_VIDEO_THUM_WVGA = 0X02,
|
||||
SF_FILE_TYPE_VIDEO_WVGA = 0X03,
|
||||
SF_FILE_TYPE_VIDEO_THUM_720P = 0X04,
|
||||
SF_FILE_TYPE_VIDEO_720P = 0X05,
|
||||
SF_FILE_TYPE_VIDEO_THUM_1080P = 0X06,
|
||||
SF_FILE_TYPE_VIDEO_1080P = 0X07,
|
||||
SF_FILE_TYPE_PIC_THUM_5M = 0x08,
|
||||
SF_FILE_TYPE_PIC_5M = 0x09,
|
||||
SF_FILE_TYPE_LOG_ERROR = 0x0A,
|
||||
SF_FILE_TYPE_CFG = 0x0B,
|
||||
SF_FILE_TYPE_TRIGGER = 0x0C,
|
||||
|
||||
SF_FILE_TYPE_PIC_BIG,
|
||||
SF_FILE_TYPE_PIC_SMALL,
|
||||
SF_FILE_TYPE_PIC_VIDEO,
|
||||
SF_FILE_TYPE_VIDEO,
|
||||
SF_FILE_TYPE_LOG_DP, /*dailyreport file*/
|
||||
SF_FILE_TYPE_GPS,
|
||||
SF_FILE_TYPE_TXT,
|
||||
SF_FILE_TYPE_UPDATE,
|
||||
SF_FILE_TYPE_FOTA,
|
||||
SF_FILE_TYPE_BT_ALARM, /*Bettery Alarm*/
|
||||
SF_FILE_TYPE_OTHER,
|
||||
SF_FILE_TYPE_BUTT,
|
||||
}SF_FILE_TYPE_E;
|
||||
|
||||
typedef enum {
|
||||
SF_USB_MUX_HOST_4G = 0,
|
||||
SF_USB_MUX_PC_4G = 1,
|
||||
SF_USB_MUX_PC_HOST =2,
|
||||
SF_USB_MUX_MAX = 3,
|
||||
}SF_USB_MUX_FUN_e;
|
||||
|
||||
typedef enum sfSD_STATUS_E
|
||||
{
|
||||
SF_SD_UNPLUGED = 0x00,
|
||||
SF_SD_OUT,
|
||||
SF_SD_OK,
|
||||
SF_SD_FULL,
|
||||
SF_SD_ERROR,
|
||||
SF_SD_PLUGED,
|
||||
SF_SD_BUTT,
|
||||
} SF_SD_STATUS_E;
|
||||
|
||||
typedef enum sf_STARTUP_TYPE_E
|
||||
{
|
||||
SF_MCU_STARTUP_OFF = 0x00,/* POWER OFF*/
|
||||
SF_MCU_STARTUP_ONKEY = 0x01,/*key on SETUP*/
|
||||
SF_MCU_STARTUP_TIMELAPSE = 0x02,/*timelapse power on*/
|
||||
SF_MCU_STARTUP_NORMAL = 0x03,/*Dial the key to ON*/
|
||||
SF_MCU_STARTUP_RING = 0x04,/*ring power on*/
|
||||
SF_MCU_STARTUP_PIR = 0x05,/*pir power on*/
|
||||
SF_MCU_STARTUP_WARNING = 0x06,/*low bat worning power on*/
|
||||
SF_MCU_STARTUP_SERVER = 0x07,/*server power on(reserve)*/
|
||||
SF_MCU_STARTUP_DP = 0x08,/*DailyReport power on*/
|
||||
SF_MCU_STARTUP_USB = 0x09,/*USB power on*/
|
||||
SF_MCU_STARTUP_RESET = 0x0A,/*power on to reset(reserve)*/
|
||||
SF_MCU_STARTUP_SYN_PARAM = 0x0B,/*power on to syn param(reserve)*/
|
||||
SF_MCU_STARTUP_BATCH_SEND= 0x0C,/*power on to send batch*/
|
||||
SF_MCU_STARTUP_BUTT = 0X0D,
|
||||
} SF_STARTUP_TYPE_E;
|
||||
|
||||
typedef enum sfPOWEROFF_TYPE_E
|
||||
{
|
||||
SF_POWEROFF_NOT = 0x00,
|
||||
SF_POWEROFF_AUTO = 0x01, /*auto power when 3min no operation*/
|
||||
SF_POWEROFF_REBOOT = 0x02, /*poweroff to reboot*/
|
||||
SF_POWEROFF_KEYON = 0x03,
|
||||
SF_POWEROFF_KEYOFF = 0x04,
|
||||
SF_POWEROFF_SYNC_PARAM = 0x05,
|
||||
SF_POWEROFF_GPS_DP = 0x06,
|
||||
SF_POWEROFF_SD_FULL = 0x07,
|
||||
SF_POWEROFF_LOW_BAT = 0x08,
|
||||
SF_POWEROFF_NO_SD = 0x09,
|
||||
SF_POWEROFF_BUTT,
|
||||
} SF_POWEROFF_TYPE_E;
|
||||
|
||||
typedef enum sf_CAMMODE_E
|
||||
{
|
||||
SF_CAMMODE_PIC = 0,
|
||||
SF_CAMMODE_VIDEO ,
|
||||
SF_CAMMODE_PV, /* pic+video*/
|
||||
SF_CAMMODE_BUTT
|
||||
}SF_CAMMODE_E;
|
||||
typedef enum sf_IMG_SIZE_E
|
||||
{
|
||||
SF_IMG_SIZE_32M = 0,
|
||||
SF_IMG_SIZE_24M,
|
||||
SF_IMG_SIZE_12M,
|
||||
SF_IMG_SIZE_8M,
|
||||
SF_IMG_SIZE_5M,
|
||||
SF_IMG_SIZE_3M,
|
||||
SF_IMG_SIZE_BUTT
|
||||
}SF_IMG_SIZE_E;
|
||||
typedef enum sf_VIDEO_SIZE_E
|
||||
{
|
||||
SF_VIDEO_SIZE_1080 = 0,
|
||||
SF_VIDEO_SIZE_720,
|
||||
SF_VIDEO_SIZE_WVGA,
|
||||
SF_VIDEO_SIZE_BUTT
|
||||
}SF_VIDEO_SIZE_E;
|
||||
typedef enum sfBAT_TYPE_E
|
||||
{
|
||||
SF_BAT_AL = 0x00,
|
||||
SF_BAT_NI = 0x01,
|
||||
SF_BAT_LI = 0x02,
|
||||
SF_BAT_CUS_LI = 0x03,
|
||||
SF_BAT_BUTT,
|
||||
} BAT_TYPE_E;
|
||||
typedef enum sf_MESSAGE_TYPE_E
|
||||
{
|
||||
CMD_KEY = 0x1A00,
|
||||
CMD_SD = 0x1B00,
|
||||
CMD_LED = 0x1C00,
|
||||
CMD_FILE = 0x1D00,
|
||||
CMD_POWEROFF = 0x1E00,
|
||||
CMD_VENC = 0x1F00,
|
||||
|
||||
}SF_MESSAGE_TYPE_E;
|
||||
|
||||
|
||||
typedef enum sf_MESSAGE_CMD_SD_e
|
||||
{
|
||||
CMD_SD_MOUNT_SUCCESS = 0x01,
|
||||
CMD_SD_ERROR = 0x02,
|
||||
CMD_SD_OUT = 0x03,
|
||||
CMD_SD_FULL = 0x04,
|
||||
CMD_SD_MOUNT_FAILURE = 0x05,
|
||||
|
||||
}SF_MESSAGE_CMD_SD_E;
|
||||
|
||||
typedef enum sf_MESSAGE_CMD_LEDD_e
|
||||
{
|
||||
|
||||
CMD_LED_EVT = 0x01,
|
||||
|
||||
}SF_MESSAGE_CMD_LED_E;
|
||||
|
||||
typedef enum sf_MESSAGE_CMD_VENC_e
|
||||
{
|
||||
|
||||
CMD_VENC_START_SUCCESS = 0x01,
|
||||
CMD_VENC_START_FAILURE = 0x02,
|
||||
CMD_VENC_STOP_SUCCESS = 0x03,
|
||||
CMD_VENC_STOP_FAILURE = 0x04,
|
||||
CMD_VENC_STREAM_START = 0x05,
|
||||
CMD_VENC_STREAM_STOP = 0x06,
|
||||
}SF_MESSAGE_CMD_VENC_E;
|
||||
#ifdef CFG_TRANSDATA_AT
|
||||
|
||||
typedef enum sf_UPLOAD_STATUS_E{
|
||||
SF_UPLOAD_FTP = 0x01,
|
||||
SF_UPLOAD_OSS,
|
||||
SF_UPLOAD_AMZ,
|
||||
SF_UPLOAD_BUTT,
|
||||
} SF_UPLOAD_STATUS_E;
|
||||
#else
|
||||
typedef enum sf_UPLOAD_STATUS_E{
|
||||
SF_UPLOAD_FTP = 0x00,
|
||||
SF_UPLOAD_OSS,
|
||||
SF_UPLOAD_AMZ,
|
||||
SF_UPLOAD_BUTT,
|
||||
} SF_UPLOAD_STATUS_E;
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum sf_DATE_TYPE_E{
|
||||
DATE_TYPE_YYMMDD = 0,
|
||||
DATE_TYPE_MMDDYY,
|
||||
DATE_TYPE_DDMMYY,
|
||||
DATE_TYPE_BUTT,
|
||||
} SF_DATE_TYPE_E;
|
||||
typedef enum sf_SIM_TYPE_E
|
||||
{
|
||||
SF_SIM_MEGA = 0, // normal mega sim, use in abroad
|
||||
SF_SIM_MEGA_IOT, //special mega sim, only use in T110
|
||||
SF_SIM_OTHER, //other sim
|
||||
SF_SIM_BUTT
|
||||
}SF_SIM_TYPE_E;
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
359
code/application/source/sf_app/code/include/sf_param_struct.h
Executable file
359
code/application/source/sf_app/code/include/sf_param_struct.h
Executable file
|
@ -0,0 +1,359 @@
|
|||
#ifndef __SF_PARAM_STRUCT_H__
|
||||
#define __SF_PARAM_STRUCT_H__
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_enum.h"
|
||||
|
||||
|
||||
typedef struct sf_URL_s {
|
||||
SF_CHAR url[160];
|
||||
}SF_URL_S;
|
||||
|
||||
typedef struct sf_OSS_s {
|
||||
UINT8 szIP[64];
|
||||
UINT8 szBucket[32];
|
||||
UINT8 szUsername[32];
|
||||
UINT8 szPassword[48];
|
||||
}SF_OSS_S;
|
||||
|
||||
typedef struct sf_THREAD_CFG_S {
|
||||
unsigned char IsRun;
|
||||
unsigned char IsStopFlag;
|
||||
pthread_t TskId;
|
||||
} SF_THREAD_CFG_S ;
|
||||
|
||||
#ifndef SF_DATA_UI_TYPE
|
||||
#define SF_DATA_UI_TYPE
|
||||
#define SF_TIMER_MAX_NUMBER (2)
|
||||
typedef struct SF_PARA_TIME_S {
|
||||
|
||||
UINT16 Year;
|
||||
UINT16 Mon;
|
||||
UINT16 Day;
|
||||
|
||||
UINT16 Hour;
|
||||
UINT16 Min;
|
||||
UINT16 Sec;
|
||||
} SF_PARA_TIME_S;
|
||||
|
||||
typedef struct SF_WORKTIME_S
|
||||
{
|
||||
SF_PARA_TIME_S StartTime;
|
||||
SF_PARA_TIME_S StopTime;
|
||||
} SF_WORKTIME_S;
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct sf_subscribe_ATTR_S {
|
||||
UINT8 subscribeType;
|
||||
char subscribeFileName[40];
|
||||
}SF_SUBSCRIBE_ATTR_S;
|
||||
|
||||
typedef struct sf_subscribe_file_ATTR_S {
|
||||
UINT8 subscribeCnt;
|
||||
SF_SUBSCRIBE_ATTR_S *pSubscribe;
|
||||
}SF_SUBSCRIBE_FILE_ATTR_S;
|
||||
|
||||
#ifndef SF_PDT_PARAM_CFG_S
|
||||
typedef struct sfPDT_PARAM_CFG_S
|
||||
{
|
||||
/*camera param*/
|
||||
UINT8 WorkMode;
|
||||
UINT8 CamMode; // Picture, Video, Picture+Video
|
||||
UINT8 ImgSize; // 8M, 16M, 32M
|
||||
UINT8 VideoSize; // WVGA, 720P, 1080P
|
||||
UINT8 VideoLenth;
|
||||
UINT8 Multishot; // shot picture number 1~5,1 single shot 2~5 continuous shot
|
||||
UINT8 MultishotInterval; // shot interval. 0: shot in one second; 1: 1 pic per sec; 2: 2 pic per sec
|
||||
UINT8 NightMode;
|
||||
UINT8 FlashLed;
|
||||
UINT8 PirSensitivity;
|
||||
UINT8 PirDelaySwitch; /*DelayFlag;*/
|
||||
UINT8 TimelapseSwitch;
|
||||
UINT8 WorkTime1Switch; /*WorkTime*/
|
||||
UINT8 WorkTime2Switch; /*WorkTime*/
|
||||
UINT8 CameraNameFlag;
|
||||
UINT8 PirSwitch;
|
||||
UINT8 SdLoop; /*SdCycle*/
|
||||
UINT8 DigitPirSensitivity;
|
||||
|
||||
UINT8 DailyReportswitch;
|
||||
UINT8 ReDailyReport; /*if network error, reboot an hour later,liteOS need this param,not separete*/
|
||||
UINT8 FristSendDailyAndGps;
|
||||
|
||||
UINT8 GprsMode; /*0:Daily, 1:Intant*/
|
||||
UINT8 GprsSwitch; /*0:gprs off, 1:gprs on*/
|
||||
UINT8 SendMaxNum;
|
||||
UINT8 SendPicSize; // thumbnail 0:640*480, 1:1920*1440
|
||||
UINT8 SendType; /*0:send immediately, 1:send once per day, 2:send twice per day*/
|
||||
UINT8 SendMultishot;
|
||||
UINT8 SendVideo;
|
||||
UINT8 SendPhoto;
|
||||
|
||||
UINT8 BatteryType;
|
||||
UINT8 StampSwitch;
|
||||
UINT8 DateStyle;
|
||||
UINT8 DebugMode;
|
||||
UINT8 Zoom; // APP preview magnification, 1x,2x,4z
|
||||
UINT8 LightFreq; // 50HZ, 60H
|
||||
SINT8 TimeZone;
|
||||
|
||||
UINT8 GpsSwitch; /*0:OFF 1:ON*/
|
||||
UINT8 GpsSendType; /*0:when camera trun on 1: one time 2:twice time*/
|
||||
UINT8 DateAuto;
|
||||
UINT8 PicUponDailyReport;
|
||||
UINT8 FtpSwitch;
|
||||
UINT8 VideoFrame;
|
||||
UINT8 ParaSync;
|
||||
UINT16 RTCYear;
|
||||
UINT8 RtcMonth;
|
||||
UINT8 RTCDay;
|
||||
UINT8 RTCHour;
|
||||
UINT8 RTCMinute;
|
||||
UINT8 RTCSecond;
|
||||
UINT8 FirstUpdateFlag; /*1: indicate first update start*/
|
||||
UINT8 FormateFlag;
|
||||
UINT8 Formatestatus;
|
||||
UINT8 ResetFlag;
|
||||
UINT8 GPSFlag;
|
||||
UINT8 BatchSendTimelapse;
|
||||
UINT8 GPSEnterResetModeFlag;
|
||||
UINT8 GPSWaitRestartFlag;
|
||||
UINT8 GPSMapeUpdateFlag;
|
||||
UINT8 GPSAntitheftFlag;
|
||||
UINT8 Lastsetuptype;
|
||||
UINT8 OtaFlag;
|
||||
SF_PARA_TIME_S TimelapseTime;
|
||||
SF_WORKTIME_S WorkTime[SF_TIMER_MAX_NUMBER];
|
||||
SF_PARA_TIME_S PirDelayTime;
|
||||
SF_PARA_TIME_S DailyReportTime;
|
||||
SF_PARA_TIME_S TimeSend1;/*batch send1 time*/
|
||||
|
||||
char CameraNameStr[SF_CAMERA_NAME_MAX_LEN];
|
||||
UINT32 CheckSum;
|
||||
}SF_PDT_PARAM_CFG_S;
|
||||
#endif
|
||||
typedef struct sfPDT_PARAM_STATISTICS_S
|
||||
{
|
||||
/*DailyReport Part*/
|
||||
UINT8 DailyReportNum;/*0:OFF, 1:one time per day, 2:two Times per day*/
|
||||
UINT16 DialyReportFailCnt;
|
||||
UINT16 Year;
|
||||
UINT16 Mon;
|
||||
UINT16 Day;
|
||||
|
||||
UINT16 TriggerTimes;
|
||||
UINT8 SubscribeSendCnt;
|
||||
UINT8 SubVideoSendCnt;
|
||||
UINT8 SendBatchAgain; /*copy from 3.8CG needReConcentratedSend*/
|
||||
UINT8 DailyReportAgain; /* copy from 3.8CG ReDailyFlag:if network error, reboot an hour later*/
|
||||
UINT16 SendPicDayCnt; /*copy from 3.8CG picSendMax, send success pic number per day*/
|
||||
UINT16 SendDailyCnt; /*send pic count success+fail*/
|
||||
UINT16 SendDailyThumbCnt;/* send small pic times, success + fail*/
|
||||
UINT16 SendSuccessThumbCnt;/* send small pic times, success*/
|
||||
UINT16 SendDailyOriginalCnt;
|
||||
UINT16 SendSuccessOriginalCnt;
|
||||
UINT16 SendDailyVideoCnt;/* send video times, success + fail*/
|
||||
UINT16 SendSuccessVideoCnt;/* send video times,success*/
|
||||
UINT32 SendThumbTotalTime;/* send small pic time, uint:second*/
|
||||
UINT32 SendOriginalTotalTime;
|
||||
UINT32 SendVideoTotalTime;/* send video time, uint:second*/
|
||||
|
||||
UINT32 OldFileKey;
|
||||
UINT16 SdTotalFile;
|
||||
UINT16 SendDailyFailCnt;
|
||||
UINT16 SendDailyTimeoutCnt;
|
||||
UINT16 SynParamFlag;
|
||||
UINT16 SynMcuSet; /* 1: set sync 0: not set (void)*/
|
||||
UINT8 InstantFtpRecfg; /*1: must cfg ftps , 0 : do not cfg ftps*/
|
||||
UINT8 GpsPowerONSendFlag; /*1: send gps txt when first time to on 0: send gps txt base gps num setting*/
|
||||
UINT8 LoginACMFailedCnt;
|
||||
UINT8 u8GetPicFlag;
|
||||
UINT8 u8ResetLimited;
|
||||
UINT8 bindFlag;
|
||||
UINT8 GPSInfoGetFailed;
|
||||
UINT8 SimType;
|
||||
|
||||
/*SIM Card Info*/
|
||||
char OperatorCode[SF_OPERATOR_CODE_MAX_LEN];
|
||||
//char Carrier[64];
|
||||
char ApnGPRS[SF_APN_MAX_LEN];
|
||||
char ApnUsername[SF_APN_MAX_LEN];
|
||||
char ApnPassword[SF_APN_PASSWORD_MAX_LEN];
|
||||
char ServiceProvider[64];
|
||||
|
||||
char MMSC[SF_APN_MAX_LEN];
|
||||
char MMSAPN[SF_APN_MAX_LEN];
|
||||
char Proxy[SF_APN_MAX_LEN];
|
||||
char Port[SF_APN_MAX_LEN];
|
||||
char UserName[SF_APN_MAX_LEN];
|
||||
char Password[SF_APN_MAX_LEN];
|
||||
/*ftp info*/
|
||||
char WebIP[SF_FTP_MAX_LEN];
|
||||
char AcmIP[64];
|
||||
|
||||
|
||||
/*SIM Card Info*/
|
||||
char IMEI[SF_IMEI_MAX_LEN];
|
||||
char SimID[SF_ICCID_MAX_LEN];
|
||||
char ModuleVersion[SF_MODULE_VER_MAX_LEN];
|
||||
char ModuleSubversion[SF_MODULE_VER_MAX_LEN];
|
||||
/*GPS INFO*/
|
||||
UINT16 GpsSendFlag;
|
||||
UINT16 GpsSendYear;
|
||||
UINT16 GspSendMon;
|
||||
UINT16 GpsSendDay;
|
||||
SINT32 Did;
|
||||
SINT32 AlivePort;
|
||||
UINT8 UploadMode;
|
||||
char GpsInfo[SF_GPS_INFO_MAX_LEN];
|
||||
char Latitude[SF_GPS_INFO_MAX_LEN];
|
||||
char Longitude[SF_GPS_INFO_MAX_LEN];
|
||||
char BindAccount[SF_BIND_ACCOUNT_MAX_LEN];
|
||||
|
||||
char Token[SF_TOKEN_MAX_LEN];
|
||||
char AliveIp[SF_ALIVE_IP_MAX_LEN];
|
||||
char Uuid[SF_UUID_MAX_LEN];
|
||||
/*Low Power Alarm */
|
||||
UINT16 LowPowerAlarmFlag; /*0: no alarm upload, 1: alarm already upload.*/
|
||||
char PicPlan;
|
||||
UINT8 startup;
|
||||
UINT8 FcTemper;
|
||||
UINT8 BatRemainCap;
|
||||
UINT8 OtaUpgradeFlag;
|
||||
|
||||
UINT8 netGeneration;
|
||||
UINT8 SimSignal;
|
||||
SF_SUBSCRIBE_FILE_ATTR_S stSubscribe;
|
||||
SF_OSS_S stOssCfg;
|
||||
SF_PARA_TIME_S httpTime;
|
||||
|
||||
UINT32 CheckSum;
|
||||
}SF_PDT_PARAM_STATISTICS_S;
|
||||
|
||||
typedef struct sf_FILE_ATTR_S {
|
||||
|
||||
SF_FILE_TYPE_E enFileTye;
|
||||
SF_CHAR thumbfileName[SF_MAX_PIC_LEN];
|
||||
SF_CHAR thumbfilePath[SF_MAX_PATH_LEN];
|
||||
SF_CHAR txtfilePath[SF_MAX_PATH_LEN];
|
||||
SF_CHAR txtfileName[SF_MAX_PIC_LEN];
|
||||
UINT32 thumbfileSize;
|
||||
|
||||
}SF_FILE_ATTR_S;
|
||||
|
||||
typedef struct sf_SEND_FILE_ATTR_S {
|
||||
|
||||
SF_FILE_TYPE_E enFileTye; //upload sub hd or video file type; upload batch send thumb file type;
|
||||
SF_CHAR SubFileName[SF_MAX_PIC_LEN]; //sub hd or video file name, use as bind file; when batch send thumb file, this is null.
|
||||
SF_CHAR SendFileName[SF_MAX_PIC_LEN];//upload sub hd or video file name; upload batch send thumb file name;
|
||||
UINT32 SendFileSize; //upload sub hd or video file size; upload batch send thumb file size;
|
||||
UINT32 SendRet; //0:send success; other:error code
|
||||
UINT8 SameFlag;
|
||||
|
||||
}SF_SEND_FILE_ATTR_S;
|
||||
|
||||
typedef struct sf_SRCFILE_ATTR_S {
|
||||
UINT8 filecnt;
|
||||
SF_FILE_ATTR_S stfileattr[SF_SRCFILE_MAX];
|
||||
}SF_SRCFILE_ATTR_S;
|
||||
typedef struct sf_REPORT_FILE_ATTR_S {
|
||||
UINT8 filecnt;
|
||||
SF_SEND_FILE_ATTR_S stSendFileAttr[100];
|
||||
}SF_REPORT_FILE_ATTR_S;
|
||||
|
||||
typedef struct sf_MESSAGE_Buf_S
|
||||
{
|
||||
long mtype;
|
||||
SINT32 cmdId;
|
||||
SINT32 s32Wait;
|
||||
SINT32 arg1;
|
||||
SINT32 arg2;
|
||||
SINT32 arg3;
|
||||
}SF_MESSAGE_BUF_S;
|
||||
typedef struct sf_RtosInfo_t{
|
||||
unsigned int test1;
|
||||
unsigned int test2;
|
||||
unsigned int test3;
|
||||
unsigned int IsNight;
|
||||
unsigned int BatPer;
|
||||
unsigned int Fctemp;
|
||||
unsigned short McuVer;
|
||||
unsigned char McuSubVer;
|
||||
unsigned int rtosBootTime;
|
||||
} SF_RTOSINFO_S;
|
||||
typedef struct SF_RTOS_CMD_s{
|
||||
unsigned char cmd;
|
||||
unsigned char arg[8];
|
||||
unsigned char info[256];
|
||||
} SF_RTOS_CMD_T;
|
||||
|
||||
typedef struct sf_THREAD_S
|
||||
{
|
||||
SF_BOOL IsRun; /**<search net task running flag */
|
||||
pthread_t TskId; /**<search net task threadId */
|
||||
pthread_mutex_t mutexLock;
|
||||
} SF_THREAD_S;
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
typedef struct sf_DATA_ATTR_S {
|
||||
UINT8 databuf[SF_TTYUSB_RECV_MAX];
|
||||
UINT32 dataSize;
|
||||
}SF_DATA_ATTR_S;
|
||||
#else
|
||||
typedef struct sf_DATA_ATTR_S {
|
||||
UINT8 databuf[SF_HTTP_RECV_MAX];
|
||||
UINT32 dataSize;
|
||||
}SF_DATA_ATTR_S;
|
||||
#endif
|
||||
typedef struct
|
||||
{
|
||||
int devResetCommand; //
|
||||
int hdCommand; //
|
||||
int offset; //
|
||||
int otaCommand; //
|
||||
int resetUrlCommand; //
|
||||
int sdFormatCommand; //
|
||||
int synConfigCommand; //
|
||||
int logCommand; //
|
||||
int leftOverPic;
|
||||
int getPic;
|
||||
int RegionalChange;
|
||||
char date[32]; //
|
||||
char downloadUrl[160]; //
|
||||
char ip[24]; //
|
||||
char name[32]; //
|
||||
char passwd[48]; //
|
||||
char port[32]; //
|
||||
char serverIp[24]; //
|
||||
char url[64]; //
|
||||
char userEmail[16]; //
|
||||
char uuid[13]; //
|
||||
char p2pId[32];
|
||||
char p2pName[64];
|
||||
char p2pSecret[64];
|
||||
}LOGIN_ACM_RESPONSE_S;
|
||||
|
||||
typedef SF_BOOL (*sf_at_exit_callback_fn_ptr)(SF_VOID *param);
|
||||
typedef SINT32 (*sf_Cross_callback_fn_ptr)(SF_VOID *param);
|
||||
|
||||
typedef struct sf_FN_PARAM_s {
|
||||
sf_at_exit_callback_fn_ptr pfn_AT_instruction_exit;
|
||||
SF_VOID *pstParam;
|
||||
SF_VOID *pstaticParam;
|
||||
SF_CHAR arrttyData[SF_TTYUSB_RECV_MAX];
|
||||
}SF_FN_PARAM_S;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
40
code/application/source/sf_app/code/include/sf_qrcode.h
Executable file
40
code/application/source/sf_app/code/include/sf_qrcode.h
Executable file
|
@ -0,0 +1,40 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015-2020 by WuYuan Technology, Inc.
|
||||
*
|
||||
* This software is copyrighted by and is the property of SiFar
|
||||
* Technology, Inc.. All rights are reserved by SiFar Technology, Inc..
|
||||
* This software may only be used in accordance with the corresponding
|
||||
* license agreement. Any unauthorized use, duplication, distribution,
|
||||
* or disclosure of this software is expressly forbidden.
|
||||
*
|
||||
* This Copyright notice MUST not be removed or modified without prior
|
||||
* written consent of SiFar Technology, Inc..
|
||||
*
|
||||
* WuYuan Technology, Inc. reserves the right to modify this software without notice.
|
||||
*
|
||||
* Author: jiamin
|
||||
* Ver: 1.0.0 2021.04.15
|
||||
* Description: creat
|
||||
**************************************************************************/
|
||||
#ifndef _SF_QRCODE_H_
|
||||
#define _SF_QRCODE_H_
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
SINT16 sf_qrcode_create(SF_CHAR *pIMEI,SF_CHAR *pSimID ,SF_CHAR* pVersion);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
46
code/application/source/sf_app/code/include/sf_qrutils.h
Executable file
46
code/application/source/sf_app/code/include/sf_qrutils.h
Executable file
|
@ -0,0 +1,46 @@
|
|||
|
||||
#ifndef __SF_QRUTILS_H
|
||||
#define __SF_QRUTILS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
char* nfc_qrencrypt(char *content);
|
||||
|
||||
char * nfc_qrdecrypt(char * content);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
80
code/application/source/sf_app/code/include/sf_storeMng.h
Executable file
80
code/application/source/sf_app/code/include/sf_storeMng.h
Executable file
|
@ -0,0 +1,80 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2015-2021 by WuYuan Technology, Inc.
|
||||
*
|
||||
* This software is copyrighted by and is the property of SiFar
|
||||
* Technology, Inc.. All rights are reserved by SiFar Technology, Inc..
|
||||
* This software may only be used in accordance with the corresponding
|
||||
* license agreement. Any unauthorized use, duplication, distribution,
|
||||
* or disclosure of this software is expressly forbidden.
|
||||
*
|
||||
* This Copyright notice MUST not be removed or modified without prior
|
||||
* written consent of SiFar Technology, Inc..
|
||||
*
|
||||
* WuYuan Technology, Inc. reserves the right to modify this software without notice.
|
||||
*
|
||||
* Author: Kola
|
||||
* Ver: 1.0.0 2021.03.01
|
||||
* Description: Creat
|
||||
**************************************************************************/
|
||||
#ifndef _SF_SD_FUNCTION_H_
|
||||
#define _SF_FUNCTION_H_
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SDLOOP_REMAIN_SPACE 300 /*300MB*/
|
||||
#define FILETXTCNT 300
|
||||
#define FILENAMELEN 128
|
||||
#define SF_STORE_CHECK_RANGE(cmd, min,max) \
|
||||
do { \
|
||||
if(cmd < min || cmd > max)\
|
||||
{\
|
||||
MLOGE("Parameter[%d] out of normal range [%d,%d)!!!\n",cmd,min,max);\
|
||||
return SF_FAILURE;\
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
typedef enum {
|
||||
SF_SD_FORMAT_SUCUSS = 0,
|
||||
SF_SD_FORMAT_NO_CARD = 1,
|
||||
SF_SD_FORMAT_NOT_SUPPORT_FAT =2,
|
||||
SF_SD_FORMAT_MAX = 3,
|
||||
}SF_SD_FORMAT_RESULT_e;
|
||||
typedef struct sf_STORE_ATTR_S {
|
||||
|
||||
U32 SDStatus;
|
||||
U32 SDFree;
|
||||
U32 SDTotalSize;
|
||||
|
||||
}SF_STORE_ATTR_S;
|
||||
|
||||
|
||||
|
||||
SINT32 sf_sd_info_get(SF_STORE_ATTR_S *pstoreattrs);
|
||||
|
||||
SINT32 sf_sd_remove_file(const char *path,SINT32 threshold) ;
|
||||
|
||||
SINT32 sf_sd_loopremove(const char *path);
|
||||
|
||||
SINT32 sf_sd_isfull(SINT8 *Isfull);
|
||||
|
||||
SF_SD_STATUS_E sf_sd_status_get(void);
|
||||
|
||||
SINT32 sf_sd_status_set(SF_SD_STATUS_E enStatus);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /*_SF_COMMON_H_*/
|
||||
|
83
code/application/source/sf_app/code/include/sf_systemMng.h
Executable file
83
code/application/source/sf_app/code/include/sf_systemMng.h
Executable file
|
@ -0,0 +1,83 @@
|
|||
#ifndef _SF_SYSTEMMNG_H_
|
||||
#define _SF_SYSTEMMNG_H_
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_param_common.h"
|
||||
#define SF_SYS_CHECK_RANGE(cmd, min,max) \
|
||||
do { \
|
||||
if(cmd < min || cmd > max)\
|
||||
{\
|
||||
MLOGE("Parameter[%d] out of normal range [%d,%d)!!!\n",cmd,min,max);\
|
||||
return SF_FAILURE;\
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// following define must be same to "kernel\drivers\sstar\include\mdrv_msys_io.h"
|
||||
|
||||
#define SF_VER_FILE_PATH SF_SD_ROOT"CAM_INFO.txt"
|
||||
|
||||
typedef enum sfUPGRADE_STATUS_E
|
||||
{
|
||||
SF_UPGRADE_PRE = 0x01, /*Upgrade*/
|
||||
SF_UPGRADE_ING, /*upgrade ing*/
|
||||
SF_UPGRADE_FAIL, /*upgrade fail*/
|
||||
SF_UPGRADE_SUCCESS,
|
||||
SF_UPGRADE_BUTT,
|
||||
} SF_UPGRADE_STATUS_E;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LINUX2RTK_CMD_STOP_RECORD = 1, // stop record venc chn
|
||||
LINUX2RTK_CMD_SET_RTKMODE = 2, // set work mode to rtk,for manual control mode
|
||||
LINUX2RTK_CMD_SET_POWEROFF = 3, // set POWEROFF type
|
||||
LINUX2RTK_CMD_SET_RTCTIME = 4, // set rtc time
|
||||
LINUX2RTK_CMD_SET_DEVINFO = 5, // set dev info
|
||||
LINUX2RTK_CMD_SET_UVCCTRL = 6, // set rtos uvc ctrl,open/close
|
||||
LINUX2RTK_CMD_SET_P2PCTRL = 7, // set rtos p2p live ctrl,open/close
|
||||
LINUX2RTK_CMD_SET_OTHER = 8,
|
||||
LINUX2RTK_CMD_SET_BUTT
|
||||
} CUS_LINUX2RTK_CMD_E;
|
||||
SF_UPGRADE_STATUS_E sf_upgrade_status_get(void);
|
||||
|
||||
void sf_upgrade_status_set(SF_UPGRADE_STATUS_E status);
|
||||
|
||||
SF_POWEROFF_TYPE_E sf_poweroff_type_get(void);
|
||||
|
||||
SINT32 sf_poweroff_type_set(SF_POWEROFF_TYPE_E enType);
|
||||
|
||||
SINT32 sf_sys_rtc_time_get(SF_PARA_TIME_S *pstDateTime);
|
||||
|
||||
SINT32 sf_sys_rtc_time_set(SF_PARA_TIME_S* pstDateTime);
|
||||
|
||||
SINT32 sf_sys_rtc_time_check(SF_PARA_TIME_S *pstDateTime);
|
||||
|
||||
SINT32 sf_sys_rtc_time_reset(void);
|
||||
|
||||
SINT64 sf_sys_os_time_get(void);
|
||||
|
||||
SINT64 sf_sys_os_utime_get(void);
|
||||
|
||||
SINT32 sf_sys_software_version_get(SF_CHAR* version);
|
||||
|
||||
SINT32 sf_sys_camera_about(void);
|
||||
|
||||
SINT32 sf_sys_rtoscmd_set(SINT8 cmd, SINT8 *para);
|
||||
|
||||
SINT32 sf_sys_rtosdata_get(SF_RTOSINFO_S *pstRtosData);
|
||||
|
||||
SINT32 sf_sys_poweroff(SF_POWEROFF_TYPE_E poweroffType);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
53
code/application/source/sf_app/code/include/sf_transdata1.h
Executable file
53
code/application/source/sf_app/code/include/sf_transdata1.h
Executable file
|
@ -0,0 +1,53 @@
|
|||
|
||||
#ifndef __SF_TRANSDATA1_H__
|
||||
#define __SF_TRANSDATA1_H__
|
||||
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#define SF_DATA_ERROR_REQUEST SF_ERR_ID(SF_MOD_DATA, ERROR_REQUEST)
|
||||
#define SF_DATA_ERROR_FILE_SEND SF_ERR_ID(SF_MOD_DATA, ERROR_FILE_SEND)
|
||||
|
||||
SINT32 sf_packetgrouping_login(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_packetgrouping_fileresult(SF_DATA_ATTR_S *pstdata, SF_PDT_PARAM_CFG_S *pstParam,SF_FILE_ATTR_S *pstfileAttr);
|
||||
|
||||
SINT32 sf_packetgrouping_get_bind_account(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_packetgrouping_query_cmd(SF_DATA_ATTR_S *pstdata);
|
||||
|
||||
SINT32 sf_packetgrouping_query_cmd_param(SF_DATA_ATTR_S *pstdata);
|
||||
|
||||
SINT32 sf_packetgrouping_cmd_report(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam, SF_FILE_ATTR_S *pstfileAttr);
|
||||
|
||||
SINT32 sf_packetgrouping_disconnection(SF_DATA_ATTR_S *pstdata,SF_VOID *Param);
|
||||
|
||||
SINT32 sf_MultiPacket_Parsing(UINT16 enCmdID,UINT16 *pdatahead,SF_DATA_ATTR_S *pdatattr);
|
||||
|
||||
SINT32 sf_packetanalysis_login(SF_DATA_ATTR_S *param, SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_packetanalysis_fileresult(SF_DATA_ATTR_S *param);
|
||||
|
||||
SINT32 sf_packetanalysis_query_cmd(SF_DATA_ATTR_S *param);
|
||||
|
||||
SINT32 sf_packetanalysis_query_cmd_param(SF_DATA_ATTR_S *param, SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_packetanalysis_trigger(SF_DATA_ATTR_S *param, SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_packetanalysis_bind_account(SF_DATA_ATTR_S *param,SF_FN_PARAM_S *pfnParam);
|
||||
|
||||
SINT32 sf_packetanalysis_cmd_report(SF_DATA_ATTR_S *param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
54
code/application/source/sf_app/code/include/sf_type.h
Executable file
54
code/application/source/sf_app/code/include/sf_type.h
Executable file
|
@ -0,0 +1,54 @@
|
|||
#ifndef _SF_TYPE_H_
|
||||
#define _SF_TYPE_H_
|
||||
|
||||
#include "kwrap/nvt_type.h"
|
||||
#ifndef SF_DATA_TYPE
|
||||
#define SF_DATA_TYPE
|
||||
|
||||
|
||||
//typedef unsigned long int UINT64;
|
||||
//typedef unsigned int UINT32; //hd_type.h:157
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned char UINT8;
|
||||
|
||||
typedef signed long int SINT64;
|
||||
typedef signed int SINT32;
|
||||
typedef signed short SINT16;
|
||||
typedef signed char SINT8;
|
||||
|
||||
typedef unsigned char UCHAR;
|
||||
typedef unsigned char U8;
|
||||
typedef unsigned short U16;
|
||||
typedef unsigned int U32;
|
||||
typedef unsigned int long ULONG;
|
||||
typedef unsigned long int U64;
|
||||
|
||||
//typedef signed char CHAR;//hd_type.h:169
|
||||
typedef char S8;
|
||||
typedef short S16;
|
||||
typedef int S32;
|
||||
typedef long SLONG;
|
||||
typedef signed long int S64;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef char SF_CHAR;
|
||||
|
||||
typedef unsigned char SF_BOOL;
|
||||
|
||||
typedef void SF_VOID;
|
||||
|
||||
|
||||
#define SF_NULL 0L
|
||||
#define SF_SUCCESS 0
|
||||
#define SF_FAILURE (-1)
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAIL 1
|
||||
|
||||
#define SF_TRUE 1
|
||||
#define SF_FALSE 0
|
||||
#endif
|
||||
#endif
|
33
code/application/source/sf_app/code/include/sha256.h
Executable file
33
code/application/source/sf_app/code/include/sha256.h
Executable file
|
@ -0,0 +1,33 @@
|
|||
#include "sf_type.h"
|
||||
|
||||
#define SHA256_HASH_SIZE 32
|
||||
|
||||
/* Hash size in 32-bit words */
|
||||
#define SHA256_HASH_WORDS 8
|
||||
|
||||
struct _SHA256Context {
|
||||
unsigned long long totalLength;
|
||||
UINT32 hash[SHA256_HASH_WORDS];
|
||||
UINT32 bufferLength;
|
||||
union {
|
||||
UINT32 words[16];
|
||||
UINT8 bytes[64];
|
||||
} buffer;
|
||||
#ifdef RUNTIME_ENDIAN
|
||||
int littleEndian;
|
||||
#endif /* RUNTIME_ENDIAN */
|
||||
};
|
||||
|
||||
typedef struct _SHA256Context SHA256Context;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void SHA256Init (SHA256Context *sc);
|
||||
void SHA256Update (SHA256Context *sc, const void *data, UINT32 len);
|
||||
void SHA256Final (SHA256Context *sc, UINT8 hash[SHA256_HASH_SIZE]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
57
code/application/source/sf_app/code/include/split.h
Executable file
57
code/application/source/sf_app/code/include/split.h
Executable file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Input data splitter.
|
||||
* Copyright (C) 2006-2011 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* The following data / specifications are taken from
|
||||
* "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
|
||||
* or
|
||||
* "Automatic identification and data capture techniques --
|
||||
* QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __SPLIT_H__
|
||||
#define __SPLIT_H__
|
||||
|
||||
#include "qrencode.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Split the input string (null terminated) into QRinput.
|
||||
* @param string input string
|
||||
* @param hint give QR_MODE_KANJI if the input string contains Kanji character encoded in Shift-JIS. If not, give QR_MODE_8.
|
||||
* @param casesensitive 0 for case-insensitive encoding (all alphabet characters are replaced to UPPER-CASE CHARACTERS.
|
||||
* @retval 0 success.
|
||||
* @retval -1 an error occurred. errno is set to indicate the error. See
|
||||
* Exceptions for the details.
|
||||
* @throw EINVAL invalid input object.
|
||||
* @throw ENOMEM unable to allocate memory for input objects.
|
||||
*/
|
||||
extern int Split_splitStringToQRinput(const char *string, QRinput *input,
|
||||
QRencodeMode hint, int casesensitive);
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __SPLIT_H__ */
|
1027
code/application/source/sf_app/code/source/4gMng/sf_eg91_gps.c
Executable file
1027
code/application/source/sf_app/code/source/4gMng/sf_eg91_gps.c
Executable file
File diff suppressed because it is too large
Load Diff
1451
code/application/source/sf_app/code/source/4gMng/sf_eg91_server.c
Executable file
1451
code/application/source/sf_app/code/source/4gMng/sf_eg91_server.c
Executable file
File diff suppressed because it is too large
Load Diff
2143
code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c
Executable file
2143
code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c
Executable file
File diff suppressed because it is too large
Load Diff
466
code/application/source/sf_app/code/source/4gMng/sf_http_server.c
Executable file
466
code/application/source/sf_app/code/source/4gMng/sf_http_server.c
Executable file
|
@ -0,0 +1,466 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "sf_type.h"
|
||||
#include "sf_log.h"
|
||||
|
||||
#include "cJSON.h"
|
||||
|
||||
#include"sf_http_server.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
SINT32 socketfd = -1;
|
||||
|
||||
SINT32 http_server_creat(char *host, int *sock)
|
||||
{
|
||||
struct sockaddr_in address;
|
||||
int clt_sock;
|
||||
int opvalue = 8;
|
||||
socklen_t slen;
|
||||
int i=0;
|
||||
int ret = 0;
|
||||
|
||||
slen = sizeof(opvalue);
|
||||
memset(&address, 0, sizeof(address));
|
||||
if ((clt_sock= socket(AF_INET, SOCK_STREAM, 0)) < 0 ||
|
||||
setsockopt(clt_sock, IPPROTO_IP, IP_TOS, &opvalue, slen) < 0)
|
||||
{
|
||||
MLOGE("socket socket error.\n");
|
||||
return -1;
|
||||
}
|
||||
struct timeval timeo = {120, 0};
|
||||
|
||||
setsockopt(clt_sock, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo));
|
||||
setsockopt(clt_sock, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo));
|
||||
|
||||
|
||||
address.sin_family = AF_INET;
|
||||
address.sin_port = htons((unsigned short)HTTP_PORT);
|
||||
|
||||
struct hostent* server = gethostbyname(host);
|
||||
if (!server)
|
||||
{
|
||||
MLOGE("dns error.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for(i = 0;server->h_addr_list[i];i++)
|
||||
printf("...server ip addr%d: %s \n",i,inet_ntoa(*(struct in_addr*)server->h_addr_list[i]));
|
||||
|
||||
address.sin_addr = *(struct in_addr *)server->h_addr_list[0];
|
||||
ret = connect(clt_sock, (struct sockaddr*)&address, sizeof(address));
|
||||
if (ret != 0)
|
||||
{
|
||||
MLOGE("socket socket connect error. ret = %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*sock = clt_sock;
|
||||
|
||||
return 0;
|
||||
}
|
||||
SINT32 http_send_to_server(int sock_fd, char *data, int length)
|
||||
{
|
||||
int written_len = 0;
|
||||
int writelen = 0;
|
||||
int ret = 0;
|
||||
|
||||
// MLOGD("lenth:%d\n", length);
|
||||
while (written_len < length)
|
||||
{
|
||||
if(length - written_len > 1024*20)
|
||||
writelen = 1024*20;
|
||||
else
|
||||
writelen = length - written_len;
|
||||
|
||||
// MLOGD("written_len:%d,lenth:%d\n", written_len, length);
|
||||
ret = send(sock_fd, data + written_len, writelen, 0);
|
||||
if (ret > 0)
|
||||
{
|
||||
written_len += ret;
|
||||
// MLOGD("written_len:%d,ret:%d\n", written_len,ret);
|
||||
continue;
|
||||
}
|
||||
else if (ret == 0)
|
||||
{
|
||||
// MLOGD("written_len:%d,ret:%d\n", written_len,ret);
|
||||
return written_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
MLOGD("written_len:%d,ret:%d\n", written_len, ret);
|
||||
MLOGE("HTTP Send:%d\n", ret);
|
||||
return -1; /* Connnection error */
|
||||
}
|
||||
}
|
||||
|
||||
MLOGD("Send End,written_len:%d\n", written_len);
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 http_recv_from_server(int sock_fd, char *data, int length)
|
||||
{
|
||||
SINT32 recv_byte = 0;
|
||||
recv_byte = recv(sock_fd, data, length, 0);
|
||||
if(recv_byte == 0)
|
||||
{
|
||||
sleep(3);
|
||||
recv_byte = recv(sock_fd, data, length, 0);
|
||||
}
|
||||
return recv_byte;
|
||||
}
|
||||
SINT32 http_server_close(int sock_fd)
|
||||
{
|
||||
return close(sock_fd);
|
||||
}
|
||||
static SINT32 http_response_status_code(char *data)
|
||||
{
|
||||
char *p = NULL;
|
||||
char ack[3] = {0};
|
||||
|
||||
p = strstr(data, "HTTP/1.1");
|
||||
memcpy(ack, p+9, 3);
|
||||
switch(atoi(ack)/100)
|
||||
{
|
||||
case 1:
|
||||
MLOGI(">>>information corresponding\n");
|
||||
return SF_SUCCESS;
|
||||
case 2:
|
||||
MLOGI(">>>successful response\n");
|
||||
return SF_SUCCESS;
|
||||
case 3:
|
||||
MLOGI(">>>redirect message\n");
|
||||
return SF_SUCCESS;
|
||||
case 4:
|
||||
MLOGE(">>>Client error response\n");
|
||||
return SF_FAILURE;
|
||||
case 5:
|
||||
MLOGE(">>>server error response\n");
|
||||
return SF_FAILURE;
|
||||
default:
|
||||
MLOGE(">>>undefined error response\n");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
static SINT32 http_authentication_parse(char *data,SF_PDT_PARAM_STATISTICS_S *pStaticParam)
|
||||
{
|
||||
char *p = NULL;
|
||||
char *out = NULL;
|
||||
cJSON *json = NULL;
|
||||
cJSON *first = NULL;
|
||||
cJSON *second = NULL;
|
||||
cJSON *subListItem = NULL;
|
||||
SINT32 s32ret = SF_SUCCESS;
|
||||
UINT16 index = 0;
|
||||
SF_CHAR tempStr[128] = {0};
|
||||
SF_CHAR decode_tempStr[128] = {0};
|
||||
|
||||
s32ret = http_response_status_code(data);
|
||||
SF_APPCOMM_CHECK_RETURN(s32ret,SF_HTTP_ERROR_NO_SUPPORT);
|
||||
|
||||
p = strchr(data, '{');
|
||||
json=cJSON_Parse(p);
|
||||
if (!json)
|
||||
{
|
||||
SLOGE("Error before: [%s]\n",cJSON_GetErrorPtr());
|
||||
cJSON_Delete(json);
|
||||
return SF_HTTP_ERROR_DATA_FORMAT;
|
||||
}
|
||||
|
||||
|
||||
first = cJSON_GetObjectItem(json, "statu");
|
||||
MLOGD("...code = %d\n", first->valueint);
|
||||
first = cJSON_GetObjectItem(json, "errCode");
|
||||
MLOGD("...errCode = %d\n", first->valueint);
|
||||
|
||||
if(first->valueint == 0)
|
||||
{
|
||||
first = cJSON_GetObjectItem(json, "msg");
|
||||
MLOGD("...msg = %s\n", first->valuestring);
|
||||
first = cJSON_GetObjectItem(json, "content");
|
||||
out=cJSON_Print(first);
|
||||
if(!strstr(out, "null"))
|
||||
{
|
||||
for(index = 0; index < 3; index++)
|
||||
{
|
||||
subListItem = cJSON_GetArrayItem(first, index);
|
||||
if(cJSON_GetObjectItem(subListItem, "serverType")->valueSINT32 == 4)
|
||||
{
|
||||
second = cJSON_GetObjectItem(subListItem, "ip");
|
||||
memcpy(tempStr, second->valuestring, strlen(second->valuestring));
|
||||
|
||||
sf_base64_decode(tempStr, decode_tempStr);
|
||||
|
||||
sprintf(pStaticParam->AcmIP, "%s", decode_tempStr);
|
||||
MLOGD("AcmIP = %s\n", pStaticParam->AcmIP);
|
||||
}
|
||||
}
|
||||
}
|
||||
free(out);
|
||||
}
|
||||
else
|
||||
{
|
||||
s32ret = first->valueint;
|
||||
if(first->valueint == SF_DEV_NOT_EXIST)
|
||||
{
|
||||
MLOGE("device does not exist\n");
|
||||
}
|
||||
else if(first->valueint == SF_DEV_NOT_BIND)
|
||||
{
|
||||
MLOGE("Device not bound\n");
|
||||
}
|
||||
}
|
||||
|
||||
cJSON_Delete(json);
|
||||
return s32ret;
|
||||
}
|
||||
|
||||
static SINT32 http_authentication_packet(SF_CHAR *data_buff,SF_PDT_PARAM_STATISTICS_S *pStaticParam)
|
||||
|
||||
{
|
||||
memset(data_buff, '\0', strlen(data_buff));
|
||||
sprintf(data_buff, "POST /CameraManager/center/device/imeiAndMSisdn"
|
||||
"?imei=%s&iccid=%s"
|
||||
" HTTP/1.1\r\n"
|
||||
"Host:%s\r\n"
|
||||
"Connection: keep-alive\n"
|
||||
"Content-Type: application/json\r\n\r\n",pStaticParam->IMEI, pStaticParam->SimID, pStaticParam->WebIP);
|
||||
|
||||
#ifndef SF_VERSION_RELEASE
|
||||
MLOGD("send_buff********\n%s\n", data_buff);
|
||||
#endif
|
||||
return SF_SUCCESS;
|
||||
|
||||
}
|
||||
static SINT32 http_domain_name_get(char *url, char *host)
|
||||
{
|
||||
char *pA;
|
||||
char *pB;
|
||||
memset(host, 0, strlen(host));
|
||||
|
||||
if (!(*url))
|
||||
return -1;
|
||||
|
||||
pA = url;
|
||||
if (!strncmp(pA, "http://", strlen("http://")))
|
||||
pA = url + strlen("http://");
|
||||
else if (!strncmp(pA, "https://", strlen("https://")))
|
||||
pA = url + strlen("https://");
|
||||
|
||||
pB = strchr(pA, '/');
|
||||
|
||||
if (pB)
|
||||
{
|
||||
memcpy(host, pA, strlen(pA) - strlen(pB));
|
||||
host[strlen(pA) - strlen(pB)] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(host, pA, strlen(pA));
|
||||
host[strlen(pA)] = 0;
|
||||
}
|
||||
// SLOGD("host = %s\n", host);
|
||||
|
||||
return 0;
|
||||
}
|
||||
static SINT32 http_pushfile_to_server(SINT32 socketfd, SF_FILE_ATTR_S *stFileAttr)
|
||||
{
|
||||
SINT32 ret = SF_SUCCESS;
|
||||
SINT32 fileFd = 0;
|
||||
SINT32 tolFileSize = 0;
|
||||
SINT32 readSize = 0;
|
||||
struct stat statBuf;
|
||||
SF_CHAR *pBuf = NULL;
|
||||
SF_CHAR *bufBak = NULL;
|
||||
|
||||
fileFd = open(stFileAttr->txtfilePath, O_RDONLY);
|
||||
if(fileFd < 0)
|
||||
{
|
||||
SLOGE("open file[%s] error!\n", stFileAttr->txtfilePath);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
fstat(fileFd, &statBuf);
|
||||
tolFileSize = statBuf.st_size;
|
||||
SLOGD("tolFileSize:%d\n", tolFileSize);
|
||||
|
||||
bufBak = (tolFileSize > 1024*1024*5)?malloc(1024*1024*5):malloc(tolFileSize);
|
||||
if(bufBak == NULL)
|
||||
{
|
||||
SLOGE("malloc buf fail!\n");
|
||||
close(fileFd);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
while(tolFileSize > 0)
|
||||
{
|
||||
pBuf = bufBak;
|
||||
readSize = (tolFileSize >= 1024*1024*5)?read(fileFd, pBuf, 1024*1024*5):read(fileFd, pBuf, tolFileSize);
|
||||
SLOGD("send file data, tolFileSize:%d, read size:%d\n", tolFileSize, readSize);
|
||||
tolFileSize -= readSize;
|
||||
|
||||
if(readSize < 0)
|
||||
{
|
||||
free(bufBak);
|
||||
close(fileFd);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
ret = http_send_to_server(socketfd, pBuf, readSize);
|
||||
if (ret < 0)
|
||||
{
|
||||
SLOGE("Connection error (send returned %d)\n", ret);
|
||||
free(bufBak);
|
||||
close(fileFd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
free(bufBak);
|
||||
close(fileFd);
|
||||
SLOGD("SF_SUCCESS!\n");
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
static SINT32 http_file_response_parse()
|
||||
{
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 sf_usbnet_http_authenrequst(SF_PDT_PARAM_STATISTICS_S *pStaticParam)
|
||||
{
|
||||
SF_COMM_CHECK_POINTER(pStaticParam,SF_FAILURE);
|
||||
|
||||
SINT32 s32ret = 0;
|
||||
SINT32 recv_byte = 0;
|
||||
SINT32 sock_cli = 0;
|
||||
SF_CHAR data_buff[BUFFER_SIZE] = { 0 };
|
||||
|
||||
MLOGD("WebIP:%s\n", pStaticParam->WebIP);
|
||||
s32ret = http_server_creat(pStaticParam->WebIP, &sock_cli);
|
||||
SF_APPCOMM_CHECK_RETURN(s32ret,SF_HTTP_ERROR_REQUEST);
|
||||
|
||||
s32ret = http_authentication_packet(data_buff,pStaticParam);
|
||||
if(s32ret !=SF_SUCCESS) {
|
||||
close(sock_cli);
|
||||
return SF_HTTP_ERROR_REQUEST;
|
||||
}
|
||||
|
||||
s32ret = http_send_to_server(sock_cli,data_buff,strlen(data_buff));
|
||||
if(s32ret < SF_SUCCESS) {
|
||||
close(sock_cli);
|
||||
return SF_HTTP_ERROR_REQUEST;
|
||||
}
|
||||
|
||||
memset(data_buff, '\0', sizeof(data_buff));
|
||||
http_recv_from_server(sock_cli,data_buff,BUFFER_SIZE);
|
||||
|
||||
s32ret = http_authentication_parse(data_buff, pStaticParam);
|
||||
if(s32ret != SF_SUCCESS) {
|
||||
close(sock_cli);
|
||||
return SF_HTTP_ERROR_REQUEST;
|
||||
}
|
||||
close(sock_cli);
|
||||
|
||||
return s32ret;
|
||||
}
|
||||
SINT32 sf_usbnet_http_pushfile(SF_FILE_ATTR_S *pstFileAttr,SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
SINT32 s32ret = SF_SUCCESS;
|
||||
SINT32 socketfd = -1;
|
||||
SF_CHAR amzIP[128] = {0};
|
||||
SF_CHAR buf[HTTPCLIENT_REV_SIZE] = {0};
|
||||
SF_PDT_PARAM_STATISTICS_S *pStaticParam = pfnParam->pstaticParam;
|
||||
|
||||
|
||||
sprintf(amzIP, "%s.%s", pStaticParam->stOssCfg.szBucket, AMZ_HOST);
|
||||
MLOGI("login [%s]\n",amzIP);
|
||||
s32ret = http_server_creat(amzIP,&socketfd);
|
||||
if(s32ret != SF_SUCCESS) {
|
||||
MLOGE("login [%s] failed\n",amzIP);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
s32ret = http_pushfile_to_server(socketfd,pstFileAttr);
|
||||
if(s32ret != SF_SUCCESS) {
|
||||
http_server_close(socketfd);
|
||||
MLOGE("push file failed!!!\n");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
s32ret = http_recv_from_server(socketfd, buf, HTTPCLIENT_REV_SIZE);
|
||||
if(s32ret <= 0)
|
||||
{
|
||||
SLOGE("recv innormal!!!");
|
||||
http_server_close(socketfd);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
//http_file_response_parse();
|
||||
MLOGD("recv buf:%s\n", buf);
|
||||
http_server_close(socketfd);
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
int sf_usbnet_server_acm_open(SF_PDT_PARAM_STATISTICS_S *pStaticParam)
|
||||
{
|
||||
int ret = 0;
|
||||
SF_CHAR server_domain_name[32] = {0};
|
||||
ret = http_domain_name_get(pStaticParam->AcmIP,server_domain_name);
|
||||
if(ret != SF_SUCCESS)
|
||||
return ret;
|
||||
MLOGI("acm domain name:[%s]\n",server_domain_name );
|
||||
ret = http_server_creat(server_domain_name, &socketfd);
|
||||
if(ret != SF_SUCCESS)
|
||||
return ret;
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 sf_usbnet_server_acm_transfer(SF_DATA_ATTR_S *psenddate)
|
||||
{
|
||||
SINT32 s32ret = 0;
|
||||
|
||||
s32ret = http_send_to_server(socketfd,(char*)psenddate->databuf,psenddate->dataSize);
|
||||
SF_APPCOMM_CHECK_RETURN(s32ret,SF_HTTP_ERROR_WRITE);
|
||||
|
||||
|
||||
memset(psenddate->databuf, '\0', SF_HTTP_RECV_MAX);
|
||||
s32ret = http_recv_from_server(socketfd,(char*)psenddate->databuf, SF_HTTP_RECV_MAX);
|
||||
MLOGI("datasize = %d\n",s32ret);
|
||||
if(s32ret <= 0)
|
||||
return SF_FAILURE;
|
||||
psenddate->dataSize = s32ret;
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 sf_usbnet_server_acm_close()
|
||||
{
|
||||
MLOGI("\n");
|
||||
return http_server_close(socketfd);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
305
code/application/source/sf_app/code/source/4gMng/sf_module.c
Executable file
305
code/application/source/sf_app/code/source/4gMng/sf_module.c
Executable file
|
@ -0,0 +1,305 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_log.h"
|
||||
#include "sf_type.h"
|
||||
#include "sf_hal_gpio.h"
|
||||
#include "sf_module.h"
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
#include "sf_eg91_sim.h"
|
||||
#include "sf_eg91_gps.h"
|
||||
#include "sf_eg91_server.h"
|
||||
#ifndef CFG_TRANSDATA_AT
|
||||
#include "sf_http_server.h"
|
||||
#endif
|
||||
#endif
|
||||
extern pthread_mutex_t GPIO_mutexLock;
|
||||
|
||||
static SF_4G_STATUS_E ModuleStatus = SF_4G_FREE;
|
||||
|
||||
void sf_4G_usb_init(void)
|
||||
{
|
||||
sf_hal_gpio_init(GPIOID_USB_MUX1,GPIO_DIR_OUT);
|
||||
sf_hal_gpio_set(GPIOID_USB_MUX1,1);
|
||||
}
|
||||
SF_4G_STATUS_E sf_4G_status_get(void)
|
||||
{
|
||||
return ModuleStatus;
|
||||
}
|
||||
|
||||
void sf_4G_status_set(SF_4G_STATUS_E enStatus)
|
||||
{
|
||||
|
||||
if(enStatus < SF_4G_BUTT)
|
||||
ModuleStatus = enStatus;
|
||||
else
|
||||
MLOGE("Type format error\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
SINT32 sf_4G_sim_IsInsert(void)
|
||||
{
|
||||
return 1;
|
||||
SINT8 regValue = 0;
|
||||
SF_MUTEX_LOCK(GPIO_mutexLock);
|
||||
sf_hal_gpio_init(GPIOID_SIM_INSRET, GPIO_DIR_IN);
|
||||
sf_hal_gpio_get(GPIOID_SIM_INSRET, ®Value);
|
||||
sf_hal_gpio_deinit(GPIOID_SIM_INSRET);
|
||||
SF_MUTEX_UNLOCK(GPIO_mutexLock);
|
||||
MLOGI("SIM = %d\n",regValue);
|
||||
return (regValue & 0xFF) ? 1:0;
|
||||
|
||||
}
|
||||
|
||||
static UINT8 sf_4g_net_level_get(UINT8 simSignal)
|
||||
{
|
||||
if(simSignal == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if((simSignal <= 95) && (simSignal > 0))
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
else if((simSignal <= 105) && (simSignal > 95))
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
else if((simSignal <= 115) && (simSignal > 105))
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
else if((simSignal > 115))
|
||||
return 2;
|
||||
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT8 sf_3g_net_level_get(UINT8 simSignal)
|
||||
{
|
||||
if(simSignal == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if(simSignal < 10)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if(simSignal < 14)
|
||||
{
|
||||
return 3;//t100, custumer signal level,20210914
|
||||
}
|
||||
else if(simSignal < 18)
|
||||
{
|
||||
return 3;//t100, custumer signal level,20210914
|
||||
}
|
||||
else if(simSignal <= 31)
|
||||
{
|
||||
return 4;//t100, custumer signal level,20210914
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
SINT32 sf_4G_signal_level_get(SINT8 net,SINT8 signal,UINT8* value)
|
||||
{
|
||||
SF_COMM_CHECK_POINTER(value,SF_FAILURE);
|
||||
|
||||
if(net == 4)
|
||||
*value = sf_4g_net_level_get(signal);
|
||||
else
|
||||
*value = sf_3g_net_level_get(signal);
|
||||
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 sf_4G_qsclk_set(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_qsclk_set(pfnParam);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_4G_iccid_get(SF_CHAR *iccid,SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_iccid_get(iccid,pfnParam);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_4G_http_config(SF_FN_PARAM_S *pfnParam, UINT8 sslOn, UINT8 autoReqHead)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_http_config(pfnParam,sslOn,autoReqHead);
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_http_authenrequst(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return eg91_http_authenrequst(pfnParam);
|
||||
#else
|
||||
return sf_usbnet_http_authenrequst(pfnParam->pstaticParam);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_file_transfer(SF_CHAR *fileName, SINT32 *fileSize, SF_FILE_TYPE_E fileType)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return eg91_file_to_module(fileName, fileSize,fileType);
|
||||
#else
|
||||
return SF_SUCCESS;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_http_pushfile(SF_FILE_ATTR_S *pstFileAttr,SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return eg91_http_pushfile(pstFileAttr,pfnParam);
|
||||
#else
|
||||
return sf_usbnet_http_pushfile(pstFileAttr,pfnParam);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_4G_server_open(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return eg91_server_acm_open(pfnParam);
|
||||
#else
|
||||
return sf_usbnet_server_acm_open(pfnParam->pstaticParam);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_acm_tcp_server_open(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_server_acm_open(pfnParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_acm_tcp_server_close(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_server_acm_close(pfnParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_server_transferdata(SF_DATA_ATTR_S *psenddate, SF_FN_PARAM_S *pfnParam, UINT8 needRepose)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return eg91_server_acm_transfer(psenddate, pfnParam, needRepose);
|
||||
#else
|
||||
return sf_usbnet_server_acm_transfer(psenddate);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_acm_tcp_server_transferdata(SF_DATA_ATTR_S *psenddate, SF_FN_PARAM_S *pfnParam, UINT8 needRepose)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_server_acm_transfer(psenddate, pfnParam, needRepose);
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_server_close(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return eg91_server_acm_close(pfnParam);
|
||||
#else
|
||||
return sf_usbnet_server_acm_close();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_4G_gps_greendate_Get(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_gps_greendate_Get(pfnParam,pNowTime);
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_gps_Isupdate(SF_FN_PARAM_S *pfnParam,UINT8 *pIsupdate,SF_PARA_TIME_S *pNowTime,UINT8 u8day)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_gps_Isupdate(pfnParam,pIsupdate,pNowTime,u8day);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_4G_gps_preconfig(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_gps_preconfig(pfnParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_gps_search(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime,UINT8 autoModeFlag)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_gps_search(pfnParam,pNowTime,autoModeFlag);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_4G_gps_search_result(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_gps_search_result(pfnParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_sim_init(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_sim_init(pfnParam);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_4G_register_net_manual(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_register_net_manual(pfnParam);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_4G_register_net_auto(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_register_net_auto(pfnParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_4G_usb_net_apn_cfg(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_usb_net_apn_cfg(pfnParam);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_4G_other_sim_apn_cfg(SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_MODULE_EG91)
|
||||
return eg91_other_sim_apn_cfg(pfnParam->pstaticParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
1703
code/application/source/sf_app/code/source/4gMng/sf_opera_adapt.c
Executable file
1703
code/application/source/sf_app/code/source/4gMng/sf_opera_adapt.c
Executable file
File diff suppressed because it is too large
Load Diff
|
@ -6,23 +6,74 @@
|
|||
*/
|
||||
|
||||
#include <io/gpio.h>
|
||||
#include <UIWnd/UIFlow.h>
|
||||
#include <sf_inc.h>
|
||||
//#include <UIWnd/UIFlow.h>
|
||||
//#include <sf_inc.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <sys/sem.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <sf_hal_ttyusb.h>
|
||||
//#include "UIInfo/UIInfo.h"
|
||||
#include <sf_param_common.h>
|
||||
|
||||
pthread_mutex_t Param_mutexLock;
|
||||
pthread_mutex_t GPIO_mutexLock;
|
||||
|
||||
|
||||
SINT32 app_ttyusb_IsOpen()
|
||||
{
|
||||
int retryTime = 0;
|
||||
SINT32 s32ret = 0;
|
||||
//MLOGD("ttyUSB has not been init, will init ttyUSB!\n");
|
||||
while ((s32ret = sf_hal_ttyusb2_init()) < 0)
|
||||
{
|
||||
retryTime++;
|
||||
if((retryTime >=200)&&(retryTime%200 == 0))
|
||||
{
|
||||
//MLOGE("-------ttyUSB init fail!\n");
|
||||
s32ret = SF_TTY_ERROR_OPEN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return s32ret;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("*********************************************\n");
|
||||
printf("* *\n");
|
||||
printf("* sf_app *\n");
|
||||
printf("* *\n");
|
||||
printf("*********************************************\n");
|
||||
//gpio_direction_input(C_GPIO(10));
|
||||
|
||||
sf_mcu_init();
|
||||
sf_get_power_on_mode();
|
||||
sf_mcu_wdg_set(30);
|
||||
sf_usb_mux_s(1);
|
||||
//sf_mcu_reg_set(SF_MCU_CTRL_MODULE_PIR, 1);
|
||||
//sf_sd_exist_reg_cb(DrvCARD_DetStrgCard);
|
||||
/*led init*/
|
||||
sf_led_init();
|
||||
sf_sys_status_led_set(SF_LED_SYS_STATE_PIR_NOT_DETECT);
|
||||
//sf_battery_thread_init();
|
||||
sf_share_mem_file_init();
|
||||
sf_com_message_app_init();
|
||||
sf_com_message_cardv_init();
|
||||
|
||||
sf_customer_param_load();
|
||||
|
||||
SF_MUTEX_INIT_LOCK(Param_mutexLock);
|
||||
SF_MUTEX_INIT_LOCK(GPIO_mutexLock);
|
||||
|
||||
app_led_group_register();
|
||||
//app_message_recv_start();
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
503
code/application/source/sf_app/code/source/app/sf_device.c
Executable file
503
code/application/source/sf_app/code/source/app/sf_device.c
Executable file
|
@ -0,0 +1,503 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <sys/sem.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "sf_log.h"
|
||||
#include "sf_ledmng.h"
|
||||
#include "sf_module.h"
|
||||
#include "sf_storeMng.h"
|
||||
#include "sf_keymng.h"
|
||||
#include "sf_systemMng.h"
|
||||
|
||||
#include "sf_hal_gpio.h"
|
||||
#include "sf_hal_ttyusb.h"
|
||||
#include "sf_eg91_server.h"
|
||||
#include "sf_message_queue.h"
|
||||
#include "sf_dev_other.h"
|
||||
|
||||
#include "sf_debug.h"
|
||||
#include "sf_device.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
extern pthread_mutex_t GPIO_mutexLock;
|
||||
|
||||
SF_THREAD_S PirMonitorTskCfg =
|
||||
{
|
||||
.IsRun = 0,
|
||||
.TskId = -1,
|
||||
};
|
||||
|
||||
void* pir_monitoring_thread(void)
|
||||
{
|
||||
SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
|
||||
while(PirMonitorTskCfg.IsRun)
|
||||
{
|
||||
if(sf_cap_status_get() == 0)
|
||||
{
|
||||
if(!(SF_UPGRADE_ING == sf_upgrade_status_get() || SF_UPGRADE_FAIL == sf_upgrade_status_get()))
|
||||
sf_hal_gpio_set(SF_HAL_LED_STATUS_G, (sf_dev_pir_status_get()?SF_HAL_LED_STATE_ON:SF_HAL_LED_STATE_OFF));
|
||||
}
|
||||
sf_sleep_ms(50);
|
||||
}
|
||||
|
||||
stMessageBuf.cmdId = CMD_LED;
|
||||
stMessageBuf.arg1 = LED_STATUS_HOLD_ON;
|
||||
stMessageBuf.arg2 = LED_GROUP_SIGNAL;
|
||||
stMessageBuf.arg3 = LED_TYPE_OFF;
|
||||
sf_com_message_send_to_app(&stMessageBuf);
|
||||
return NULL;
|
||||
}
|
||||
SINT32 app_pir_monitoring_start(void)
|
||||
{
|
||||
SINT32 ret = SF_SUCCESS;
|
||||
|
||||
if(sf_poweron_type_get() != SF_MCU_STARTUP_ONKEY){
|
||||
MLOGE("unsupport startup mode !!!\n");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
if(PirMonitorTskCfg.IsRun) {
|
||||
MLOGE("thread has already run !!!\n");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
ret = pthread_create(&PirMonitorTskCfg.TskId, NULL, pir_monitoring_thread, NULL);
|
||||
if(ret != SF_SUCCESS)
|
||||
{
|
||||
SLOGD("thread sf_pir_monitoring_start creat fail!\n");
|
||||
return ret;
|
||||
}
|
||||
PirMonitorTskCfg.IsRun = 1;
|
||||
|
||||
return SF_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
SINT32 app_pir_monitoring_stop(void)
|
||||
{
|
||||
SINT32 ret = SF_SUCCESS;
|
||||
if(!PirMonitorTskCfg.IsRun){
|
||||
MLOGE("thread has not run !!!\n");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
PirMonitorTskCfg.IsRun = 0;
|
||||
ret = pthread_join(PirMonitorTskCfg.TskId, NULL);
|
||||
if(ret != SF_SUCCESS) {
|
||||
MLOGE(" sf_pir_monitoring_stop stop fail!\n");
|
||||
return ret;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 app_led_sd_process(SINT32 entype)
|
||||
{
|
||||
switch(entype )
|
||||
{
|
||||
case LED_TYPE_OFF:
|
||||
sf_hal_gpio_set(SF_HAL_LED_SD_G, SF_HAL_LED_STATE_OFF);
|
||||
sf_hal_gpio_set(SF_HAL_LED_SD_R, SF_HAL_LED_STATE_OFF);
|
||||
break;
|
||||
case LED_TYPE_RED:
|
||||
sf_hal_gpio_set(SF_HAL_LED_SD_G, SF_HAL_LED_STATE_OFF);
|
||||
sf_hal_gpio_set(SF_HAL_LED_SD_R, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
case LED_TYPE_YELLOW:
|
||||
sf_hal_gpio_set(SF_HAL_LED_SD_G, SF_HAL_LED_STATE_ON);
|
||||
sf_hal_gpio_set(SF_HAL_LED_SD_R, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
case LED_TYPE_GREEN:
|
||||
sf_hal_gpio_set(SF_HAL_LED_SD_R, SF_HAL_LED_STATE_OFF);
|
||||
sf_hal_gpio_set(SF_HAL_LED_SD_G, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
default:
|
||||
MLOGE("Uknown param [%d]!!!\n",entype);
|
||||
return SF_FAILURE;
|
||||
break;
|
||||
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 app_led_status_process(SINT8 entype)
|
||||
{
|
||||
switch(entype )
|
||||
{
|
||||
case LED_TYPE_OFF:
|
||||
sf_hal_gpio_set(SF_HAL_LED_STATUS_G, SF_HAL_LED_STATE_OFF);
|
||||
break;
|
||||
case LED_TYPE_GREEN:
|
||||
case LED_TYPE_YELLOW:
|
||||
case LED_TYPE_RED:
|
||||
case LED_TYPE_ON:
|
||||
sf_hal_gpio_set(SF_HAL_LED_STATUS_G, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
default:
|
||||
MLOGE("Uknown param [%d]!!!\n",entype);
|
||||
return SF_FAILURE;
|
||||
break;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 app_led_signal_process(SINT8 entype)
|
||||
{
|
||||
switch(entype)
|
||||
{
|
||||
case LED_TYPE_OFF:
|
||||
sf_hal_gpio_set(SF_HAL_LED_SIG1_G, SF_HAL_LED_STATE_OFF);
|
||||
sf_hal_gpio_set(SF_HAL_LED_SIG1_R, SF_HAL_LED_STATE_OFF);
|
||||
break;
|
||||
case LED_TYPE_RED:
|
||||
sf_hal_gpio_set(SF_HAL_LED_SIG1_G, SF_HAL_LED_STATE_OFF);
|
||||
sf_hal_gpio_set(SF_HAL_LED_SIG1_R, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
case LED_TYPE_YELLOW:
|
||||
sf_hal_gpio_set(SF_HAL_LED_SIG1_G, SF_HAL_LED_STATE_ON);
|
||||
sf_hal_gpio_set(SF_HAL_LED_SIG1_R, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
case LED_TYPE_GREEN:
|
||||
sf_hal_gpio_set(SF_HAL_LED_SIG1_G, SF_HAL_LED_STATE_ON);
|
||||
sf_hal_gpio_set(SF_HAL_LED_SIG1_R, SF_HAL_LED_STATE_OFF);
|
||||
break;
|
||||
default:
|
||||
MLOGE("Uknown param [%d]!!!\n",entype);
|
||||
return SF_FAILURE;
|
||||
break;
|
||||
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 app_led_bat_process(SINT8 entype)
|
||||
{
|
||||
switch(entype)
|
||||
{
|
||||
case LED_TYPE_GREEN:
|
||||
sf_hal_gpio_set(SF_HAL_LED_BAT_G, SF_HAL_LED_STATE_ON);
|
||||
sf_hal_gpio_set(SF_HAL_LED_BAT_R, SF_HAL_LED_STATE_OFF);
|
||||
break;
|
||||
|
||||
case LED_TYPE_YELLOW:
|
||||
sf_hal_gpio_set(SF_HAL_LED_BAT_G, SF_HAL_LED_STATE_ON);
|
||||
sf_hal_gpio_set(SF_HAL_LED_BAT_R, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
|
||||
case LED_TYPE_RED:
|
||||
sf_hal_gpio_set(SF_HAL_LED_BAT_G, SF_HAL_LED_STATE_OFF);
|
||||
sf_hal_gpio_set(SF_HAL_LED_BAT_R, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
|
||||
case LED_TYPE_OFF:
|
||||
sf_hal_gpio_set(SF_HAL_LED_BAT_G, SF_HAL_LED_STATE_OFF);
|
||||
sf_hal_gpio_set(SF_HAL_LED_BAT_R, SF_HAL_LED_STATE_OFF);
|
||||
break;
|
||||
default:
|
||||
MLOGE("Uknown param [%d]!!!\n",entype);
|
||||
return SF_FAILURE;
|
||||
break;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 app_led_account_process(SINT8 entype)
|
||||
{
|
||||
switch(entype )
|
||||
{
|
||||
case LED_TYPE_OFF:
|
||||
sf_hal_gpio_set(SF_HAL_LED_USERBIND_G, SF_HAL_LED_STATE_OFF);
|
||||
sf_hal_gpio_set(SF_HAL_LED_USERBIND_R, SF_HAL_LED_STATE_OFF);
|
||||
break;
|
||||
case LED_TYPE_RED:
|
||||
sf_hal_gpio_set(SF_HAL_LED_USERBIND_G, SF_HAL_LED_STATE_OFF);
|
||||
sf_hal_gpio_set(SF_HAL_LED_USERBIND_R, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
case LED_TYPE_YELLOW:
|
||||
sf_hal_gpio_set(SF_HAL_LED_USERBIND_G, SF_HAL_LED_STATE_ON);
|
||||
sf_hal_gpio_set(SF_HAL_LED_USERBIND_R, SF_HAL_LED_STATE_ON);
|
||||
break;
|
||||
case LED_TYPE_GREEN:
|
||||
sf_hal_gpio_set(SF_HAL_LED_USERBIND_G, SF_HAL_LED_STATE_ON);
|
||||
sf_hal_gpio_set(SF_HAL_LED_USERBIND_R, SF_HAL_LED_STATE_OFF);
|
||||
break;
|
||||
default:
|
||||
MLOGE("Uknown param [%d]!!!\n",entype);
|
||||
return SF_FAILURE;
|
||||
break;
|
||||
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 app_led_hold_group(SF_LED_GROUD_E enGroupType,SINT32 enstatus)
|
||||
{
|
||||
// MLOGI("enGroupType = %d, enstatus = %d\n",enGroupType, enstatus);
|
||||
switch(enGroupType)
|
||||
{
|
||||
case LED_GROUP_SD:
|
||||
app_led_sd_process(enstatus);
|
||||
break;
|
||||
case LED_GROUP_BAT:
|
||||
app_led_bat_process(enstatus);
|
||||
break;
|
||||
case LED_GROUP_SIGNAL:
|
||||
app_led_signal_process(enstatus);
|
||||
break;
|
||||
case LED_GROUP_ACCOUNT:
|
||||
app_led_account_process(enstatus);
|
||||
break;
|
||||
case LED_GROUP_STATUS:
|
||||
app_led_status_process(enstatus);
|
||||
break;
|
||||
default:
|
||||
MLOGE("Uknown param [%d]!!!\n",enGroupType);
|
||||
return SF_FAILURE;
|
||||
break;
|
||||
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 app_led_all_status_set(SF_LED_STATUS_E enLedStatus,SF_LED_TYPE_E enLedType )
|
||||
{
|
||||
SINT8 groupID = 0;
|
||||
SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
stMessageBuf.cmdId = CMD_LED;
|
||||
|
||||
for(groupID = 0;groupID < LED_GROUP_BUIT;groupID++) {
|
||||
stMessageBuf.arg1 = enLedStatus;
|
||||
stMessageBuf.arg2 = groupID;
|
||||
stMessageBuf.arg3 = enLedType;
|
||||
sf_com_message_send_to_app(&stMessageBuf);
|
||||
}
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 app_led_sd_status_return(void)
|
||||
{
|
||||
SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
|
||||
stMessageBuf.cmdId = CMD_LED;
|
||||
stMessageBuf.arg1 = LED_STATUS_HOLD_ON;
|
||||
switch(sf_sd_status_get()) {
|
||||
case SF_SD_UNPLUGED:
|
||||
case SF_SD_OUT:
|
||||
stMessageBuf.arg3 = LED_TYPE_RED;
|
||||
break;
|
||||
case SF_SD_PLUGED:
|
||||
case SF_SD_OK:
|
||||
stMessageBuf.arg1 = (sf_customer_param_get()->DebugMode?LED_STATUS_SLOWFLASH_ON:LED_STATUS_HOLD_ON);
|
||||
stMessageBuf.arg3 = LED_TYPE_GREEN;
|
||||
break;
|
||||
case SF_SD_FULL:
|
||||
case SF_SD_ERROR:
|
||||
stMessageBuf.arg3 = LED_TYPE_YELLOW;
|
||||
break;
|
||||
default:
|
||||
return SF_FAILURE;
|
||||
break;
|
||||
|
||||
}
|
||||
sf_com_message_send_to_app(&stMessageBuf);
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 app_led_net_reg_start(void)
|
||||
{
|
||||
SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
stMessageBuf.cmdId = CMD_LED;
|
||||
stMessageBuf.arg1 = LED_STATUS_SLOWFLASH_ON;
|
||||
stMessageBuf.arg2 = LED_GROUP_SIGNAL;
|
||||
stMessageBuf.arg3 = LED_TYPE_GREEN;
|
||||
sf_com_message_send_to_app(&stMessageBuf);
|
||||
|
||||
stMessageBuf.cmdId = CMD_LED;
|
||||
stMessageBuf.arg1 = LED_STATUS_SLOWFLASH_ON;
|
||||
stMessageBuf.arg2 = LED_GROUP_ACCOUNT;
|
||||
stMessageBuf.arg3 = LED_TYPE_GREEN;
|
||||
sf_com_message_send_to_app(&stMessageBuf);
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 app_led_net_reg_stop(SINT32 s32ret)
|
||||
{
|
||||
SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
|
||||
stMessageBuf.cmdId = CMD_LED;
|
||||
stMessageBuf.arg2 = LED_GROUP_SIGNAL;
|
||||
if(s32ret == SF_SUCCESS) {
|
||||
stMessageBuf.arg1 = LED_STATUS_HOLD_ON;
|
||||
UINT8 signalLevel = 0;
|
||||
sf_4G_signal_level_get(sf_statistics_param_get()->netGeneration,sf_statistics_param_get()->SimSignal,&signalLevel);
|
||||
MLOGI("signalLevel = %d\n",signalLevel);
|
||||
switch(signalLevel)
|
||||
{
|
||||
case 2:
|
||||
stMessageBuf.arg3 = LED_TYPE_RED;
|
||||
break;
|
||||
case 3:
|
||||
stMessageBuf.arg3 = LED_TYPE_YELLOW;
|
||||
break;
|
||||
case 4:
|
||||
stMessageBuf.arg3 = LED_TYPE_GREEN;
|
||||
break;
|
||||
default:
|
||||
stMessageBuf.arg3 = LED_TYPE_RED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(s32ret == SF_4G_ERROR_NO_SIMCARD \
|
||||
|| s32ret == SF_4G_ERROR_NO_SUPPOET \
|
||||
|| s32ret == SF_APP_ERROR_NO_SUPPOET)
|
||||
{
|
||||
stMessageBuf.arg1 = LED_STATUS_SLOWFLASH_ON;
|
||||
stMessageBuf.arg3 = LED_TYPE_RED;
|
||||
}
|
||||
else if(s32ret == SF_HTTP_ERROR_REQUEST) {
|
||||
stMessageBuf.arg1 = LED_STATUS_HOLD_ON;
|
||||
stMessageBuf.arg3 = LED_TYPE_RED;
|
||||
}
|
||||
else if(s32ret == SF_TTY_ERROR_OPEN)
|
||||
{
|
||||
stMessageBuf.arg1 = LED_STATUS_QUICKFLASH_ON;
|
||||
stMessageBuf.arg3 = LED_TYPE_RED;
|
||||
}
|
||||
else {
|
||||
stMessageBuf.arg1 = LED_STATUS_HOLD_ON;
|
||||
stMessageBuf.arg3 = LED_TYPE_RED;
|
||||
}
|
||||
|
||||
sf_com_message_send_to_app(&stMessageBuf);
|
||||
|
||||
stMessageBuf.cmdId = CMD_LED;
|
||||
stMessageBuf.arg2 = LED_GROUP_ACCOUNT;
|
||||
if(s32ret == SF_SUCCESS) {
|
||||
stMessageBuf.arg1 = LED_STATUS_HOLD_ON;
|
||||
stMessageBuf.arg3 = LED_TYPE_GREEN;
|
||||
}
|
||||
else {
|
||||
if(sf_statistics_param_get()->bindFlag) {
|
||||
if(s32ret == SF_4G_ERROR_NO_SIMCARD \
|
||||
|| s32ret == SF_4G_ERROR_REG_NET) {
|
||||
stMessageBuf.arg1 = LED_STATUS_SLOWFLASH_ON;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
stMessageBuf.arg1 = LED_STATUS_HOLD_ON;
|
||||
}
|
||||
stMessageBuf.arg3 = LED_TYPE_RED;
|
||||
}
|
||||
sf_com_message_send_to_app(&stMessageBuf);
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 app_led_poweroff(void)
|
||||
{
|
||||
UINT16 i = 0;
|
||||
SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
|
||||
// stMessageBuf.cmdId = CMD_LED;
|
||||
// stMessageBuf.arg1 = LED_STATUS_SLOWFLASH_ON;
|
||||
// stMessageBuf.arg2 = LED_GROUP_STATUS;
|
||||
// stMessageBuf.arg3 = LED_TYPE_GREEN;
|
||||
// sf_com_message_send_to_app(&stMessageBuf);
|
||||
|
||||
while((i < 10))
|
||||
{
|
||||
usleep(500*1000);
|
||||
i++;
|
||||
}
|
||||
if(i == 10)
|
||||
{
|
||||
stMessageBuf.arg1 = SF_POWEROFF_KEYON;
|
||||
stMessageBuf.cmdId = CMD_POWEROFF;
|
||||
sf_com_message_send_to_app(&stMessageBuf);
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 app_led_group_register(void)
|
||||
{
|
||||
|
||||
if(sf_poweron_type_get() != SF_MCU_STARTUP_ONKEY && sf_poweron_type_get() != SF_MCU_STARTUP_NORMAL)
|
||||
return SF_SUCCESS;
|
||||
|
||||
SINT8 i = 0;
|
||||
SINT8 eventarray[5] = {
|
||||
LED_GROUP_SD,
|
||||
LED_GROUP_BAT,
|
||||
LED_GROUP_SIGNAL,
|
||||
LED_GROUP_ACCOUNT,
|
||||
LED_GROUP_STATUS
|
||||
};
|
||||
|
||||
sf_led_add_exe(app_led_hold_group);
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
sf_led_event_register(eventarray[i]);
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 app_led_pin_init(void)
|
||||
{
|
||||
|
||||
if(sf_poweron_type_get() != SF_MCU_STARTUP_ONKEY && sf_poweron_type_get() != SF_MCU_STARTUP_NORMAL)
|
||||
return SF_SUCCESS;
|
||||
|
||||
sf_hal_gpio_init(SF_HAL_LED_STATUS_G,GPIO_DIR_OUT);
|
||||
|
||||
sf_hal_gpio_init(SF_HAL_LED_SD_G,GPIO_DIR_OUT);
|
||||
sf_hal_gpio_init(SF_HAL_LED_SD_R,GPIO_DIR_OUT);
|
||||
|
||||
sf_hal_gpio_init(SF_HAL_LED_BAT_G, GPIO_DIR_OUT);
|
||||
sf_hal_gpio_init(SF_HAL_LED_BAT_R, GPIO_DIR_OUT);
|
||||
|
||||
sf_hal_gpio_init(SF_HAL_LED_SIG1_G,GPIO_DIR_OUT);
|
||||
sf_hal_gpio_init(SF_HAL_LED_SIG1_R,GPIO_DIR_OUT);
|
||||
|
||||
sf_hal_gpio_init(SF_HAL_LED_USERBIND_G,GPIO_DIR_OUT);
|
||||
sf_hal_gpio_init(SF_HAL_LED_USERBIND_R,GPIO_DIR_OUT);
|
||||
|
||||
sf_hal_gpio_init(GPIOID_PIR_TEST, GPIO_DIR_IN);
|
||||
// sf_hal_gpio_init(GPIOID_SIM_INSRET, GPIO_DIR_IN);
|
||||
// sf_hal_gpio_init(GPIOID_USB_INSERT, GPIO_DIR_IN);
|
||||
|
||||
SINT8 halvalue = 0;
|
||||
SF_MUTEX_LOCK(GPIO_mutexLock);
|
||||
sf_hal_gpio_init(SF_KEY_PIN_SYNC,GPIO_DIR_IN);
|
||||
sf_hal_gpio_get(SF_KEY_PIN_SYNC,&halvalue);
|
||||
sf_hal_gpio_deinit(SF_KEY_PIN_SYNC);
|
||||
SF_MUTEX_UNLOCK(GPIO_mutexLock);
|
||||
MLOGI("halvalue: %d\n",halvalue);
|
||||
if(halvalue == 0)
|
||||
return SF_SUCCESS;
|
||||
|
||||
SF_MESSAGE_BUF_S stMessageBuf = {0};
|
||||
stMessageBuf.cmdId = CMD_LED;
|
||||
stMessageBuf.arg1 = LED_STATUS_HOLD_ON;
|
||||
stMessageBuf.arg2 = LED_GROUP_STATUS;
|
||||
stMessageBuf.arg3 = LED_TYPE_GREEN;
|
||||
sf_com_message_send_to_app(&stMessageBuf);
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* app2.c
|
||||
*
|
||||
* Created on: 2023年4月7日
|
||||
* Author: NVT02970
|
||||
*/
|
||||
|
||||
#include <io/gpio.h>
|
||||
#include <UIWnd/UIFlow.h>
|
||||
|
||||
int sfmain(int argc, char *argv[])
|
||||
{
|
||||
//gpio_direction_input(C_GPIO(10));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Binary file not shown.
113
code/application/source/sf_app/code/source/commMng/sf_message_queue.c
Executable file
113
code/application/source/sf_app/code/source/commMng/sf_message_queue.c
Executable file
|
@ -0,0 +1,113 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <printf.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/msg.h>
|
||||
#include "sf_log.h"
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
int sf_msgQueueId = -1;
|
||||
int cardv_msgQueueId = -1;
|
||||
|
||||
|
||||
|
||||
|
||||
static SINT32 message_queue_send(SINT32 MsgQueueId,SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
|
||||
|
||||
size_t msgsz = sizeof(pMessageBuf->cmdId) + sizeof(pMessageBuf->s32Wait) + sizeof(pMessageBuf->arg1) + sizeof(pMessageBuf->arg2)+ sizeof(pMessageBuf->arg3);
|
||||
if(msgsnd(MsgQueueId, pMessageBuf, msgsz, 0) == -1)
|
||||
{
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
static SINT32 message_queue_recv(SINT32 MsgQueueId,SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
|
||||
size_t msgsz = sizeof(pMessageBuf->cmdId) + sizeof(pMessageBuf->s32Wait) + sizeof(pMessageBuf->arg1) + sizeof(pMessageBuf->arg2)+ sizeof(pMessageBuf->arg3);
|
||||
|
||||
if(msgrcv(MsgQueueId, pMessageBuf, msgsz,0,IPC_NOWAIT) == -1)
|
||||
{
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
static SINT32 message_queue_create(SF_CHAR *pathname,SINT32 *pMsgQueueId)
|
||||
{
|
||||
key_t key;
|
||||
SF_CHAR touchPath[128] = {0};
|
||||
if(access(pathname, F_OK) != 0)
|
||||
{
|
||||
sprintf(touchPath, "%s %s","touch",pathname);
|
||||
system(touchPath);
|
||||
}
|
||||
if((key = ftok(pathname,'z')) < 0)
|
||||
{
|
||||
MLOGI("ftok error");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
if ((*pMsgQueueId = msgget(key, IPC_CREAT | 0660)) == -1)
|
||||
{
|
||||
MLOGI("MsgQueueId = %#x\n",*pMsgQueueId);
|
||||
MLOGI("msgget failed errno.%02d is: %s\n", errno, strerror(errno));
|
||||
return SF_FAILURE;
|
||||
}
|
||||
MLOGI("MsgQueueId = %#x\n",*pMsgQueueId);
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 sf_com_message_app_init(void)
|
||||
{
|
||||
return message_queue_create((char*)"/tmp/sf_message",&sf_msgQueueId);
|
||||
}
|
||||
SINT32 sf_com_message_recv_from_app(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
return message_queue_recv(sf_msgQueueId,pMessageBuf);
|
||||
}
|
||||
|
||||
SINT32 sf_com_message_send_to_app(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
pMessageBuf->mtype = 1;
|
||||
return message_queue_send(sf_msgQueueId,pMessageBuf);
|
||||
}
|
||||
|
||||
SINT32 sf_com_message_cardv_init(void)
|
||||
{
|
||||
return message_queue_create((char*)"/tmp/cardv_message",&cardv_msgQueueId);
|
||||
}
|
||||
SINT32 sf_com_message_recv_from_cardv(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
return message_queue_recv(cardv_msgQueueId,pMessageBuf);
|
||||
}
|
||||
|
||||
SINT32 sf_com_message_send_to_cardv(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||
{
|
||||
pMessageBuf->mtype = 1;
|
||||
return message_queue_send(cardv_msgQueueId,pMessageBuf);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
218
code/application/source/sf_app/code/source/commMng/sf_share_mem.c
Executable file
218
code/application/source/sf_app/code/source/commMng/sf_share_mem.c
Executable file
|
@ -0,0 +1,218 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <printf.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/sem.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
#include "sf_log.h"
|
||||
#include "sf_type.h"
|
||||
#include "sf_param_common.h"
|
||||
#include "sf_fileMng.h"
|
||||
|
||||
int sf_semId = -1;
|
||||
int sf_sharMemId = -1;
|
||||
int sf_sharMemfileId = -1;
|
||||
|
||||
union semun {
|
||||
int val;
|
||||
struct semid_ds *buf;
|
||||
unsigned short *array;
|
||||
struct seminfo *__buf;
|
||||
};
|
||||
|
||||
SINT32 sem_creat(SF_CHAR *pathname,SINT32 *psemid)
|
||||
{
|
||||
SF_CHAR touchPath[128] = {0};
|
||||
if(access(pathname, F_OK) != 0)
|
||||
{
|
||||
sprintf(touchPath, "%s %s","touch",pathname);
|
||||
system(touchPath);
|
||||
}
|
||||
key_t key = ftok(pathname, 111);
|
||||
if(key < 0)
|
||||
{
|
||||
perror("ftok");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
*psemid = semget(key, 1, IPC_CREAT|IPC_EXCL|0666);
|
||||
if(*psemid < 0)
|
||||
{
|
||||
perror("semget");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
union semun un;
|
||||
un.val = 1;
|
||||
if(semctl(*psemid, 0, SETVAL, un)<0)
|
||||
{
|
||||
perror("semctl");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
|
||||
}
|
||||
SINT32 sem_check(SINT32 semid, SINT32 who, SINT32 op)
|
||||
{
|
||||
|
||||
struct sembuf sf;
|
||||
sf.sem_num = who;
|
||||
sf.sem_op = op;
|
||||
sf.sem_flg = 0;
|
||||
|
||||
if(semop(semid, &sf, 1) < 0)
|
||||
{
|
||||
perror("semop");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 sf_sem_init(SF_CHAR *pathname,SINT32 *psemid)
|
||||
{
|
||||
return sem_creat(pathname,psemid);
|
||||
}
|
||||
|
||||
SINT32 sf_sem_down(SINT32 semid, SINT32 who)
|
||||
{
|
||||
return sem_check(semid, who, -1);
|
||||
}
|
||||
|
||||
SINT32 sf_sem_up(SINT32 semid, SINT32 who)
|
||||
{
|
||||
return sem_check(semid, who, 1);
|
||||
}
|
||||
SINT32 sf_sem_deinit(SINT32 semid)
|
||||
{
|
||||
if(semctl(semid, 0, IPC_RMID) < 0)
|
||||
{
|
||||
perror("semctl");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
int share_mem_create(SF_CHAR *pathname,int size,SINT32 *pshmID)
|
||||
{
|
||||
SF_CHAR touchPath[128] = {0};
|
||||
if(access(pathname, F_OK) != 0)
|
||||
{
|
||||
sprintf(touchPath, "%s %s","touch",pathname);
|
||||
system(touchPath);
|
||||
}
|
||||
key_t key = ftok(pathname, 111);
|
||||
if(key < 0)
|
||||
{
|
||||
perror("ftok");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
*pshmID = shmget(key, size, IPC_CREAT|0666);
|
||||
if(*pshmID == -1)
|
||||
{
|
||||
perror("shmget");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
int share_mem_destory(int shmID)
|
||||
{
|
||||
|
||||
if(shmctl(shmID, IPC_RMID, NULL) < 0 )
|
||||
{
|
||||
perror("shmctl");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
void* share_mem_get(int shmID)
|
||||
{
|
||||
return shmat(shmID, NULL, 0);
|
||||
}
|
||||
SINT32 sf_share_mem_init(SF_CHAR *pathname,int size,SINT32 *pshmID)
|
||||
{
|
||||
return share_mem_create(pathname,size,pshmID);
|
||||
}
|
||||
SINT32 sf_share_mem_deinit(SINT32 shmID)
|
||||
{
|
||||
return share_mem_destory(shmID);
|
||||
}
|
||||
void* sf_share_mem_get(int shmID)
|
||||
{
|
||||
return share_mem_get(shmID);
|
||||
}
|
||||
|
||||
SINT32 sf_share_mem_file_init(void)
|
||||
{
|
||||
SF_SRCFILE_ATTR_S *pThumbFileCfg = 0;
|
||||
if(SF_SUCCESS == sf_share_mem_init((char*)"/tmp/sf_file",sizeof(SF_SRCFILE_ATTR_S),&sf_sharMemfileId))
|
||||
{
|
||||
pThumbFileCfg = (SF_SRCFILE_ATTR_S *)sf_share_mem_get(sf_sharMemfileId);
|
||||
if(pThumbFileCfg <= 0)
|
||||
{
|
||||
MLOGI("creat share mem failed!!!\n");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sf_file_thumb_cfg_set(pThumbFileCfg);
|
||||
MLOGI("creat share mem succeed!!!\n");
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
}
|
||||
return SF_FAILURE;
|
||||
}
|
||||
SINT32 sf_share_mem_customer_init(void)
|
||||
{
|
||||
SF_PDT_PARAM_CFG_S *pSfCustomerPara = 0;
|
||||
if(SF_SUCCESS == sf_share_mem_init((char*)"/tmp/sf_share",sizeof(SF_PDT_PARAM_CFG_S),&sf_sharMemId))
|
||||
{
|
||||
pSfCustomerPara = (SF_PDT_PARAM_CFG_S *)sf_share_mem_get(sf_sharMemId);
|
||||
if(pSfCustomerPara <= 0)
|
||||
{
|
||||
MLOGI("creat share mem failed!!!\n");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sf_customer_param_set(pSfCustomerPara);
|
||||
MLOGI("creat share mem succeed!!!\n");
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
return SF_FAILURE;
|
||||
|
||||
}
|
||||
SINT32 sf_share_mem_file_deinit(void)
|
||||
{
|
||||
return sf_share_mem_deinit(sf_sharMemfileId);
|
||||
}
|
||||
|
||||
SINT32 sf_share_mem_customer_deinit(void)
|
||||
{
|
||||
return sf_share_mem_deinit(sf_sharMemId);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
352
code/application/source/sf_app/code/source/dataMng/sf_dataMng.c
Executable file
352
code/application/source/sf_app/code/source/dataMng/sf_dataMng.c
Executable file
|
@ -0,0 +1,352 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <sf_datahttp.h>
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
#include "sf_transdata1.h"
|
||||
#endif
|
||||
#include "sf_dataMng.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
SF_PARA_TIME_S rtcTime = {0};
|
||||
SF_CMD_QUERYPENDING_E PendingOrder = SF_QUERYPENDING_COMMAND_BUTT;
|
||||
UINT8 CanUpload = 0;
|
||||
UINT8 UploadMode = 0;
|
||||
UINT8 HasCommand = 0;
|
||||
UINT16 SubscribeRet = 0;
|
||||
|
||||
|
||||
static UINT8 auchCRCHi[256] = {
|
||||
0x00, 0xC1, 0x81,
|
||||
0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x00,
|
||||
0xC1, 0x81, 0x40, 0x01, 0xC0,
|
||||
0x80, 0x41, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x01,
|
||||
0xC0, 0x80, 0x41, 0x00, 0xC1,
|
||||
0x81, 0x40, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01,
|
||||
0xC0, 0x80, 0x41, 0x01, 0xC0,
|
||||
0x80, 0x41, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00,
|
||||
0xC1, 0x81, 0x40, 0x01, 0xC0,
|
||||
0x80, 0x41, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x00,
|
||||
0xC1, 0x81, 0x40, 0x00, 0xC1,
|
||||
0x81, 0x40, 0x01, 0xC0, 0x80,
|
||||
0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x01,
|
||||
0xC0, 0x80, 0x41, 0x00, 0xC1,
|
||||
0x81, 0x40, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x00,
|
||||
0xC1, 0x81, 0x40, 0x00, 0xC1,
|
||||
0x81, 0x40, 0x01, 0xC0, 0x80,
|
||||
0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x01,
|
||||
0xC0, 0x80, 0x41, 0x00, 0xC1,
|
||||
0x81, 0x40, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x00,
|
||||
0xC1, 0x81, 0x40, 0x01, 0xC0,
|
||||
0x80, 0x41, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x00,
|
||||
0xC1, 0x81, 0x40, 0x01, 0xC0,
|
||||
0x80, 0x41, 0x01, 0xC0, 0x80,
|
||||
0x41, 0x00, 0xC1, 0x81, 0x40,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x00,
|
||||
0xC1, 0x81, 0x40, 0x00, 0xC1,
|
||||
0x81, 0x40, 0x01, 0xC0, 0x80,
|
||||
0x41, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x00, 0xC1, 0x81, 0x40, 0x00,
|
||||
0xC1, 0x81, 0x40, 0x01, 0xC0,
|
||||
0x80, 0x41, 0x00, 0xC1, 0x81,
|
||||
0x40, 0x01, 0xC0, 0x80, 0x41,
|
||||
0x01, 0xC0, 0x80, 0x41, 0x00,
|
||||
0xC1, 0x81, 0x40 };
|
||||
|
||||
static UINT8 auchCRCLo[256] = {
|
||||
0x00, 0xC0, 0xC1,
|
||||
0x01, 0xC3, 0x03, 0x02, 0xC2,
|
||||
0xC6, 0x06, 0x07, 0xC7, 0x05,
|
||||
0xC5, 0xC4, 0x04, 0xCC, 0x0C,
|
||||
0x0D, 0xCD, 0x0F, 0xCF, 0xCE,
|
||||
0x0E, 0x0A, 0xCA, 0xCB, 0x0B,
|
||||
0xC9, 0x09, 0x08, 0xC8, 0xD8,
|
||||
0x18, 0x19, 0xD9, 0x1B, 0xDB,
|
||||
0xDA, 0x1A, 0x1E, 0xDE, 0xDF,
|
||||
0x1F, 0xDD, 0x1D, 0x1C, 0xDC,
|
||||
0x14, 0xD4, 0xD5, 0x15, 0xD7,
|
||||
0x17, 0x16, 0xD6, 0xD2, 0x12,
|
||||
0x13, 0xD3, 0x11, 0xD1, 0xD0,
|
||||
0x10, 0xF0, 0x30, 0x31, 0xF1,
|
||||
0x33, 0xF3, 0xF2, 0x32, 0x36,
|
||||
0xF6, 0xF7, 0x37, 0xF5, 0x35,
|
||||
0x34, 0xF4, 0x3C, 0xFC, 0xFD,
|
||||
0x3D, 0xFF, 0x3F, 0x3E, 0xFE,
|
||||
0xFA, 0x3A, 0x3B, 0xFB, 0x39,
|
||||
0xF9, 0xF8, 0x38, 0x28, 0xE8,
|
||||
0xE9, 0x29, 0xEB, 0x2B, 0x2A,
|
||||
0xEA, 0xEE, 0x2E, 0x2F, 0xEF,
|
||||
0x2D, 0xED, 0xEC, 0x2C, 0xE4,
|
||||
0x24, 0x25, 0xE5, 0x27, 0xE7,
|
||||
0xE6, 0x26, 0x22, 0xE2, 0xE3,
|
||||
0x23, 0xE1, 0x21, 0x20, 0xE0,
|
||||
0xA0, 0x60, 0x61, 0xA1, 0x63,
|
||||
0xA3, 0xA2, 0x62, 0x66, 0xA6,
|
||||
0xA7, 0x67, 0xA5, 0x65, 0x64,
|
||||
0xA4, 0x6C, 0xAC, 0xAD, 0x6D,
|
||||
0xAF, 0x6F, 0x6E, 0xAE, 0xAA,
|
||||
0x6A, 0x6B, 0xAB, 0x69, 0xA9,
|
||||
0xA8, 0x68, 0x78, 0xB8, 0xB9,
|
||||
0x79, 0xBB, 0x7B, 0x7A, 0xBA,
|
||||
0xBE, 0x7E, 0x7F, 0xBF, 0x7D,
|
||||
0xBD, 0xBC, 0x7C, 0xB4, 0x74,
|
||||
0x75, 0xB5, 0x77, 0xB7, 0xB6,
|
||||
0x76, 0x72, 0xB2, 0xB3, 0x73,
|
||||
0xB1, 0x71, 0x70, 0xB0, 0x50,
|
||||
0x90, 0x91, 0x51, 0x93, 0x53,
|
||||
0x52, 0x92, 0x96, 0x56, 0x57,
|
||||
0x97, 0x55, 0x95, 0x94, 0x54,
|
||||
0x9C, 0x5C, 0x5D, 0x9D, 0x5F,
|
||||
0x9F, 0x9E, 0x5E, 0x5A, 0x9A,
|
||||
0x9B, 0x5B, 0x99, 0x59, 0x58,
|
||||
0x98, 0x88, 0x48, 0x49, 0x89,
|
||||
0x4B, 0x8B, 0x8A, 0x4A, 0x4E,
|
||||
0x8E, 0x8F, 0x4F, 0x8D, 0x4D,
|
||||
0x4C, 0x8C, 0x44, 0x84, 0x85,
|
||||
0x45, 0x87, 0x47, 0x46, 0x86,
|
||||
0x82, 0x42, 0x43, 0x83, 0x41,
|
||||
0x81, 0x80, 0x40 };
|
||||
|
||||
|
||||
|
||||
UINT16 crcCheck( UINT8 strContent[],UINT16 usDataLen,UINT16 crc)
|
||||
{
|
||||
UINT16 uIndex;
|
||||
|
||||
UINT8 uchCRCHi = 0xFF;
|
||||
UINT8 uchCRCLo = 0xFF;
|
||||
UINT16 i = 0;
|
||||
UINT16 value=0;
|
||||
|
||||
for (i = 0; i < usDataLen; i++) {
|
||||
uIndex = (uchCRCHi ^ strContent[i]) & 0xff;
|
||||
|
||||
uchCRCHi = (uchCRCLo ^ auchCRCHi[uIndex]);
|
||||
uchCRCLo = auchCRCLo[uIndex];
|
||||
}
|
||||
|
||||
value = ((((UINT16) uchCRCHi) << 8 | (((UINT16) uchCRCLo) & 0xff))) & 0xffff;
|
||||
|
||||
if (crc == value) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
UINT16 makeCrc(UINT8 strContent[], UINT16 len)
|
||||
{
|
||||
UINT16 uIndex;
|
||||
UINT16 usDataLen = len;
|
||||
|
||||
UINT8 uchCRCHi = 0xFF;
|
||||
UINT8 uchCRCLo = 0xFF;
|
||||
UINT16 value=0;
|
||||
UINT16 i = 0;
|
||||
for (i = 0; i < usDataLen; i++) {
|
||||
uIndex = (uchCRCHi ^ strContent[i]) & 0xff;
|
||||
|
||||
uchCRCHi = (uchCRCLo ^ auchCRCHi[uIndex]);
|
||||
uchCRCLo = auchCRCLo[uIndex];
|
||||
}
|
||||
value = ((((UINT16) uchCRCHi) << 8 | (((UINT16) uchCRCLo) & 0xff))) & 0xffff;
|
||||
return value;
|
||||
}
|
||||
|
||||
void sf_data_subscribe_result_set(UINT16 ret)
|
||||
{
|
||||
if(ret == SF_SUCCESS)
|
||||
SubscribeRet = 0;
|
||||
// else if(ret == SF_TCP_ERROR_SUBSCRIBE_NO_FILE)
|
||||
// SubscribeRet = 2;
|
||||
else
|
||||
SubscribeRet = 1;
|
||||
}
|
||||
|
||||
SF_PARA_TIME_S* sf_server_time_get(void)
|
||||
{
|
||||
return &rtcTime;
|
||||
}
|
||||
|
||||
|
||||
UINT8 sf_data_has_command_get(void)
|
||||
{
|
||||
return HasCommand;
|
||||
}
|
||||
UINT8 sf_data_transfer_mode_get(void)
|
||||
{
|
||||
return UploadMode;
|
||||
}
|
||||
SINT32 sf_data_cam_local_time_get(SF_PARA_TIME_S* pstdata)
|
||||
{
|
||||
memcpy(pstdata,&rtcTime,sizeof(SF_PARA_TIME_S));
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
UINT32 sf_data_pendingcmd_get(void)
|
||||
{
|
||||
return PendingOrder;
|
||||
}
|
||||
SINT32 sf_data_grouping_login(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetgrouping_login(pstdata,pfnParam);
|
||||
#else
|
||||
return sf_net_packetgrouping_login(pstdata,pfnParam);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_grouping_fileresult(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam,SF_VOID *pstfileAttr)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetgrouping_fileresult(pstdata,(SF_PDT_PARAM_CFG_S*)pfnParam->pstParam,pstfileAttr);
|
||||
#else
|
||||
return sf_net_packetgrouping_fileresult(pstdata,(SF_PDT_PARAM_STATISTICS_S*)pfnParam->pstaticParam,(SF_REPORT_FILE_ATTR_S*)pstfileAttr);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_grouping_disconnection(SF_DATA_ATTR_S *pstdata,SF_VOID *Param)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetgrouping_disconnection(pstdata,Param);
|
||||
#else
|
||||
//acm http need tcp alive
|
||||
return sf_net_packetgrouping_disconnection(pstdata,Param);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_grouping_query_cmd(SF_DATA_ATTR_S *pstdata)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetgrouping_query_cmd(pstdata);
|
||||
#else
|
||||
return SF_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_grouping_query_cmd_param(SF_DATA_ATTR_S *pstdata)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetgrouping_query_cmd_param(pstdata);
|
||||
#else
|
||||
return SF_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_grouping_cmd_report(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam, SF_FILE_ATTR_S *pstfileAttr)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetgrouping_cmd_report(pstdata,pfnParam,pstfileAttr);
|
||||
#else
|
||||
return SF_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_grouping_get_bind_account(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetgrouping_get_bind_account(pstdata,pfnParam);
|
||||
#else
|
||||
return SF_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_grouping_sync_cfg(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return SF_SUCCESS;
|
||||
#else
|
||||
return sf_net_packetgrouping_sync(pstdata,pfnParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
SINT32 sf_data_analysis_login(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetanalysis_login(pstdata,pfnParam);
|
||||
#else
|
||||
return sf_net_packetanalysis_login(pstdata,pfnParam);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_analysis_fileresult(SF_DATA_ATTR_S *pstdata)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetanalysis_fileresult(pstdata);
|
||||
#else
|
||||
return sf_net_packetanalysis_fileresult(pstdata);
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_analysis_query_cmd(SF_DATA_ATTR_S *pstdata)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetanalysis_query_cmd(pstdata);
|
||||
#else
|
||||
return SF_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_analysis_query_cmd_param(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetanalysis_query_cmd_param(pstdata,pfnParam);
|
||||
#else
|
||||
return SF_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_analysis_cmd_report(SF_DATA_ATTR_S *pstdata)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetanalysis_cmd_report(pstdata);
|
||||
#else
|
||||
return SF_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_analysis_bind_account(SF_DATA_ATTR_S *pstdata,SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetanalysis_bind_account(pstdata,pfnParam);
|
||||
#else
|
||||
return SF_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_analysis_trigger(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return sf_packetanalysis_trigger(pstdata,pfnParam);
|
||||
#else
|
||||
return SF_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
SINT32 sf_data_analysis_sync_cfg(SF_DATA_ATTR_S *pstdata, SF_FN_PARAM_S *pfnParam)
|
||||
{
|
||||
#if defined(CFG_TRANSDATA_AT)
|
||||
return SF_SUCCESS;
|
||||
#else
|
||||
return sf_net_packetanalysis_sync(pstdata,pfnParam);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
1403
code/application/source/sf_app/code/source/dataMng/sf_datahttp.c
Executable file
1403
code/application/source/sf_app/code/source/dataMng/sf_datahttp.c
Executable file
File diff suppressed because it is too large
Load Diff
1722
code/application/source/sf_app/code/source/dataMng/sf_transdata1.c
Executable file
1722
code/application/source/sf_app/code/source/dataMng/sf_transdata1.c
Executable file
File diff suppressed because it is too large
Load Diff
140
code/application/source/sf_app/code/source/debugMng/sf_debug.c
Executable file
140
code/application/source/sf_app/code/source/debugMng/sf_debug.c
Executable file
|
@ -0,0 +1,140 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "sf_type.h"
|
||||
#include "sf_log.h"
|
||||
#include "sf_debug.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
SINT8 bDebugEnble = SF_TRUE;
|
||||
static SF_DEBUG_CMD_ATTR_S *stDebugCmdArray = SF_NULL;
|
||||
static SINT16 DebugCmdArraylenth = 0;
|
||||
SINT32 debug_cmd_parse(SF_CHAR *pString)
|
||||
{
|
||||
SINT32 i = 0;
|
||||
SINT32 index = 0;
|
||||
SINT32 s32ret = 0;
|
||||
SINT32 argc = 0;
|
||||
SF_CHAR argv[8][32] = {0};
|
||||
SF_CHAR *pargv[8] = {0};
|
||||
SF_CHAR *pstr = 0;
|
||||
|
||||
if(!stDebugCmdArray ||!DebugCmdArraylenth ) {
|
||||
MLOGE("Debug have not created,please created before using it !!!!\n");
|
||||
return SF_FAILURE;
|
||||
}
|
||||
for(index = 0; index < DebugCmdArraylenth;index++) {
|
||||
|
||||
if(strstr(pString, stDebugCmdArray[index].cmdStr))
|
||||
break;
|
||||
}
|
||||
|
||||
if(index >= DebugCmdArraylenth) {
|
||||
MLOGE("[%s] not exist in cmd list",pString);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
pstr = strtok(pString, " ");
|
||||
while(pstr != SF_NULL) {
|
||||
strcpy(argv[argc++],pstr);
|
||||
|
||||
pstr = strtok(SF_NULL, " ");
|
||||
}
|
||||
|
||||
for(i = 0; i < argc && argc < 8 ;i++) {
|
||||
pargv[i] = &argv[i][0];
|
||||
}
|
||||
|
||||
if(!stDebugCmdArray[index].pfn_debug_cmd_exe){
|
||||
MLOGE("cmd [%s] undefineed cmd exe function !!!\n",stDebugCmdArray[index].cmdStr);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
|
||||
s32ret = stDebugCmdArray[index].pfn_debug_cmd_exe(argc,pargv);
|
||||
|
||||
return s32ret;
|
||||
|
||||
}
|
||||
SINT32 sf_debug_init(SF_CHAR *filepath,SINT32 *fd)
|
||||
{
|
||||
SINT32 s32ret = SF_SUCCESS;
|
||||
s32ret = mkfifo(filepath, 0777);
|
||||
|
||||
*fd = open(filepath,O_RDWR);
|
||||
if(*fd < 0) {
|
||||
MLOGE("open [%s] failed !!!\n",filepath);
|
||||
return SF_FAILURE;
|
||||
}
|
||||
return s32ret;
|
||||
}
|
||||
SINT32 sf_debug_create(SF_DEBUG_CMD_ATTR_S *pDebugCmdArray,SINT16 lenth)
|
||||
{
|
||||
stDebugCmdArray=pDebugCmdArray;
|
||||
DebugCmdArraylenth = lenth;
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 sf_debug_start(SINT32 fd)
|
||||
{
|
||||
SINT32 s32ret = SF_SUCCESS;
|
||||
fd_set read_fds;
|
||||
SF_CHAR fifo_data[256] = {0};
|
||||
|
||||
while (bDebugEnble) {
|
||||
FD_ZERO(&read_fds);
|
||||
FD_SET(fd, &read_fds);
|
||||
|
||||
s32ret = select(fd + 1, &read_fds, NULL, NULL, NULL);
|
||||
if (s32ret > 0) {
|
||||
if (FD_ISSET(fd, &read_fds)) {
|
||||
s32ret = read(fd, fifo_data, 256);
|
||||
if (s32ret > 0) {
|
||||
debug_cmd_parse(fifo_data);
|
||||
memset(fifo_data, 0x00, 256);
|
||||
}
|
||||
}
|
||||
FD_CLR(fd, &read_fds);
|
||||
}
|
||||
else if (s32ret < 0) {
|
||||
MLOGE("FIFO select failed\n");
|
||||
continue;
|
||||
}
|
||||
else if (0 == s32ret) {
|
||||
MLOGW("FIFO select timeout\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
SINT32 sf_debug_stop(void)
|
||||
{
|
||||
bDebugEnble = SF_FALSE;
|
||||
return SF_SUCCESS;
|
||||
}
|
||||
|
||||
SINT32 sf_debug_deinit(SINT32 fd)
|
||||
{
|
||||
return close(fd);
|
||||
}
|
||||
|
||||
|
||||
|
47
code/application/source/sf_app/code/source/devMng/sf_dev_other.c
Executable file
47
code/application/source/sf_app/code/source/devMng/sf_dev_other.c
Executable file
|
@ -0,0 +1,47 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "sf_log.h"
|
||||
#include "sf_ledmng.h"
|
||||
#include "sf_hal_gpio.h"
|
||||
#include "sf_systemMng.h"
|
||||
#include "sf_message_queue.h"
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
extern pthread_mutex_t GPIO_mutexLock;
|
||||
|
||||
SINT32 sf_dev_pir_status_get(void)
|
||||
{
|
||||
SINT8 regValue = 0;
|
||||
SF_MUTEX_LOCK(GPIO_mutexLock);
|
||||
sf_hal_gpio_get(GPIOID_PIR_TEST, ®Value);
|
||||
SF_MUTEX_UNLOCK(GPIO_mutexLock);
|
||||
return (regValue & 0xFF)?1:0;
|
||||
}
|
||||
UINT16 sf_pir_to_digit_analog(UINT8 pirs)
|
||||
{
|
||||
UINT16 pirlevel = 0;
|
||||
|
||||
if(pirs > 7)
|
||||
pirlevel = 0;
|
||||
else if(pirs > 6)
|
||||
pirlevel = 1;
|
||||
else
|
||||
pirlevel = 2;
|
||||
|
||||
return pirlevel;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
45
code/application/source/sf_app/code/source/devMng/sf_dev_usb.c
Executable file
45
code/application/source/sf_app/code/source/devMng/sf_dev_usb.c
Executable file
|
@ -0,0 +1,45 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sf_dev_usb.h"
|
||||
static UINT8 usb_app_mode = SF_USB_APP_CHARGE;
|
||||
extern pthread_mutex_t GPIO_mutexLock;
|
||||
|
||||
void sf_usb_app_mode_set(SF_USB_MODE_E mode)
|
||||
{
|
||||
usb_app_mode = mode;
|
||||
}
|
||||
|
||||
SF_USB_MODE_E sf_usb_app_mode_get(void)
|
||||
{
|
||||
return usb_app_mode;
|
||||
}
|
||||
|
||||
SINT32 sf_usb_IsInsert(void)
|
||||
{
|
||||
SINT8 regValue = 0;
|
||||
SF_MUTEX_LOCK(GPIO_mutexLock);
|
||||
sf_hal_gpio_init(GPIOID_USB_INSERT, GPIO_DIR_IN);
|
||||
sf_hal_gpio_get(GPIOID_USB_INSERT, ®Value);
|
||||
sf_hal_gpio_deinit(GPIOID_USB_INSERT);
|
||||
SF_MUTEX_UNLOCK(GPIO_mutexLock);
|
||||
|
||||
return (regValue & 0xFF) ? 1:0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user