1.蓝牙业务
This commit is contained in:
parent
b2e697ed1e
commit
4015d47723
|
@ -33,6 +33,9 @@ SIFAR_DIR = $(LIBRARY_DIR)/source/sifar/code
|
||||||
SIFAR_APP_DIR = $(APP_DIR)/source/sf_app/code/include
|
SIFAR_APP_DIR = $(APP_DIR)/source/sf_app/code/include
|
||||||
SIFAR_APP_LPA_DIR = $(APP_DIR)/source/sf_app/code/source/sf_lpa/LPA_SDK/include
|
SIFAR_APP_LPA_DIR = $(APP_DIR)/source/sf_app/code/source/sf_lpa/LPA_SDK/include
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH=$(LIBRARY_DIR)/output/
|
||||||
|
|
||||||
|
|
||||||
#LIB DIRs for C_LDFLAGS
|
#LIB DIRs for C_LDFLAGS
|
||||||
EXTRA_LIB_DIR += \
|
EXTRA_LIB_DIR += \
|
||||||
-L$(LIBC_LIB_DIR) \
|
-L$(LIBC_LIB_DIR) \
|
||||||
|
@ -54,6 +57,7 @@ EXTRA_LIB_DIR += \
|
||||||
-L$(NVT_VOS_DIR)/output \
|
-L$(NVT_VOS_DIR)/output \
|
||||||
-L$(NVT_DRIVER_DIR)/output \
|
-L$(NVT_DRIVER_DIR)/output \
|
||||||
-L$(APP_DIR)/sifarsdk/out/libs \
|
-L$(APP_DIR)/sifarsdk/out/libs \
|
||||||
|
-L$(APP_DIR)/source/sf_app/tools/blue/lib \
|
||||||
|
|
||||||
# public includes
|
# public includes
|
||||||
EXTRA_INCLUDE += \
|
EXTRA_INCLUDE += \
|
||||||
|
@ -78,6 +82,13 @@ EXTRA_INCLUDE += \
|
||||||
-I$(SIFAR_APP_DIR) \
|
-I$(SIFAR_APP_DIR) \
|
||||||
-I$(SIFAR_APP_LPA_DIR) \
|
-I$(SIFAR_APP_LPA_DIR) \
|
||||||
-I$(APP_DIR)/sifarsdk/out/libs/include \
|
-I$(APP_DIR)/sifarsdk/out/libs/include \
|
||||||
|
-I$(APP_DIR)/source/sf_app/code/source/sf_blue \
|
||||||
|
-I$(APP_DIR)/source/sf_app/code/source/sf_blue/src \
|
||||||
|
-I$(APP_DIR)/source/sf_app/code/source/sf_blue/inc/bluetooth \
|
||||||
|
-I$(APP_DIR)/source/sf_app/code/source/sf_blue/inc/dbus \
|
||||||
|
-I$(APP_DIR)/source/sf_app/code/source/sf_blue/inc/glib \
|
||||||
|
-I$(APP_DIR)/source/sf_app/tools/blue/include \
|
||||||
|
-I$(APP_DIR)/source/sf_app/tools/blue/include/dbus-1.0 \
|
||||||
|
|
||||||
# application local includes
|
# application local includes
|
||||||
EXTRA_INCLUDE += \
|
EXTRA_INCLUDE += \
|
||||||
|
@ -116,8 +127,17 @@ EXTRA_LIB = \
|
||||||
-lgcc_s \
|
-lgcc_s \
|
||||||
-lrt \
|
-lrt \
|
||||||
-lm \
|
-lm \
|
||||||
-l:libstdc++.a \
|
-lstdc++ \
|
||||||
-lpthread \
|
-lpthread \
|
||||||
|
-lgettextlib -Wl,-rpath-link=$(LD_LIBRARY_PATH) \
|
||||||
|
-lgettextpo \
|
||||||
|
-lintl \
|
||||||
|
-lncurses \
|
||||||
|
-lbluetooth \
|
||||||
|
-ldbus-1 \
|
||||||
|
-lglib-2.0 \
|
||||||
|
|
||||||
|
# -rpath $(LIBRARY_DIR)/output \
|
||||||
|
|
||||||
# vos
|
# vos
|
||||||
EXTRA_LIB += \
|
EXTRA_LIB += \
|
||||||
|
@ -305,7 +325,17 @@ SRC = \
|
||||||
./code/source/debugMng/sf_debug.c \
|
./code/source/debugMng/sf_debug.c \
|
||||||
./code/source/updataMng/sf_md5.c \
|
./code/source/updataMng/sf_md5.c \
|
||||||
./code/source/updataMng/sf_otamng.c \
|
./code/source/updataMng/sf_otamng.c \
|
||||||
./code/source/battery/sf_battery.c
|
./code/source/battery/sf_battery.c \
|
||||||
|
./code/source/sf_blue/src/client.c \
|
||||||
|
./code/source/sf_blue/src/gatt_service.c \
|
||||||
|
./code/source/sf_blue/src/hciconfig.c \
|
||||||
|
./code/source/sf_blue/src/mainloop.c \
|
||||||
|
./code/source/sf_blue/src/object.c \
|
||||||
|
./code/source/sf_blue/src/polkit.c \
|
||||||
|
./code/source/sf_blue/src/sf_blue_app.c \
|
||||||
|
./code/source/sf_blue/src/sf_blue_hal.c \
|
||||||
|
./code/source/sf_blue/src/util.c \
|
||||||
|
./code/source/sf_blue/src/watch.c \
|
||||||
|
|
||||||
# ./code/source/wifi/sf_data_transfer.c \
|
# ./code/source/wifi/sf_data_transfer.c \
|
||||||
# ./code/source/wifi/sf_svr_send.c \
|
# ./code/source/wifi/sf_svr_send.c \
|
||||||
|
@ -363,6 +393,7 @@ clean:
|
||||||
else
|
else
|
||||||
all: $(BIN)
|
all: $(BIN)
|
||||||
|
|
||||||
|
|
||||||
$(BIN): $(OBJ)
|
$(BIN): $(OBJ)
|
||||||
$(CC) -o $@ $(OBJ) $(LD_FLAGS)
|
$(CC) -o $@ $(OBJ) $(LD_FLAGS)
|
||||||
$(NM) -n $@ > $@.sym
|
$(NM) -n $@ > $@.sym
|
||||||
|
@ -390,8 +421,8 @@ install:
|
||||||
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/share/dbus-1/system.d
|
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/share/dbus-1/system.d
|
||||||
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/var/run/dbus
|
#@mkdir -p $(ROOTFS_DIR)/rootfs/home/payton/blue/var/run/dbus
|
||||||
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/local/share/dbus-1/system-services
|
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/local/share/dbus-1/system-services
|
||||||
#@mkdir -p $(ROOTFS_DIR)/rootfs/usr/share/dbus-1/system-services
|
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/share/dbus-1/system-services
|
||||||
#@mkdir -p $(ROOTFS_DIR)/rootfs/usr/share/dbus-1/system.d
|
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/share/dbus-1/system.d
|
||||||
@mkdir -p $(ROOTFS_DIR)/rootfs/lib/dbus-1/system-services
|
@mkdir -p $(ROOTFS_DIR)/rootfs/lib/dbus-1/system-services
|
||||||
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/etc/dbus-1/system-services
|
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/etc/dbus-1/system-services
|
||||||
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/etc/dbus-1/system.d
|
@mkdir -p $(ROOTFS_DIR)/rootfs/usr/etc/dbus-1/system.d
|
||||||
|
@ -429,5 +460,4 @@ install:
|
||||||
@cp -avf $(APP_DIR)/source/sf_app/tools/blue/share/dbus-1 $(ROOTFS_DIR)/rootfs/usr/etc
|
@cp -avf $(APP_DIR)/source/sf_app/tools/blue/share/dbus-1 $(ROOTFS_DIR)/rootfs/usr/etc
|
||||||
#@cp -avf /home/payton/blue/etc/dbus-1 $(ROOTFS_DIR)/rootfs/home/payton/blue
|
#@cp -avf /home/payton/blue/etc/dbus-1 $(ROOTFS_DIR)/rootfs/home/payton/blue
|
||||||
@cp -avf $(APP_DIR)/source/sf_app/tools/blue/dbus-1/system.d/bluetooth.conf $(ROOTFS_DIR)/rootfs/usr/etc/dbus-1/system.d/bluetooth.conf
|
@cp -avf $(APP_DIR)/source/sf_app/tools/blue/dbus-1/system.d/bluetooth.conf $(ROOTFS_DIR)/rootfs/usr/etc/dbus-1/system.d/bluetooth.conf
|
||||||
@cp -darvf $(APP_DIR)/source/sf_app/tools/blue/lib/*.* $(LIBRARY_DIR)/output
|
|
||||||
@echo ">>>>>>>>>>>>>>>>>>> $@ >>>>>>>>>>>>>>>>>>>"
|
@echo ">>>>>>>>>>>>>>>>>>> $@ >>>>>>>>>>>>>>>>>>>"
|
||||||
|
|
Binary file not shown.
|
@ -103,7 +103,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
printf("*********************************************\n");
|
printf("*********************************************\n");
|
||||||
printf("* *\n");
|
printf("* *\n");
|
||||||
printf("* sf_app-v5-0912 *\n");
|
printf("* sf_app *\n");
|
||||||
printf("* *\n");
|
printf("* *\n");
|
||||||
printf("*********************************************\n");
|
printf("*********************************************\n");
|
||||||
//gpio_direction_input(C_GPIO(10));
|
//gpio_direction_input(C_GPIO(10));
|
||||||
|
|
|
@ -56,6 +56,8 @@ extern "C" {
|
||||||
#include <sf_commMng.h>
|
#include <sf_commMng.h>
|
||||||
#include "sf_battery.h"
|
#include "sf_battery.h"
|
||||||
#include "sf_hal_ttyusb.h"
|
#include "sf_hal_ttyusb.h"
|
||||||
|
#include "sf_blue_app.h"
|
||||||
|
|
||||||
extern pthread_mutex_t Param_mutexLock;
|
extern pthread_mutex_t Param_mutexLock;
|
||||||
SINT8 longClickhold = 0;
|
SINT8 longClickhold = 0;
|
||||||
SINT8 bmoduleupdate = 0;
|
SINT8 bmoduleupdate = 0;
|
||||||
|
@ -761,6 +763,7 @@ static SINT32 sf_app_proccess_cmd_mcu(SF_MESSAGE_BUF_S *pMessageBuf)
|
||||||
stMessageBuf.arg3 = (SINT32)sf_get_mcu_ver();
|
stMessageBuf.arg3 = (SINT32)sf_get_mcu_ver();
|
||||||
stMessageBuf.cmdId = CMD_MCU;
|
stMessageBuf.cmdId = CMD_MCU;
|
||||||
sf_com_message_send_to_cardv(&stMessageBuf);
|
sf_com_message_send_to_cardv(&stMessageBuf);
|
||||||
|
sf_blue_app_start();
|
||||||
break;
|
break;
|
||||||
case SF_MCU_CMD_MODULE_SLEEP:
|
case SF_MCU_CMD_MODULE_SLEEP:
|
||||||
sf_set_module_sleep_flag(0);
|
sf_set_module_sleep_flag(0);
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
#include "hci.h"
|
#include "hci.h"
|
||||||
#include "hci_lib.h"
|
#include "hci_lib.h"
|
||||||
|
|
||||||
|
static struct hci_dev_info di;
|
||||||
|
static char g_sf_ble_ssid[14] = {0};
|
||||||
|
|
||||||
static void cmd_up(int ctl, int hdev)
|
static void cmd_up(int ctl, int hdev)
|
||||||
{
|
{
|
||||||
/* Start HCI device */
|
/* Start HCI device */
|
||||||
|
@ -74,6 +77,30 @@ static void cmd_name(int ctl, int hdev, char *name)
|
||||||
hdev, strerror(errno), errno);
|
hdev, strerror(errno), errno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
printf("Name: '%s'\n", name);
|
||||||
|
hci_close_dev(dd);
|
||||||
|
}
|
||||||
|
static int sf_ba2str(const bdaddr_t *ba, char *str)
|
||||||
|
{
|
||||||
|
return sprintf(str, "%2.2X%2.2X%2.2X",ba->b[2], ba->b[1], ba->b[0]);
|
||||||
|
}
|
||||||
|
static void cmd_address(int ctl, int hdev, char *ssid)
|
||||||
|
{
|
||||||
|
int dd;
|
||||||
|
|
||||||
|
dd = hci_open_dev(hdev);
|
||||||
|
if (dd < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Can't open device hci%d: %s (%d)\n",
|
||||||
|
hdev, strerror(errno), errno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
hci_read_bd_addr(dd, &di.bdaddr, 1000);
|
||||||
|
|
||||||
|
sf_ba2str(&di.bdaddr, ssid);
|
||||||
|
|
||||||
|
printf("BT Address: %s.\n", ssid);
|
||||||
|
|
||||||
hci_close_dev(dd);
|
hci_close_dev(dd);
|
||||||
}
|
}
|
||||||
|
@ -160,6 +187,8 @@ int hciconfig_open_piscan(void)
|
||||||
|
|
||||||
cmd_up(ctl, hdev);
|
cmd_up(ctl, hdev);
|
||||||
usleep(100*1000);
|
usleep(100*1000);
|
||||||
|
cmd_name(ctl, hdev, g_sf_ble_ssid);
|
||||||
|
usleep(100*1000);
|
||||||
cmd_piscan(ctl, hdev);
|
cmd_piscan(ctl, hdev);
|
||||||
usleep(100*1000);
|
usleep(100*1000);
|
||||||
|
|
||||||
|
@ -173,6 +202,27 @@ int hciconfig_open_piscan(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int hciconfig_set_name(char *name)
|
int hciconfig_set_name(char *name)
|
||||||
|
{
|
||||||
|
snprintf(g_sf_ble_ssid, sizeof(g_sf_ble_ssid), "%s",name);
|
||||||
|
printf("set bluename:%s\n",g_sf_ble_ssid);
|
||||||
|
// int ctl = -1;
|
||||||
|
// int hdev = 0;
|
||||||
|
|
||||||
|
// /* Open HCI socket */
|
||||||
|
// if ((ctl = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI)) < 0)
|
||||||
|
// {
|
||||||
|
// perror("Can't open HCI socket.");
|
||||||
|
// return -1;
|
||||||
|
// }
|
||||||
|
// cmd_up(ctl, hdev);
|
||||||
|
// cmd_name(ctl, hdev, name);
|
||||||
|
// usleep(100*1000);
|
||||||
|
// close(ctl);
|
||||||
|
// printf("set bluename.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int hciconfig_get_address(char *ssid)
|
||||||
{
|
{
|
||||||
int ctl = -1;
|
int ctl = -1;
|
||||||
int hdev = 0;
|
int hdev = 0;
|
||||||
|
@ -184,9 +234,14 @@ int hciconfig_set_name(char *name)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
cmd_up(ctl, hdev);
|
cmd_up(ctl, hdev);
|
||||||
cmd_name(ctl, hdev, name);
|
|
||||||
|
|
||||||
|
if (ioctl(ctl, HCIGETDEVINFO, (void *) &di)) {
|
||||||
|
perror("Can't get device info");
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_address(ctl, hdev, ssid);
|
||||||
|
usleep(100*1000);
|
||||||
close(ctl);
|
close(ctl);
|
||||||
printf("set bluename.\n");
|
printf("get blueaddress.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,166 +18,260 @@
|
||||||
* Description: creat
|
* Description: creat
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "sf_syslib.h"
|
|
||||||
#include "sf_blue_hal.h"
|
#include "sf_blue_hal.h"
|
||||||
#include "sf_blue_app.h"
|
#include "sf_blue_app.h"
|
||||||
#include "sf_sm.h"
|
//#include "sf_sm.h"
|
||||||
|
#include "UIInfo/UIInfo.h"
|
||||||
|
#include <sf_param_common.h>
|
||||||
|
#include "sf_system.h"
|
||||||
|
#include "sf_log.h"
|
||||||
|
#include "sf_commu_mcu_reg.h"
|
||||||
|
#include "sf_systemMng.h"
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <unistd.h> //usleep()
|
||||||
|
|
||||||
#define MSG_BLE_PRE_FIX 0x55AA
|
#define MSG_BLE_PRE_FIX 0x55AA
|
||||||
#define MSG_BLE_END_FIX 0xFFEE
|
#define MSG_BLE_END_FIX 0xFFEE
|
||||||
#define MSG_APP_2_BLE 0
|
#define MSG_APP_2_BLE 0
|
||||||
#define MSG_BLE_2_APP 1
|
#define MSG_BLE_2_APP 1
|
||||||
|
#define SF_HW_TYPE "REVEAL-X3.0"
|
||||||
|
#define SF_WIFI_AP_PWD_LEN 16
|
||||||
|
#define SF_WIFI_AP_SSID_LEN 16
|
||||||
|
|
||||||
static BLE_APP_PACKET_T gst_msgResult = {0};
|
static BLE_APP_PACKET_T gst_msgResult = {0};
|
||||||
static U32 gmsgResultLen = 0;
|
static unsigned int gmsgResultLen = 0;
|
||||||
|
|
||||||
|
static void sf_clear_poweroff_time(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
static void sf_set_cam_mode(char mode)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int sf_set_ble_name(char *name)
|
||||||
|
{
|
||||||
|
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||||
|
snprintf((char *)puiPara->BluSsid, sizeof(puiPara->BluSsid), "%s", (char *)name);
|
||||||
|
MLOGI("BluSsid:%s\n", puiPara->BluSsid);
|
||||||
|
}
|
||||||
|
static UINT32 sf_set_pir_sensitivity(UINT8 pirs)
|
||||||
|
{
|
||||||
|
UINT8 digPirLevel[10] = {200, 38, 30, 24, 18, 16, 10, 9, 8, 7};
|
||||||
|
UINT8 digPirCount[10] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1};
|
||||||
|
|
||||||
|
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||||
|
//UIMenuStoreInfo *puiPara = sf_ui_para_get();
|
||||||
|
if(pirs >= 10)
|
||||||
|
return FAIL;
|
||||||
|
puiPara->PirSensitivity = pirs;
|
||||||
|
puiPara->DigitPirSensitivity = digPirLevel[pirs];
|
||||||
|
puiPara->DigitPirCnt = digPirCount[pirs];
|
||||||
|
puiPara->DigitPirWindowTime = 0;
|
||||||
|
//#if SF_IS_RELEASE == ENABLE
|
||||||
|
if(puiPara->PirSensitivity)
|
||||||
|
{
|
||||||
|
puiPara->TimelapseSwitch = SF_OFF;
|
||||||
|
puiPara->TimelapseTime.Hour = 0;
|
||||||
|
puiPara->TimelapseTime.Min = 0;
|
||||||
|
puiPara->TimelapseTime.Sec = 0;
|
||||||
|
//Save_MenuInfo();
|
||||||
|
}
|
||||||
|
//#endif
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
static void sf_camera_name_check(char* str)
|
||||||
|
{
|
||||||
|
SINT16 i = 0;
|
||||||
|
SINT16 len = 0;
|
||||||
|
|
||||||
|
len = strlen(str);
|
||||||
|
if(len > 4)
|
||||||
|
{
|
||||||
|
str[4] = '\0';
|
||||||
|
len = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
MLOGI("str:%s,len:%d\n", str, len);
|
||||||
|
for(i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
if((str[i] >= 'a') && (str[i] <= 'z'))
|
||||||
|
{
|
||||||
|
str[i] = toupper(str[i]);
|
||||||
|
}
|
||||||
|
else if(((str[i] >= 'A') && (str[i] <= 'Z'))
|
||||||
|
|| ((str[i] >= '1') && (str[i] <= '9'))
|
||||||
|
|| (str[i] == ' '))
|
||||||
|
{
|
||||||
|
//nothing to do
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str[i] = ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
static void *sf_blue_preset_reboot_task(void *arg)
|
static void *sf_blue_preset_reboot_task(void *arg)
|
||||||
{
|
{
|
||||||
sleep(2); //delay
|
//sf_sleep(2); //delay
|
||||||
sf_sys_reboot();
|
sf_power_off_msg_to_cardv();
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sf_blue_command_get_wifi_info(MSG_DEV_BLE_WIFI_Get_Rsp_T *wifiInfo)
|
static void sf_blue_command_get_wifi_info(MSG_DEV_BLE_WIFI_Get_Rsp_T *wifiInfo)
|
||||||
{
|
{
|
||||||
SF_PDT_PARAM_CFG_S* puiPara = sf_get_sifar_param();
|
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||||
|
SLOGI("wifiInfo:%x\n",wifiInfo->cmdRet);
|
||||||
LOGI("wifiInfo:%x\n",wifiInfo->cmdRet);
|
|
||||||
printf("[sf_blue_get_wifi_info],sf_get_sifar_param\n");
|
printf("[sf_blue_get_wifi_info],sf_get_sifar_param\n");
|
||||||
|
|
||||||
wifiInfo->cmdRet = 0;
|
wifiInfo->cmdRet = 0;
|
||||||
|
|
||||||
wifiInfo->SSIDlength = strlen(puiPara->WifiApSSID);
|
wifiInfo->SSIDlength = strlen((const char*)puiPara->strSSID);
|
||||||
strcpy(wifiInfo->SSID, puiPara->WifiApSSID);
|
snprintf((char *)wifiInfo->SSID, sizeof(wifiInfo->SSID), "%s", (char *)puiPara->strSSID);
|
||||||
printf("[sf_blue_get_wifi_info],len:%d, SSID:%s\n", wifiInfo->SSIDlength, puiPara->WifiApSSID);
|
|
||||||
|
|
||||||
wifiInfo->PWDlength = strlen(puiPara->WifiApPWD);
|
SLOGI("len:%d, SSID:%s\n", wifiInfo->SSIDlength, wifiInfo->SSID);
|
||||||
strcpy(wifiInfo->PWD, puiPara->WifiApPWD);
|
|
||||||
printf("[sf_blue_get_wifi_info],len:%d, PWD:%s\n", wifiInfo->PWDlength, puiPara->WifiApPWD);
|
wifiInfo->PWDlength = strlen((const char*)puiPara->WifiApPWD);
|
||||||
|
snprintf((char *)wifiInfo->PWD, sizeof(wifiInfo->PWD), "%s", (char *)puiPara->WifiApPWD);
|
||||||
|
SLOGI("len:%d, PWD:%s\n", wifiInfo->PWDlength, puiPara->WifiApPWD);
|
||||||
|
|
||||||
wifiInfo->suffix = htons(0xFFEE);
|
wifiInfo->suffix = htons(0xFFEE);
|
||||||
printf("[sf_blue_get_wifi_info],End\n");
|
SLOGI("end\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sf_blue_command_get_camera_para(MSG_DEV_BLE_Param_Get_Rsp_T *CamPara)
|
static void sf_blue_command_get_camera_para(MSG_DEV_BLE_Param_Get_Rsp_T *CamPara)
|
||||||
{
|
{
|
||||||
SF_PDT_PARAM_CFG_S* puiPara = sf_get_sifar_param();
|
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||||
|
|
||||||
//printf("[sf_app_Get_Camera_Para],snapnum:%d\n",puiPara->snapnum);
|
//printf("[sf_app_Get_Camera_Para],snapnum:%d\n",puiPara->snapnum);
|
||||||
CamPara->cmdRet = 0;
|
CamPara->cmdRet = 0;
|
||||||
|
|
||||||
CamPara->zoom = puiPara->Zoom;
|
CamPara->zoom = puiPara->Zoom;
|
||||||
|
|
||||||
if(puiPara->CameraMode == 0)
|
CamPara->cameraMode = (puiPara->CamMode==2)?1:0;
|
||||||
{
|
|
||||||
CamPara->cameraMode = 0;
|
|
||||||
}
|
|
||||||
else if (puiPara->CameraMode == 2)
|
|
||||||
{
|
|
||||||
CamPara->cameraMode = 1;
|
|
||||||
}
|
|
||||||
else if (puiPara->CameraMode == 1)
|
|
||||||
{
|
|
||||||
CamPara->cameraMode = 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CamPara->cameraMode = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Camera Mode:%d\n", CamPara->cameraMode);
|
printf("Camera Mode:%d\n", CamPara->cameraMode);
|
||||||
|
|
||||||
//CamPara->cameraMode = puiPara->CameraMode;
|
//CamPara->cameraMode = puiPara->CameraMode;
|
||||||
|
|
||||||
if(puiPara->ImgSize == 3)
|
if(PHOTO_SIZE_16M == puiPara->ImgSize)
|
||||||
{
|
{
|
||||||
CamPara->imageSize = 0;
|
CamPara->imageSize = 0;
|
||||||
}
|
}
|
||||||
else if(puiPara->ImgSize == 4)
|
else if(PHOTO_SIZE_12M == puiPara->ImgSize)
|
||||||
{
|
{
|
||||||
CamPara->imageSize = 1;
|
CamPara->imageSize = 1;
|
||||||
}
|
}
|
||||||
else if(puiPara->ImgSize == 2)
|
else if(PHOTO_SIZE_8M == puiPara->ImgSize)
|
||||||
{
|
{
|
||||||
CamPara->imageSize = 2;
|
CamPara->imageSize = 2;
|
||||||
}
|
}
|
||||||
else
|
/*else if(PHOTO_SIZE_16M == puiPara->ImgSize)
|
||||||
{
|
{
|
||||||
CamPara->imageSize = 2;
|
CamPara->imageSize = 3;
|
||||||
}
|
}
|
||||||
|
else if(PHOTO_SIZE_32M == puiPara->ImgSize)
|
||||||
printf("Image Size:%d\n", CamPara->imageSize);
|
{
|
||||||
|
CamPara->imageSize = 2;
|
||||||
|
}*/
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CamPara->imageSize = 2;
|
||||||
|
}
|
||||||
|
MLOGI("Image Size:%d\n", CamPara->imageSize);
|
||||||
|
|
||||||
//CamPara->imageSize = puiPara->ImgSize;
|
//CamPara->imageSize = puiPara->ImgSize;
|
||||||
|
|
||||||
CamPara->multiShot = puiPara->Multishot-1;
|
CamPara->multiShot = puiPara->Multishot;
|
||||||
CamPara->multiInterval = puiPara->MultishotInterval;
|
CamPara->multiInterval = puiPara->MultiShotIntevel;
|
||||||
CamPara->sendMulti = puiPara->SendMultishot;
|
CamPara->sendMulti = puiPara->SendMulti;
|
||||||
CamPara->PirSensitivity = puiPara->PirSensitivity;
|
CamPara->PirSensitivity = puiPara->PirSensitivity;
|
||||||
|
|
||||||
CamPara->timer = puiPara->TimerFlag[0];
|
CamPara->timer = puiPara->WorkTime1Switch;
|
||||||
CamPara->timerStartHour = puiPara->TimerStartH[0];
|
CamPara->timerStartHour = puiPara->WorkTime[0].StartTime.Hour;
|
||||||
CamPara->timerStartMinute = puiPara->TimerStartM[0];
|
CamPara->timerStartMinute = puiPara->WorkTime[0].StartTime.Min;
|
||||||
CamPara->timerEndHour = puiPara->TimerStopH[0];
|
CamPara->timerEndHour = puiPara->WorkTime[0].StopTime.Hour;
|
||||||
CamPara->timerEndMinute = puiPara->TimerStopM[0];
|
CamPara->timerEndMinute = puiPara->WorkTime[0].StopTime.Min;
|
||||||
printf("timer:%d\n", puiPara->TimerFlag[0]);
|
MLOGI("timer:%d\n", puiPara->WorkTime1Switch);
|
||||||
printf("TimerHstart[0]:%d\n", puiPara->TimerStartH[0]);
|
MLOGI("TimerHstart[0]:%d\n", puiPara->WorkTime[0].StartTime.Hour);
|
||||||
printf("TimerMstart[0]:%d\n", puiPara->TimerStartM[0]);
|
MLOGI("TimerMstart[0]:%d\n", puiPara->WorkTime[0].StartTime.Min);
|
||||||
printf("TimerHstop[0]:%d\n", puiPara->TimerStopH[0]);
|
MLOGI("TimerHstop[0]:%d\n", puiPara->WorkTime[0].StopTime.Hour);
|
||||||
printf("TimerMstop[0]:%d\n", puiPara->TimerStopM[0]);
|
MLOGI("TimerMstop[0]:%d\n", puiPara->WorkTime[0].StopTime.Min);
|
||||||
|
|
||||||
CamPara->maxNum = puiPara->SendMaxNum;
|
CamPara->maxNum = puiPara->SendMaxNum;//MaxNumber
|
||||||
CamPara->delay = puiPara->DelayFlag;
|
CamPara->delay = puiPara->PirDelaySwitch;//DelayFlag
|
||||||
CamPara->delayHour = puiPara->DelayHour;
|
CamPara->delayHour = puiPara->PirDelayTime.Day;
|
||||||
CamPara->delayMinute = puiPara->DelayMinute;
|
CamPara->delayMinute = puiPara->PirDelayTime.Min;
|
||||||
CamPara->delaySecond = puiPara->DelaySecond;
|
CamPara->delaySecond = puiPara->PirDelayTime.Sec;
|
||||||
|
|
||||||
CamPara->SDLoop = puiPara->SdLoop;
|
CamPara->SDLoop = puiPara->SdLoopSwitch;//SDLoop
|
||||||
CamPara->flashPower = puiPara->FlashLed;
|
CamPara->flashPower = puiPara->FlashLed;
|
||||||
CamPara->nightMode = puiPara->ExposureTime;
|
CamPara->nightMode = puiPara->NightMode;//ExposureTime
|
||||||
|
|
||||||
CamPara->sendType = puiPara->SendMode;
|
CamPara->sendType = puiPara->SendType;//
|
||||||
CamPara->sendFirstTimeH = puiPara->BatchTimeHour[0];
|
CamPara->sendFirstTimeH = puiPara->TimeSend1.Hour;//
|
||||||
CamPara->sendFirstTimeM = puiPara->BatchTimeMinute[0];
|
CamPara->sendFirstTimeM = puiPara->TimeSend1.Min;//
|
||||||
CamPara->sendSecondTimeH = puiPara->BatchTimeHour[1];
|
CamPara->sendSecondTimeH = puiPara->TimeSend2.Hour;//
|
||||||
CamPara->sendSecondTimeM = puiPara->BatchTimeMinute[1];
|
CamPara->sendSecondTimeM = puiPara->TimeSend2.Min;//
|
||||||
|
|
||||||
CamPara->SMSCtrl = puiPara->GprsMode;
|
CamPara->SMSCtrl = puiPara->GprsMode;
|
||||||
CamPara->videoSize = puiPara->VideoSize;
|
if(MOVIE_SIZE_FRONT_1920x1080P30 == puiPara->VideoSize){
|
||||||
CamPara->videoTime = puiPara->VideoLenth-5;
|
CamPara->videoSize = 0;
|
||||||
|
}
|
||||||
|
else if(MOVIE_SIZE_FRONT_1280x720P30 == puiPara->VideoSize){
|
||||||
|
CamPara->videoSize = 1;
|
||||||
|
}
|
||||||
|
else if(MOVIE_SIZE_FRONT_848x480P30 == puiPara->VideoSize){
|
||||||
|
CamPara->videoSize = 2;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
CamPara->videoSize = 1;
|
||||||
|
}
|
||||||
|
if(15 == puiPara->VideoLenth)
|
||||||
|
{
|
||||||
|
CamPara->videoTime = 10;
|
||||||
|
}
|
||||||
|
else if (10 == puiPara->VideoLenth)
|
||||||
|
{
|
||||||
|
CamPara->videoTime = 5;
|
||||||
|
}
|
||||||
|
|
||||||
CamPara->batType = puiPara->BatteryType;
|
CamPara->batType = puiPara->BatteryType;
|
||||||
|
|
||||||
CamPara->cameraID = puiPara->CameraNameFlag == 0 ? 1:0;
|
CamPara->cameraID = puiPara->CamNameSwitch == SF_CAMID_OFF ? 0:1;
|
||||||
strcpy((char *)CamPara->cameraIDstr, (char *)puiPara->CameraNameStr);
|
strcpy((char *)CamPara->cameraIDstr, (char *)puiPara->CamNameStr);
|
||||||
|
|
||||||
CamPara->dateTimeAuto = puiPara->DateAuto;
|
CamPara->dateTimeAuto = puiPara->DateAuto;
|
||||||
CamPara->timeZone = puiPara->TimeZone;
|
CamPara->timeZone = 0;
|
||||||
|
|
||||||
CamPara->gpsSwitch = puiPara->GpsSwitch;
|
CamPara->gpsSwitch = puiPara->GpsSwitch;
|
||||||
CamPara->gpsSendType = puiPara->GpsSendType;
|
CamPara->gpsSendType = puiPara->GpsNumber;
|
||||||
|
|
||||||
|
|
||||||
CamPara->timelapse = puiPara->TimelapseFlag;
|
CamPara->timelapse = puiPara->TimelapseSwitch;//TimelapseFlag
|
||||||
CamPara->timelapseHour = puiPara->TimelapseHour;
|
CamPara->timelapseHour = puiPara->TimelapseTime.Hour;//TimelapseHour
|
||||||
CamPara->timelapseMin = puiPara->TimelapseMinute;
|
CamPara->timelapseMin = puiPara->TimelapseTime.Min;//TimelapseMinute
|
||||||
CamPara->timelapseSec = puiPara->TimelapseSecond;
|
CamPara->timelapseSec = puiPara->TimelapseTime.Sec;//TimelapseSecond
|
||||||
|
|
||||||
CamPara->picUponDailyReport = puiPara->PicUponDailyReport;
|
CamPara->picUponDailyReport = puiPara->PicUpDailyReport;
|
||||||
|
|
||||||
//!< 蓝牙部分新增内容
|
//!< 蓝牙部分新增内容
|
||||||
CamPara->SSIDlength = strlen(puiPara->WifiApSSID);
|
CamPara->SSIDlength = strlen((const char*)puiPara->strSSID);
|
||||||
strcpy(CamPara->SSID, puiPara->WifiApSSID);
|
snprintf((char *)CamPara->SSID, sizeof(CamPara->SSID), "%s", (char *)puiPara->strSSID);
|
||||||
printf("[sf_blue_get_wifi_info],len:%d, SSID:%s\n", CamPara->SSIDlength, puiPara->WifiApSSID);
|
SLOGI("len:%d, SSID:%s\n", CamPara->SSIDlength, CamPara->SSID);
|
||||||
|
|
||||||
|
CamPara->PWDlength = strlen((const char*)puiPara->WifiApPWD);
|
||||||
|
snprintf((char *)CamPara->PWD, sizeof(CamPara->PWD), "%s", (char *)puiPara->WifiApPWD);
|
||||||
|
SLOGI("len:%d, PWD:%s\n", CamPara->PWDlength, puiPara->WifiApPWD);
|
||||||
|
|
||||||
CamPara->PWDlength = strlen(puiPara->WifiApPWD);
|
|
||||||
strcpy(CamPara->PWD, puiPara->WifiApPWD);
|
|
||||||
printf("[sf_blue_get_wifi_info],len:%d, PWD:%s\n", CamPara->PWDlength, puiPara->WifiApPWD);
|
|
||||||
|
|
||||||
strcpy((char *)CamPara->hwType, SF_HW_TYPE);
|
strcpy((char *)CamPara->hwType, SF_HW_TYPE);
|
||||||
|
|
||||||
CamPara->suffix = htons(MSG_BLE_END_FIX);
|
CamPara->suffix = htons(MSG_BLE_END_FIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U32 *out_len)
|
static signed int sf_blue_command_request_process(U8 *val, unsigned int nval, U8 **out_data, unsigned int *out_len)
|
||||||
{
|
{
|
||||||
SINT8 respFlag = -1; /*0:no response 1:prive response 2:global response 3:reboot*/
|
SINT8 respFlag = -1; /*0:no response 1:prive response 2:global response 3:reboot*/
|
||||||
UINT8 paramSaveFlag = 0;
|
UINT8 paramSaveFlag = 0;
|
||||||
|
@ -185,10 +279,10 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
UINT8 SendingFile = 0;
|
UINT8 SendingFile = 0;
|
||||||
UINT16 tmp = 0;
|
UINT16 tmp = 0;
|
||||||
|
|
||||||
SF_PDT_PARAM_CFG_S* puiPara = sf_get_sifar_param();
|
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||||
BLE_APP_PACKET_T msgParse;
|
BLE_APP_PACKET_T msgParse;
|
||||||
BLE_APP_PACKET_T *pMsgStruct = NULL;
|
BLE_APP_PACKET_T *pMsgStruct = NULL;
|
||||||
|
SF_PARA_TIME_S time;
|
||||||
UINT8 *bufAddr = val;
|
UINT8 *bufAddr = val;
|
||||||
UINT32 offset;
|
UINT32 offset;
|
||||||
UINT16 PreFind=0;
|
UINT16 PreFind=0;
|
||||||
|
@ -238,7 +332,7 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
{
|
{
|
||||||
sf_clear_poweroff_time();/*reset power off count time*/
|
sf_clear_poweroff_time();/*reset power off count time*/
|
||||||
|
|
||||||
LOGI("BLE Req cmd=%x.\n", msgParse.cmd);
|
SLOGI("BLE Req cmd=%x.\n", msgParse.cmd);
|
||||||
switch(msgParse.cmd)
|
switch(msgParse.cmd)
|
||||||
{
|
{
|
||||||
case BLE_GET_CAMERA_CONNECT: //OK
|
case BLE_GET_CAMERA_CONNECT: //OK
|
||||||
|
@ -258,7 +352,7 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
break;
|
break;
|
||||||
case BLE_GET_CAMERA_WIFI_INFO: //o
|
case BLE_GET_CAMERA_WIFI_INFO: //o
|
||||||
{
|
{
|
||||||
LOGI("[BLE_GET_CAMERA_WIFI_INFO],msgParse.msgBuf.rgetWifiInfo:%x\n",msgParse.msgBuf.rgetWifiInfo.cmdRet);
|
SLOGI("[BLE_GET_CAMERA_WIFI_INFO],msgParse.msgBuf.rgetWifiInfo:%x\n",msgParse.msgBuf.rgetWifiInfo.cmdRet);
|
||||||
sf_blue_command_get_wifi_info(&msgParse.msgBuf.rgetWifiInfo);
|
sf_blue_command_get_wifi_info(&msgParse.msgBuf.rgetWifiInfo);
|
||||||
msgParse.msglen = htons(sizeof(MSG_DEV_BLE_WIFI_Get_Rsp_T) + 2*sizeof(UINT16) );
|
msgParse.msglen = htons(sizeof(MSG_DEV_BLE_WIFI_Get_Rsp_T) + 2*sizeof(UINT16) );
|
||||||
respFlag = 1;
|
respFlag = 1;
|
||||||
|
@ -267,7 +361,7 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_GET_CAMERA_PARAM: //o
|
case BLE_GET_CAMERA_PARAM: //o
|
||||||
{
|
{
|
||||||
LOGI("[BLE_GET_CAMERA_PARAM]\n");
|
SLOGI("[BLE_GET_CAMERA_PARAM]\n");
|
||||||
sf_blue_command_get_camera_para(&msgParse.msgBuf.rgetDevParam);
|
sf_blue_command_get_camera_para(&msgParse.msgBuf.rgetDevParam);
|
||||||
/* add the cmd + resp total 2*2 bytes */
|
/* add the cmd + resp total 2*2 bytes */
|
||||||
msgParse.msglen = htons(sizeof(MSG_DEV_BLE_Param_Get_Rsp_T) + 2*sizeof(UINT16) );
|
msgParse.msglen = htons(sizeof(MSG_DEV_BLE_Param_Get_Rsp_T) + 2*sizeof(UINT16) );
|
||||||
|
@ -277,13 +371,13 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_WIFI_PWD: //
|
case BLE_SET_CAMERA_WIFI_PWD: //
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_WIFI_PWD],newpwd:%s\n",pMsgStruct->msgBuf.wifiPwdSet.PWD);
|
SLOGI("[BLE_SET_WIFI_PWD],newpwd:%s\n",pMsgStruct->msgBuf.wifiPwdSet.PWD);
|
||||||
int len = pMsgStruct->msgBuf.wifiPwdSet.PWDlength;
|
int len = pMsgStruct->msgBuf.wifiPwdSet.PWDlength;
|
||||||
if (len >= SF_WIFI_AP_PWD_LEN)
|
if (len >= SF_WIFI_AP_PWD_LEN)
|
||||||
{
|
{
|
||||||
len = SF_WIFI_AP_PWD_LEN - 1;
|
len = SF_WIFI_AP_PWD_LEN - 1;
|
||||||
}
|
}
|
||||||
strcpy(puiPara->WifiApPWD, pMsgStruct->msgBuf.wifiPwdSet.PWD);
|
snprintf((char *)puiPara->WifiApPWD, sizeof(puiPara->WifiApPWD), "%s", (char *)pMsgStruct->msgBuf.wifiPwdSet.PWD);
|
||||||
//snprintf(puiPara->WifiApPWD, len, "%s", pMsgStruct->msgBuf.wifiPwdSet.PWD);
|
//snprintf(puiPara->WifiApPWD, len, "%s", pMsgStruct->msgBuf.wifiPwdSet.PWD);
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
|
@ -291,14 +385,14 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
break;
|
break;
|
||||||
case BLE_SET_CAMERA_WIFI_SSID: //
|
case BLE_SET_CAMERA_WIFI_SSID: //
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_WIFI_SSID],newssid:%s\n",pMsgStruct->msgBuf.wifiSSIDSet.SSID);
|
SLOGI("[BLE_SET_WIFI_SSID],newssid:%s\n",pMsgStruct->msgBuf.wifiSSIDSet.SSID);
|
||||||
|
|
||||||
int len = pMsgStruct->msgBuf.wifiSSIDSet.SSIDlength;
|
int len = pMsgStruct->msgBuf.wifiSSIDSet.SSIDlength;
|
||||||
if (len >= SF_WIFI_AP_SSID_LEN)
|
if (len >= SF_WIFI_AP_SSID_LEN)
|
||||||
{
|
{
|
||||||
len = SF_WIFI_AP_SSID_LEN - 1;
|
len = SF_WIFI_AP_SSID_LEN - 1;
|
||||||
}
|
}
|
||||||
strcpy(puiPara->WifiApSSID, pMsgStruct->msgBuf.wifiSSIDSet.SSID);
|
snprintf((char *)puiPara->strSSID, sizeof(puiPara->strSSID), "%s", (char *)pMsgStruct->msgBuf.wifiSSIDSet.SSID);
|
||||||
//snprintf(puiPara->WifiApSSID, len, "%s", pMsgStruct->msgBuf.wifiSSIDSet.SSID);
|
//snprintf(puiPara->WifiApSSID, len, "%s", pMsgStruct->msgBuf.wifiSSIDSet.SSID);
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
|
@ -307,7 +401,7 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_Zoom: //
|
case BLE_SET_CAMERA_Zoom: //
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_Zoom],Zoom:%d\n",puiPara->Zoom);
|
SLOGI("[BLE_SET_CAMERA_Zoom],Zoom:%d\n",puiPara->Zoom);
|
||||||
puiPara->Zoom = pMsgStruct->msgBuf.deviceZoomSet.zoom;
|
puiPara->Zoom = pMsgStruct->msgBuf.deviceZoomSet.zoom;
|
||||||
puiPara->Zoom = (puiPara->Zoom > 4 ? 1 : puiPara->Zoom);
|
puiPara->Zoom = (puiPara->Zoom > 4 ? 1 : puiPara->Zoom);
|
||||||
|
|
||||||
|
@ -316,7 +410,8 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
//printf("mode = 0x%x, zoom = %d,\n", curMode, puiPara->Zoom);
|
//printf("mode = 0x%x, zoom = %d,\n", curMode, puiPara->Zoom);
|
||||||
//printf(" factor = %d\n", zmFactor[puiPara->Zoom]);
|
//printf(" factor = %d\n", zmFactor[puiPara->Zoom]);
|
||||||
//forbuild sp5kZoomFactorSet(curMode, zmFactor[puiPara.zoom]);
|
//forbuild sp5kZoomFactorSet(curMode, zmFactor[puiPara.zoom]);
|
||||||
sf_set_zoom(puiPara->Zoom);
|
|
||||||
|
//sf_set_zoom(puiPara->Zoom);
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 0;
|
paramSaveFlag = 0;
|
||||||
}
|
}
|
||||||
|
@ -326,7 +421,7 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
{
|
{
|
||||||
U8 saveMode, tmpMode;
|
U8 saveMode, tmpMode;
|
||||||
|
|
||||||
saveMode = sf_get_camera_mode();
|
saveMode = puiPara->CamMode;
|
||||||
if(saveMode == 0)
|
if(saveMode == 0)
|
||||||
{
|
{
|
||||||
saveMode = 0;
|
saveMode = 0;
|
||||||
|
@ -340,7 +435,7 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
saveMode = 1;
|
saveMode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGI("[BLE_SET_CAMERA_CameraMode],cameraMode:%d,savemode:%d\n",pMsgStruct->msgBuf.setCameraMode.cameraMode,saveMode);
|
SLOGI("[BLE_SET_CAMERA_CameraMode],cameraMode:%d,savemode:%d\n",pMsgStruct->msgBuf.setCameraMode.cameraMode,saveMode);
|
||||||
|
|
||||||
if(saveMode != pMsgStruct->msgBuf.setCameraMode.cameraMode)
|
if(saveMode != pMsgStruct->msgBuf.setCameraMode.cameraMode)
|
||||||
{
|
{
|
||||||
|
@ -348,22 +443,22 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
if(tmpMode == 0)
|
if(tmpMode == 0)
|
||||||
{
|
{
|
||||||
puiPara->CameraMode = SF_CAMMODE_PIC;
|
puiPara->CamMode = SF_CAM_MODE_PHOTO;
|
||||||
}
|
}
|
||||||
else if (tmpMode == 1)
|
else if (tmpMode == 1)
|
||||||
{
|
{
|
||||||
puiPara->CameraMode = SF_CAMMODE_PV;
|
puiPara->CamMode = SF_CAM_MODE_PHOTO_VIDEO;
|
||||||
}
|
}
|
||||||
else if (tmpMode == 2)
|
else if (tmpMode == 2)
|
||||||
{
|
{
|
||||||
puiPara->CameraMode = SF_CAMMODE_VIDEO;
|
puiPara->CamMode = SF_CAM_MODE_VIDEO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
puiPara->CameraMode = SF_CAMMODE_PIC;
|
puiPara->CamMode = SF_CAM_MODE_PHOTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
sf_set_cam_mode(puiPara->CameraMode);
|
sf_set_cam_mode(puiPara->CamMode);
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -377,34 +472,36 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
case BLE_SET_CAMERA_ImageSize: //O
|
case BLE_SET_CAMERA_ImageSize: //O
|
||||||
{
|
{
|
||||||
U8 tmpValue;
|
U8 tmpValue;
|
||||||
LOGI("[BLE_SET_CAMERA_ImageSize],ImgSize:%d\n",puiPara->ImgSize);
|
SLOGI("[BLE_SET_CAMERA_ImageSize],ImgSize:%d\n",puiPara->ImgSize);
|
||||||
tmpValue = pMsgStruct->msgBuf.setImageSize.imageSize;
|
tmpValue = pMsgStruct->msgBuf.setImageSize.imageSize;
|
||||||
|
|
||||||
if(tmpValue == 0)
|
if(tmpValue == 0)
|
||||||
{
|
{
|
||||||
puiPara->ImgSize = SF_IMG_SIZE_24M;
|
puiPara->ImgSize = PHOTO_SIZE_16M;
|
||||||
}
|
}
|
||||||
else if(tmpValue == 1)
|
else if(tmpValue == 1)
|
||||||
{
|
{
|
||||||
puiPara->ImgSize = SF_IMG_SIZE_12M;
|
puiPara->ImgSize = PHOTO_SIZE_12M;
|
||||||
}
|
}
|
||||||
else if(tmpValue == 2)
|
else if(tmpValue == 2)
|
||||||
{
|
{
|
||||||
puiPara->ImgSize = SF_IMG_SIZE_8M;
|
puiPara->ImgSize = PHOTO_SIZE_8M;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
else if(tmpValue == 3)
|
else if(tmpValue == 3)
|
||||||
{
|
{
|
||||||
puiPara->ImgSize = SF_IMG_SIZE_16M;
|
puiPara->ImgSize = PHOTO_SIZE_16M;
|
||||||
}
|
}
|
||||||
else if(tmpValue == 2)
|
else if(tmpValue == 2)
|
||||||
{
|
{
|
||||||
puiPara->ImgSize = SF_IMG_SIZE_32M;
|
puiPara->ImgSize = PHOTO_SIZE_32M;
|
||||||
}
|
}*/
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
puiPara->ImgSize = SF_IMG_SIZE_8M;
|
puiPara->ImgSize = PHOTO_SIZE_8M;
|
||||||
}
|
}
|
||||||
sf_set_img_size(puiPara->ImgSize);
|
sf_sys_set_flag(FL_PHOTO_SIZE, puiPara->ImgSize);
|
||||||
|
//sf_set_img_size(puiPara->ImgSize);
|
||||||
|
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
|
@ -413,13 +510,39 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_MultiShot: //O
|
case BLE_SET_CAMERA_MultiShot: //O
|
||||||
{
|
{
|
||||||
LOGI("Multishot:%d\nMultishotInterval:%d\n,SendMultishot:%d\n", pMsgStruct->msgBuf.setMultiShot.multiShot,
|
SLOGI("Multishot:%d\nMultishotInterval:%d\n,SendMultishot:%d\n", pMsgStruct->msgBuf.setMultiShot.multiShot,
|
||||||
pMsgStruct->msgBuf.setMultiShot.multiInterval,
|
pMsgStruct->msgBuf.setMultiShot.multiInterval,
|
||||||
pMsgStruct->msgBuf.setMultiShot.sendMulti);
|
pMsgStruct->msgBuf.setMultiShot.sendMulti);
|
||||||
puiPara->Multishot = pMsgStruct->msgBuf.setMultiShot.multiShot % 3+1;
|
puiPara->Multishot = pMsgStruct->msgBuf.setMultiShot.multiShot % 3+1;
|
||||||
puiPara->MultishotInterval = pMsgStruct->msgBuf.setMultiShot.multiInterval % 3;
|
puiPara->MultiShotIntevel = pMsgStruct->msgBuf.setMultiShot.multiInterval % 3;
|
||||||
puiPara->SendMultishot = pMsgStruct->msgBuf.setMultiShot.sendMulti % 2;
|
puiPara->SendMulti = pMsgStruct->msgBuf.setMultiShot.sendMulti % 2;
|
||||||
sf_set_cam_mode(puiPara->CameraMode);
|
if(puiPara->SendMulti == 0)
|
||||||
|
{
|
||||||
|
puiPara->SendMultishotIndex2 = 0;
|
||||||
|
puiPara->SendMultishotIndex3 = 0;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
if(puiPara->Multishot == 0)
|
||||||
|
{
|
||||||
|
puiPara->SendMultishotIndex2 = 0;
|
||||||
|
puiPara->SendMultishotIndex3 = 0;
|
||||||
|
}
|
||||||
|
else if(puiPara->Multishot == 1)
|
||||||
|
{
|
||||||
|
puiPara->SendMultishotIndex2 = 1;
|
||||||
|
puiPara->SendMultishotIndex3 = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
puiPara->SendMultishotIndex2 = 1;
|
||||||
|
puiPara->SendMultishotIndex3 = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(puiPara->Multishot != sf_sys_get_flag(FL_CONTINUE_SHOT))
|
||||||
|
{
|
||||||
|
sf_sys_set_flag(FL_CONTINUE_SHOT, puiPara->Multishot);
|
||||||
|
}
|
||||||
|
sf_set_cam_mode(puiPara->CamMode);
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -427,18 +550,8 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_PirSensitivity: //O
|
case BLE_SET_CAMERA_PirSensitivity: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_PirSensitivity],DigitPirSensitivity:%d\n",pMsgStruct->msgBuf.setPirSensitivity.PirSensitivity);
|
SLOGI("[BLE_SET_CAMERA_PirSensitivity],DigitPirSensitivity:%d\n",pMsgStruct->msgBuf.setPirSensitivity.PirSensitivity);
|
||||||
|
sf_set_pir_sensitivity(pMsgStruct->msgBuf.setPirSensitivity.PirSensitivity % 10);
|
||||||
puiPara->PirSensitivity = pMsgStruct->msgBuf.setPirSensitivity.PirSensitivity % 10;
|
|
||||||
if(puiPara->PirSensitivity)
|
|
||||||
{
|
|
||||||
puiPara->TimelapseFlag = 0;
|
|
||||||
puiPara->PirSwitch = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
puiPara->PirSwitch = 0;
|
|
||||||
}
|
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -446,17 +559,17 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_Timer: //O
|
case BLE_SET_CAMERA_Timer: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_Timer],timer:%d\n",pMsgStruct->msgBuf.setTimer.timer);
|
SLOGI("[BLE_SET_CAMERA_Timer],timer:%d\n",pMsgStruct->msgBuf.setTimer.timer);
|
||||||
puiPara->TimerFlag[0] = !!pMsgStruct->msgBuf.setTimer.timer;
|
puiPara->WorkTime1Switch = !!pMsgStruct->msgBuf.setTimer.timer;
|
||||||
puiPara->TimerStartH[0] = pMsgStruct->msgBuf.setTimer.timerStartHour % 24;
|
puiPara->WorkTime[0].StartTime.Hour = pMsgStruct->msgBuf.setTimer.timerStartHour % 24;
|
||||||
puiPara->TimerStartM[0] = pMsgStruct->msgBuf.setTimer.timerStartMinute % 60;
|
puiPara->WorkTime[0].StartTime.Min = pMsgStruct->msgBuf.setTimer.timerStartMinute % 60;
|
||||||
puiPara->TimerStopH[0] = pMsgStruct->msgBuf.setTimer.timerEndHour % 24;
|
puiPara->WorkTime[0].StopTime.Hour = pMsgStruct->msgBuf.setTimer.timerEndHour % 24;
|
||||||
puiPara->TimerStopM[0] = pMsgStruct->msgBuf.setTimer.timerEndMinute % 60;
|
puiPara->WorkTime[0].StopTime.Min = pMsgStruct->msgBuf.setTimer.timerEndMinute % 60;
|
||||||
printf("timer:%d\n", puiPara->TimerFlag[0]);
|
printf("timer:%d\n", puiPara->WorkTime1Switch);
|
||||||
printf("TimerHstart[0]:%d\n", puiPara->TimerStartH[0]);
|
printf("TimerHstart[0]:%d\n", puiPara->WorkTime[0].StartTime.Hour);
|
||||||
printf("TimerMstart[0]:%d\n", puiPara->TimerStartM[0]);
|
printf("TimerMstart[0]:%d\n", puiPara->WorkTime[0].StartTime.Min);
|
||||||
printf("TimerHstop[0]:%d\n", puiPara->TimerStopH[0]);
|
printf("TimerHstop[0]:%d\n", puiPara->WorkTime[0].StopTime.Hour);
|
||||||
printf("TimerMstop[0]:%d\n", puiPara->TimerStopM[0]);
|
printf("TimerMstop[0]:%d\n", puiPara->WorkTime[0].StopTime.Min);
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -464,7 +577,7 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_MaxNum: //O
|
case BLE_SET_CAMERA_MaxNum: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_MaxNum],SendMaxNum:%d\n",pMsgStruct->msgBuf.setMaxNum.maxNum);
|
SLOGI("[BLE_SET_CAMERA_MaxNum],SendMaxNum:%d\n",pMsgStruct->msgBuf.setMaxNum.maxNum);
|
||||||
puiPara->SendMaxNum = pMsgStruct->msgBuf.setMaxNum.maxNum % 100;
|
puiPara->SendMaxNum = pMsgStruct->msgBuf.setMaxNum.maxNum % 100;
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
|
@ -473,11 +586,11 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_Delay: //O
|
case BLE_SET_CAMERA_Delay: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_Delay],delay:%d\n",pMsgStruct->msgBuf.setDelay.delay);
|
SLOGI("[BLE_SET_CAMERA_Delay],delay:%d\n",pMsgStruct->msgBuf.setDelay.delay);
|
||||||
puiPara->DelayFlag = !!pMsgStruct->msgBuf.setDelay.delay;
|
puiPara->PirDelaySwitch = !!pMsgStruct->msgBuf.setDelay.delay;
|
||||||
puiPara->DelayHour = pMsgStruct->msgBuf.setDelay.delayHour % 24;
|
puiPara->PirDelayTime.Hour = pMsgStruct->msgBuf.setDelay.delayHour % 24;
|
||||||
puiPara->DelayMinute = pMsgStruct->msgBuf.setDelay.delayMinute % 60;
|
puiPara->PirDelayTime.Min = pMsgStruct->msgBuf.setDelay.delayMinute % 60;
|
||||||
puiPara->DelaySecond = pMsgStruct->msgBuf.setDelay.delaySecond % 60;
|
puiPara->PirDelayTime.Sec = pMsgStruct->msgBuf.setDelay.delaySecond % 60;
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -485,8 +598,8 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_SDLoop: //O
|
case BLE_SET_CAMERA_SDLoop: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_SDLoop],SDLoop:%d\n",pMsgStruct->msgBuf.setSDLoop.SDLoop);
|
SLOGI("[BLE_SET_CAMERA_SDLoop],SDLoop:%d\n",pMsgStruct->msgBuf.setSDLoop.SDLoop);
|
||||||
puiPara->SdLoop = !!pMsgStruct->msgBuf.setSDLoop.SDLoop;
|
puiPara->SdLoopSwitch = !!pMsgStruct->msgBuf.setSDLoop.SDLoop;
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -494,7 +607,7 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_FlashPower: //O
|
case BLE_SET_CAMERA_FlashPower: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_FlashPower],flashPower:%d\n",pMsgStruct->msgBuf.setFlashPower.flashPower);
|
SLOGI("[BLE_SET_CAMERA_FlashPower],flashPower:%d\n",pMsgStruct->msgBuf.setFlashPower.flashPower);
|
||||||
puiPara->FlashLed = !!pMsgStruct->msgBuf.setFlashPower.flashPower;
|
puiPara->FlashLed = !!pMsgStruct->msgBuf.setFlashPower.flashPower;
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
|
@ -503,9 +616,8 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_NightMode: //O
|
case BLE_SET_CAMERA_NightMode: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_NightMode],nightMode:%d\n",pMsgStruct->msgBuf.setNightMode.nightMode);
|
SLOGI("[BLE_SET_CAMERA_NightMode],nightMode:%d\n",pMsgStruct->msgBuf.setNightMode.nightMode);
|
||||||
puiPara->ExposureTime = pMsgStruct->msgBuf.setNightMode.nightMode % 3;
|
puiPara->NightMode = pMsgStruct->msgBuf.setNightMode.nightMode % 3;
|
||||||
sf_set_img_size(puiPara->ImgSize);
|
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -513,12 +625,37 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_SendType: //O
|
case BLE_SET_CAMERA_SendType: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_SendType],sendType:%d\n",pMsgStruct->msgBuf.setSendType.sendType);
|
SLOGI("[BLE_SET_CAMERA_SendType],sendType:%d\n",pMsgStruct->msgBuf.setSendType.sendType);
|
||||||
puiPara->SendMode = pMsgStruct->msgBuf.setSendType.sendType;
|
if(puiPara->GprsMode == 0)
|
||||||
puiPara->BatchTimeHour[0] = pMsgStruct->msgBuf.setSendType.sendFirstTimeH;
|
{
|
||||||
puiPara->BatchTimeMinute[0] = pMsgStruct->msgBuf.setSendType.sendFirstTimeM;
|
puiPara->SendType = pMsgStruct->msgBuf.setSendType.sendType % 3;
|
||||||
puiPara->BatchTimeHour[1] = pMsgStruct->msgBuf.setSendType.sendSecondTimeH;
|
puiPara->TimeSend1.Hour = pMsgStruct->msgBuf.setSendType.sendFirstTimeH % 24;
|
||||||
puiPara->BatchTimeMinute[1] = pMsgStruct->msgBuf.setSendType.sendSecondTimeM;
|
puiPara->TimeSend1.Min = pMsgStruct->msgBuf.setSendType.sendFirstTimeM % 60;
|
||||||
|
puiPara->TimeSend2.Hour = pMsgStruct->msgBuf.setSendType.sendSecondTimeH % 24;
|
||||||
|
puiPara->TimeSend2.Min = pMsgStruct->msgBuf.setSendType.sendSecondTimeM % 60;
|
||||||
|
|
||||||
|
if(puiPara->SendType == 0)
|
||||||
|
{
|
||||||
|
puiPara->TimeSend1Switch = 0;
|
||||||
|
puiPara->TimeSend2Switch = 0;
|
||||||
|
//puiPara->TimeSend3 = 0;
|
||||||
|
//puiPara->TimeSend4 = 0;
|
||||||
|
}
|
||||||
|
else if(puiPara->SendType == 1)
|
||||||
|
{
|
||||||
|
puiPara->TimeSend1Switch = 1;
|
||||||
|
puiPara->TimeSend2Switch = 0;
|
||||||
|
//puiPara->TimeSend3 = 0;
|
||||||
|
//puiPara->TimeSend4 = 0;
|
||||||
|
}
|
||||||
|
else // if(puiPara->SendType == 2)
|
||||||
|
{
|
||||||
|
puiPara->TimeSend1Switch = 1;
|
||||||
|
puiPara->TimeSend2Switch = 1;
|
||||||
|
}
|
||||||
|
MLOGI("SendType:%d TimeSend1Switch:%d %02d:%02d TimeSend2Switch:%d %02d:%02d\n",puiPara->SendType,puiPara->TimeSend1Switch,puiPara->TimeSend1.Hour,puiPara->TimeSend1.Min,puiPara->TimeSend2Switch, puiPara->TimeSend2.Hour,puiPara->TimeSend2.Min);
|
||||||
|
|
||||||
|
}
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -526,12 +663,21 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_SMSCtrl: //O
|
case BLE_SET_CAMERA_SMSCtrl: //O
|
||||||
{
|
{
|
||||||
|
SLOGI("[BLE_SET_CAMERA_SMSCtrl],SMSCtrl:%d\n",pMsgStruct->msgBuf.setSMSCtrl.SMSCtrl);
|
||||||
puiPara->GprsMode = pMsgStruct->msgBuf.setSMSCtrl.SMSCtrl;
|
puiPara->GprsMode = pMsgStruct->msgBuf.setSMSCtrl.SMSCtrl;
|
||||||
LOGI("[BLE_SET_CAMERA_SMSCtrl],SMSCtrl:%d\n",pMsgStruct->msgBuf.setSMSCtrl.SMSCtrl);
|
|
||||||
if(puiPara->GprsMode == 1)
|
if((puiPara->GprsMode == 1) || (puiPara->GprsMode == 2))
|
||||||
{
|
{
|
||||||
puiPara->SendMode = 0;
|
puiPara->SendType = 0;
|
||||||
LOGD("Modify the Send mode to 0\n");
|
puiPara->TimeSend1Switch = 0;
|
||||||
|
puiPara->TimeSend2Switch = 0;
|
||||||
|
if((puiPara->GprsMode == 1) && (puiPara->PirDelaySwitch == SF_OFF))
|
||||||
|
{
|
||||||
|
puiPara->PirDelaySwitch = SF_ON;
|
||||||
|
puiPara->PirDelayTime.Hour = 0;
|
||||||
|
puiPara->PirDelayTime.Min = 0;
|
||||||
|
puiPara->PirDelayTime.Sec = 15;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
|
@ -540,11 +686,22 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_VideoSize://err
|
case BLE_SET_CAMERA_VideoSize://err
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_VideoSize],videoSize:%d\n",pMsgStruct->msgBuf.setVideoSize.videoSize);
|
SLOGI("[BLE_SET_CAMERA_VideoSize],videoSize:%d\n",pMsgStruct->msgBuf.setVideoSize.videoSize);
|
||||||
puiPara->VideoSize = pMsgStruct->msgBuf.setVideoSize.videoSize;
|
puiPara->VideoSize = pMsgStruct->msgBuf.setVideoSize.videoSize % 3;
|
||||||
puiPara->VideoSize = (puiPara->VideoSize > 2 ? 0 : puiPara->VideoSize);
|
if(0 == pMsgStruct->msgBuf.setVideoSize.videoSize % 3){
|
||||||
//forbuild appMediaAttrUpdate(puiPara.VideoSize);
|
puiPara->VideoSize = MOVIE_SIZE_FRONT_1920x1080P30;
|
||||||
sf_set_video_size(puiPara->VideoSize);
|
}else if(1 == pMsgStruct->msgBuf.setVideoSize.videoSize % 3){
|
||||||
|
puiPara->VideoSize = MOVIE_SIZE_FRONT_1280x720P30;
|
||||||
|
}else if(2 == pMsgStruct->msgBuf.setVideoSize.videoSize % 3){
|
||||||
|
puiPara->VideoSize = MOVIE_SIZE_FRONT_848x480P30;
|
||||||
|
}else{
|
||||||
|
puiPara->VideoSize = MOVIE_SIZE_FRONT_1280x720P30;
|
||||||
|
}
|
||||||
|
if(puiPara->VideoSize != sf_sys_get_flag(FL_MOVIE_SIZE))
|
||||||
|
{
|
||||||
|
sf_sys_set_flag(FL_MOVIE_SIZE, puiPara->VideoSize);
|
||||||
|
sf_sys_set_flag(FL_MOVIE_SIZE_MENU, puiPara->VideoSize);
|
||||||
|
}
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -552,8 +709,15 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_VideoTime: //O
|
case BLE_SET_CAMERA_VideoTime: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_VideoTime],videoTime:%d\n",pMsgStruct->msgBuf.setVideoTime.videoTime);
|
SLOGI("[BLE_SET_CAMERA_VideoTime],videoTime:%d\n",pMsgStruct->msgBuf.setVideoTime.videoTime);
|
||||||
puiPara->VideoLenth = pMsgStruct->msgBuf.setVideoTime.videoTime+5;
|
if(10 == pMsgStruct->msgBuf.setVideoTime.videoTime)
|
||||||
|
{
|
||||||
|
puiPara->VideoLenth = 15;
|
||||||
|
}
|
||||||
|
else if (5 == pMsgStruct->msgBuf.setVideoTime.videoTime)
|
||||||
|
{
|
||||||
|
puiPara->VideoLenth = 10;
|
||||||
|
}
|
||||||
//puiPara->VideoLenth = (puiPara->VideoLenth > 55 ? 0 : puiPara->VideoLenth);
|
//puiPara->VideoLenth = (puiPara->VideoLenth > 55 ? 0 : puiPara->VideoLenth);
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
|
@ -562,7 +726,7 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_BatteryType: //O
|
case BLE_SET_CAMERA_BatteryType: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_BatteryType],batType:%d\n",pMsgStruct->msgBuf.setBatType.batType);
|
SLOGI("[BLE_SET_CAMERA_BatteryType],batType:%d\n",pMsgStruct->msgBuf.setBatType.batType);
|
||||||
puiPara->BatteryType = pMsgStruct->msgBuf.setBatType.batType;
|
puiPara->BatteryType = pMsgStruct->msgBuf.setBatType.batType;
|
||||||
puiPara->BatteryType = (puiPara->BatteryType > 3 ? 0 : puiPara->BatteryType);
|
puiPara->BatteryType = (puiPara->BatteryType > 3 ? 0 : puiPara->BatteryType);
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
|
@ -572,17 +736,12 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_CameraID: //O
|
case BLE_SET_CAMERA_CameraID: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_CameraID],cameraID:%d\n",pMsgStruct->msgBuf.setCameraID.cameraID);
|
SLOGI("[BLE_SET_CAMERA_CameraID],cameraID:%d\n",pMsgStruct->msgBuf.setCameraID.cameraID);
|
||||||
puiPara->CameraNameFlag = !pMsgStruct->msgBuf.setCameraID.cameraID;
|
puiPara->CamNameSwitch = pMsgStruct->msgBuf.setCameraID.cameraID == 0 ? SF_CAMID_OFF : SF_CAMID_ON;
|
||||||
strncpy((char *)puiPara->CameraNameStr, (char *)pMsgStruct->msgBuf.setCameraID.cameraIDstr, 4);
|
strncpy(puiPara->CamNameStr, (char *)pMsgStruct->msgBuf.setCameraID.cameraIDstr, 4); //Use SF_STRNCPY to avoid that APP has not send '\0'.
|
||||||
sf_camera_name_check(puiPara->CameraNameStr);
|
sf_camera_name_check(puiPara->CamNameStr);
|
||||||
puiPara->CameraNameStr[4] = '\0';
|
puiPara->CamNameStr[4] = '\0';
|
||||||
|
MLOGI("Camid:%d,str:%s\n", puiPara->CamNameSwitch, puiPara->CamNameStr);
|
||||||
// update the memory for other process.
|
|
||||||
SF_SM_S sf_sm_t;
|
|
||||||
sf_sm_t.CameraNameFlag = puiPara->CameraNameFlag;
|
|
||||||
strcpy(sf_sm_t.CameraNameStr, puiPara->CameraNameStr);
|
|
||||||
sf_sm_wirte(&sf_sm_t);
|
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -590,28 +749,30 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_DateTime: //O
|
case BLE_SET_CAMERA_DateTime: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_DateTime],DateAuto:%d\n",pMsgStruct->msgBuf.setDateTime.dateTimeAuto);
|
SLOGI("[BLE_SET_CAMERA_DateTime],DateAuto:%d\n",pMsgStruct->msgBuf.setDateTime.dateTimeAuto);
|
||||||
puiPara->DateAuto = pMsgStruct->msgBuf.setDateTime.dateTimeAuto;
|
puiPara->DateAuto = !pMsgStruct->msgBuf.setDateTime.dateTimeAuto; //NTPAuto 0: Auto , 1: Manual
|
||||||
puiPara->TimeZone = pMsgStruct->msgBuf.setDateTime.timeZone;
|
//puiPara->NTPZone = pMsgStruct->msgBuf.setDateTime.timeZone % 7;
|
||||||
SF_RTC_t time;
|
time.Year = htons(pMsgStruct->msgBuf.setDateTime.year);
|
||||||
time.year = htons(pMsgStruct->msgBuf.setDateTime.year);
|
time.Mon = pMsgStruct->msgBuf.setDateTime.month % 13;
|
||||||
time.mon = pMsgStruct->msgBuf.setDateTime.month;
|
time.Day = pMsgStruct->msgBuf.setDateTime.day % 32;
|
||||||
time.day = pMsgStruct->msgBuf.setDateTime.day;
|
time.Hour = pMsgStruct->msgBuf.setDateTime.hour % 24;
|
||||||
time.hour = pMsgStruct->msgBuf.setDateTime.hour;
|
time.Min = pMsgStruct->msgBuf.setDateTime.minute % 60;
|
||||||
time.min = pMsgStruct->msgBuf.setDateTime.minute;
|
time.Sec = pMsgStruct->msgBuf.setDateTime.second % 60;
|
||||||
time.sec = pMsgStruct->msgBuf.setDateTime.second;
|
if(puiPara->DateAuto == 1) //1: Manual
|
||||||
//sf_set_rtc_time(&time);
|
{
|
||||||
sf_set_systime(&time);
|
MLOGI("Set RTC %d %d %d %d:%d%d\n", time.Year, time.Mon, time.Day, time.Hour, time.Min, time.Sec);
|
||||||
sf_set_sync_mcutime_flag(1);
|
sf_sys_rtc_time_set(&time);
|
||||||
|
sf_set_mcu_rtc_flag(1);
|
||||||
|
}
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLE_SET_CAMERA_GPS: //o
|
case BLE_SET_CAMERA_GPS: //o
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_GPS],gpsSendType:%d\n",pMsgStruct->msgBuf.setGPS.gpsSendType);
|
SLOGI("[BLE_SET_CAMERA_GPS],gpsSendType:%d\n",pMsgStruct->msgBuf.setGPS.gpsSendType);
|
||||||
puiPara->GpsSwitch = pMsgStruct->msgBuf.setGPS.gpsSwitch;
|
puiPara->GpsSwitch = pMsgStruct->msgBuf.setGPS.gpsSwitch;
|
||||||
puiPara->GpsSendType = pMsgStruct->msgBuf.setGPS.gpsSendType;
|
//puiPara->GpsSendType = pMsgStruct->msgBuf.setGPS.gpsSendType;
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -619,11 +780,15 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_timeLapse: //O
|
case BLE_SET_CAMERA_timeLapse: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_timeLapse],timelapse:%d\n",pMsgStruct->msgBuf.setTimeLapseTime.timelapse);
|
SLOGI("[BLE_SET_CAMERA_timeLapse],timelapse:%d\n",pMsgStruct->msgBuf.setTimeLapseTime.timelapse);
|
||||||
puiPara->TimelapseFlag = pMsgStruct->msgBuf.setTimeLapseTime.timelapse;
|
puiPara->TimelapseSwitch = pMsgStruct->msgBuf.setTimeLapseTime.timelapse % 2;
|
||||||
puiPara->TimelapseHour = pMsgStruct->msgBuf.setTimeLapseTime.timelapseHour;
|
puiPara->TimelapseTime.Hour = pMsgStruct->msgBuf.setTimeLapseTime.timelapseHour % 24;
|
||||||
puiPara->TimelapseMinute = pMsgStruct->msgBuf.setTimeLapseTime.timelapseMin;
|
puiPara->TimelapseTime.Min = pMsgStruct->msgBuf.setTimeLapseTime.timelapseMin % 60;
|
||||||
puiPara->TimelapseSecond = pMsgStruct->msgBuf.setTimeLapseTime.timelapseSec;
|
puiPara->TimelapseTime.Sec = pMsgStruct->msgBuf.setTimeLapseTime.timelapseSec % 60;
|
||||||
|
if(puiPara->TimelapseSwitch)
|
||||||
|
{
|
||||||
|
sf_set_pir_sensitivity(0);
|
||||||
|
}
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -631,8 +796,8 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
|
|
||||||
case BLE_SET_CAMERA_PicUponDailyReport: //O
|
case BLE_SET_CAMERA_PicUponDailyReport: //O
|
||||||
{
|
{
|
||||||
LOGI("[BLE_SET_CAMERA_PicUponDailyReport],picUponDailyReport:%d\n",pMsgStruct->msgBuf.setDailyReport.picUponDailyReport);
|
SLOGI("[BLE_SET_CAMERA_PicUponDailyReport],picUponDailyReport:%d\n",pMsgStruct->msgBuf.setDailyReport.picUponDailyReport);
|
||||||
puiPara->PicUponDailyReport = pMsgStruct->msgBuf.setDailyReport.picUponDailyReport;
|
puiPara->PicUpDailyReport = pMsgStruct->msgBuf.setDailyReport.picUponDailyReport;
|
||||||
respFlag = 2;
|
respFlag = 2;
|
||||||
paramSaveFlag = 1;
|
paramSaveFlag = 1;
|
||||||
}
|
}
|
||||||
|
@ -658,8 +823,8 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
{
|
{
|
||||||
if(paramSaveFlag)
|
if(paramSaveFlag)
|
||||||
{
|
{
|
||||||
sf_set_param_save_flag();
|
//sf_set_param_save_flag();
|
||||||
sf_param_save_flash();
|
//sf_param_save_flash();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(respFlag == 2)
|
if(respFlag == 2)
|
||||||
|
@ -705,6 +870,7 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
pthread_detach(task_pid);
|
pthread_detach(task_pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
|
@ -718,15 +884,15 @@ static void sf_blue_command_request_process(U8 *val, U32 nval, U8 **out_data, U3
|
||||||
-1, failure
|
-1, failure
|
||||||
Others: N/A
|
Others: N/A
|
||||||
*************************************************/
|
*************************************************/
|
||||||
static int sf_blue_read_callback(U8 **val, S32 *nval)
|
static int sf_blue_read_callback(U8 **val, unsigned int *nval)
|
||||||
{
|
{
|
||||||
if (NULL == val)
|
if (NULL == val)
|
||||||
{
|
{
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
U8 *p = NULL;
|
U8 *p = NULL;
|
||||||
S32 len = gmsgResultLen;
|
unsigned int len = gmsgResultLen;
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
p = (U8 *)malloc(len);
|
p = (U8 *)malloc(len);
|
||||||
|
@ -751,7 +917,7 @@ static int sf_blue_read_callback(U8 **val, S32 *nval)
|
||||||
*nval = len;
|
*nval = len;
|
||||||
|
|
||||||
printf("blue read len:%d.\n", len);
|
printf("blue read len:%d.\n", len);
|
||||||
for (S32 i = 0; i < len; i++)
|
for (unsigned int i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
printf("0x%02x ", p[i]);
|
printf("0x%02x ", p[i]);
|
||||||
if ((i+1)%16 == 0)
|
if ((i+1)%16 == 0)
|
||||||
|
@ -759,6 +925,7 @@ static int sf_blue_read_callback(U8 **val, S32 *nval)
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
|
@ -773,10 +940,10 @@ static int sf_blue_read_callback(U8 **val, S32 *nval)
|
||||||
-1, failure
|
-1, failure
|
||||||
Others: N/A
|
Others: N/A
|
||||||
*************************************************/
|
*************************************************/
|
||||||
static int sf_blue_write_callback(U8 *val, S32 nval, U8 **rval, S32 *rnval)
|
static int sf_blue_write_callback(U8 *val, unsigned int nval, U8 **rval, unsigned int *rnval)
|
||||||
{
|
{
|
||||||
U8 *out = NULL;
|
U8 *out = NULL;
|
||||||
S32 out_len = 0;
|
unsigned int out_len = 0;
|
||||||
|
|
||||||
if (NULL == val)
|
if (NULL == val)
|
||||||
{
|
{
|
||||||
|
@ -784,13 +951,13 @@ static int sf_blue_write_callback(U8 *val, S32 nval, U8 **rval, S32 *rnval)
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("write, nval:%d.\n", nval);
|
printf("write, nval:%d.\n", nval);
|
||||||
for (S32 i = 0; i < nval; i++)
|
for (unsigned int i = 0; i < nval; i++)
|
||||||
printf("%02x ", val[i]);
|
printf("%02x ", val[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (nval < 11)
|
if (nval < 11)
|
||||||
{
|
{
|
||||||
SF_BLUE_LOGE("len err.\n");
|
SLOGE("len err.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,7 +985,7 @@ static int sf_blue_write_callback(U8 *val, S32 nval, U8 **rval, S32 *rnval)
|
||||||
Return: SF_SUCCESS or SF_FAILURE
|
Return: SF_SUCCESS or SF_FAILURE
|
||||||
Others: N/A
|
Others: N/A
|
||||||
*************************************************/
|
*************************************************/
|
||||||
S32 sf_blue_app_start(void)
|
unsigned int sf_blue_app_start(void)
|
||||||
{
|
{
|
||||||
sf_blue_hal_init(sf_blue_read_callback, sf_blue_write_callback);
|
sf_blue_hal_init(sf_blue_read_callback, sf_blue_write_callback);
|
||||||
return SF_SUCCESS;
|
return SF_SUCCESS;
|
||||||
|
@ -832,7 +999,7 @@ S32 sf_blue_app_start(void)
|
||||||
Return: SF_SUCCESS or SF_FAILURE
|
Return: SF_SUCCESS or SF_FAILURE
|
||||||
Others: N/A
|
Others: N/A
|
||||||
*************************************************/
|
*************************************************/
|
||||||
S32 sf_blue_app_stop(void)
|
unsigned int sf_blue_app_stop(void)
|
||||||
{
|
{
|
||||||
return SF_SUCCESS;
|
return SF_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -474,9 +474,9 @@ typedef struct
|
||||||
BLE_APP_MSG_T msgBuf;
|
BLE_APP_MSG_T msgBuf;
|
||||||
} __attribute__((packed)) BLE_APP_PACKET_T;
|
} __attribute__((packed)) BLE_APP_PACKET_T;
|
||||||
|
|
||||||
S32 sf_blue_app_start(void);
|
unsigned int sf_blue_app_start(void);
|
||||||
S32 sf_blue_app_stop(void);
|
unsigned int sf_blue_app_stop(void);
|
||||||
|
int sf_set_ble_name(char *name);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,9 +20,18 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "sf_syslib.h"
|
|
||||||
#include "sf_blue_hal.h"
|
#include "sf_blue_hal.h"
|
||||||
|
#include "UIInfo/UIInfo.h"
|
||||||
|
#include <sf_param_common.h>
|
||||||
|
#include "sf_system.h"
|
||||||
|
#include "sf_log.h"
|
||||||
|
#include "sf_commu_mcu_reg.h"
|
||||||
|
#include "sf_systemMng.h"
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include "sf_blue_app.h"
|
||||||
|
|
||||||
|
extern int hciconfig_get_address(char *ssid);
|
||||||
extern int hciconfig_set_name(char *name);
|
extern int hciconfig_set_name(char *name);
|
||||||
extern int hciconfig_open_piscan(void);
|
extern int hciconfig_open_piscan(void);
|
||||||
extern int gatt_service_register(BLE_RD rcb, BLE_WR wcb);
|
extern int gatt_service_register(BLE_RD rcb, BLE_WR wcb);
|
||||||
|
@ -33,6 +42,8 @@ static pthread_t gblue_disconnect_pid;
|
||||||
static BLE_RD gst_ble_rcb = NULL;
|
static BLE_RD gst_ble_rcb = NULL;
|
||||||
static BLE_WR gst_ble_wcb = NULL;
|
static BLE_WR gst_ble_wcb = NULL;
|
||||||
|
|
||||||
|
static char g_ble_ssid[14] = {0};
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
Function: sf_bluetooth_disconnect_task
|
Function: sf_bluetooth_disconnect_task
|
||||||
Description: Bluetooth disconnection detection thread
|
Description: Bluetooth disconnection detection thread
|
||||||
|
@ -48,12 +59,13 @@ static void *sf_bluetooth_disconnect_task(void *arg)
|
||||||
if (access("/tmp/blue_disconnect", F_OK) == 0)
|
if (access("/tmp/blue_disconnect", F_OK) == 0)
|
||||||
{
|
{
|
||||||
remove("/tmp/blue_disconnect");
|
remove("/tmp/blue_disconnect");
|
||||||
SF_BLUE_LOGI("reset piscan.\n");
|
SLOGI("reset piscan.\n");
|
||||||
hciconfig_open_piscan();
|
hciconfig_open_piscan();
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(500*1000);
|
usleep(500*1000);
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
|
@ -66,9 +78,39 @@ static void *sf_bluetooth_disconnect_task(void *arg)
|
||||||
*************************************************/
|
*************************************************/
|
||||||
static void sf_bluetooth_power_enable(void)
|
static void sf_bluetooth_power_enable(void)
|
||||||
{
|
{
|
||||||
system("echo 44 > /sys/class/gpio/export");
|
// system("echo 44 > /sys/class/gpio/export");
|
||||||
system("echo out > /sys/class/gpio/gpio44/direction");
|
// system("echo out > /sys/class/gpio/gpio44/direction");
|
||||||
system("echo 1 > /sys/class/gpio/gpio44/value");
|
// system("echo 1 > /sys/class/gpio/gpio44/value");
|
||||||
|
}
|
||||||
|
|
||||||
|
int sf_getb_mac(char *ifName, UINT8 *pbMacAddr)
|
||||||
|
{
|
||||||
|
struct ifreq ifreq;
|
||||||
|
int sock = 0;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
sock = socket(AF_BLUETOOTH, SOCK_STREAM, 0);
|
||||||
|
if(sock < 0)
|
||||||
|
{
|
||||||
|
MLOGE("error sock");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(ifreq.ifr_name, ifName);
|
||||||
|
if(ioctl(sock,SIOCGIFHWADDR,&ifreq) < 0)
|
||||||
|
{
|
||||||
|
MLOGE("error ioctl");
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
pbMacAddr[i]=(unsigned char)ifreq.ifr_hwaddr.sa_data[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
MLOGI("MAC: %02X-%02X-%02X-%02X-%02X-%02X\n", pbMacAddr[0],pbMacAddr[1],pbMacAddr[2],pbMacAddr[3],pbMacAddr[4],pbMacAddr[5]);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
|
@ -89,22 +131,39 @@ static void sf_bluetooth_power_enable(void)
|
||||||
*************************************************/
|
*************************************************/
|
||||||
static void *sf_bluetooth_piscan_task(void *arg)
|
static void *sf_bluetooth_piscan_task(void *arg)
|
||||||
{
|
{
|
||||||
|
UINT8 i = 0;
|
||||||
sf_bluetooth_power_enable();
|
sf_bluetooth_power_enable();
|
||||||
|
|
||||||
system("export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/misc:/customer/rocus/lib");
|
//system("export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/misc:/customer/rocus/lib");
|
||||||
system("adduser messagebus");
|
//system("adduser messagebus");
|
||||||
|
|
||||||
system("/customer/blue/bin/rtk_hciattach -n -s 115200 ttyS2 rtk_h5 &");
|
system("rtk_hciattach -n -s 115200 ttyS1 rtk_h5 &");
|
||||||
sleep(3); //wait to init ok
|
|
||||||
|
|
||||||
char sSSID[128]= {0};
|
|
||||||
UINT8 smac[12]= {0};
|
|
||||||
sf_getb_mac("wlan0", smac);
|
|
||||||
sprintf(sSSID,"X_%02X%02X%02X",smac[3],smac[4],smac[5]);
|
|
||||||
hciconfig_set_name(sSSID);
|
|
||||||
|
|
||||||
system("/customer/blue/bin/dbus-daemon --system");
|
for (i = 0; i < 40; i++) {
|
||||||
system("/customer/blue/bin/bluetoothd -d -n -C &");
|
if (access("/tmp/blue_setup_complete", F_OK) == 0) {
|
||||||
|
printf("blue setup complete\r\n");
|
||||||
|
remove("/tmp/blue_setup_complete");
|
||||||
|
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
usleep(500 * 1000);
|
||||||
|
if(39 == i)
|
||||||
|
{
|
||||||
|
MLOGE("blue setup fall!!\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char ssid[6]= {0};
|
||||||
|
hciconfig_get_address(ssid);
|
||||||
|
snprintf(g_ble_ssid, sizeof(g_ble_ssid), "X-PRO_%s",ssid);
|
||||||
|
hciconfig_set_name(g_ble_ssid);
|
||||||
|
sf_set_ble_name(g_ble_ssid);
|
||||||
|
|
||||||
|
system("dbus-daemon --system");
|
||||||
|
system("bluetoothd -d -n -C &");
|
||||||
|
|
||||||
hciconfig_open_piscan();
|
hciconfig_open_piscan();
|
||||||
gatt_service_register(gst_ble_rcb, gst_ble_wcb);
|
gatt_service_register(gst_ble_rcb, gst_ble_wcb);
|
||||||
|
@ -120,7 +179,7 @@ static void *sf_bluetooth_piscan_task(void *arg)
|
||||||
Return: SF_SUCCESS or SF_FAILURE
|
Return: SF_SUCCESS or SF_FAILURE
|
||||||
Others: N/A
|
Others: N/A
|
||||||
*************************************************/
|
*************************************************/
|
||||||
S32 sf_blue_hal_init(BLE_RD rcb, BLE_WR wcb)
|
unsigned int sf_blue_hal_init(BLE_RD rcb, BLE_WR wcb)
|
||||||
{
|
{
|
||||||
gst_ble_rcb = rcb;
|
gst_ble_rcb = rcb;
|
||||||
gst_ble_wcb = wcb;
|
gst_ble_wcb = wcb;
|
||||||
|
@ -130,6 +189,6 @@ S32 sf_blue_hal_init(BLE_RD rcb, BLE_WR wcb)
|
||||||
|
|
||||||
pthread_create(&gblue_disconnect_pid, NULL, sf_bluetooth_disconnect_task, NULL);
|
pthread_create(&gblue_disconnect_pid, NULL, sf_bluetooth_disconnect_task, NULL);
|
||||||
pthread_detach(gblue_disconnect_pid);
|
pthread_detach(gblue_disconnect_pid);
|
||||||
return SF_SUCCESS;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ extern "C" {
|
||||||
typedef int (*BLE_RD)(unsigned char **, unsigned int *);
|
typedef int (*BLE_RD)(unsigned char **, unsigned int *);
|
||||||
typedef int (*BLE_WR)(unsigned char *, unsigned int, unsigned char **, unsigned int *);
|
typedef int (*BLE_WR)(unsigned char *, unsigned int, unsigned char **, unsigned int *);
|
||||||
|
|
||||||
S32 sf_blue_hal_init(BLE_RD rcb, BLE_WR wcb);
|
unsigned int sf_blue_hal_init(BLE_RD rcb, BLE_WR wcb);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
/* -*- mode: C; c-file-style: "gnu" -*- */
|
||||||
|
/* dbus-arch-deps.h Header with architecture/compiler specific information, installed to libdir
|
||||||
|
*
|
||||||
|
* Copyright (C) 2003 Red Hat, Inc.
|
||||||
|
* SPDX-License-Identifier: AFL-2.0 OR GPL-2.0-or-later
|
||||||
|
*
|
||||||
|
* Licensed under the Academic Free License version 2.0
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
|
||||||
|
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DBUS_ARCH_DEPS_H
|
||||||
|
#define DBUS_ARCH_DEPS_H
|
||||||
|
|
||||||
|
#include <dbus/dbus-macros.h>
|
||||||
|
|
||||||
|
DBUS_BEGIN_DECLS
|
||||||
|
|
||||||
|
/* D-Bus no longer supports platforms with no 64-bit integer type. */
|
||||||
|
#define DBUS_HAVE_INT64 1
|
||||||
|
_DBUS_GNUC_EXTENSION typedef long long dbus_int64_t;
|
||||||
|
_DBUS_GNUC_EXTENSION typedef unsigned long long dbus_uint64_t;
|
||||||
|
#define DBUS_INT64_MODIFIER "ll"
|
||||||
|
|
||||||
|
#define DBUS_INT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION (val##LL))
|
||||||
|
#define DBUS_UINT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION (val##ULL))
|
||||||
|
|
||||||
|
typedef int dbus_int32_t;
|
||||||
|
typedef unsigned int dbus_uint32_t;
|
||||||
|
|
||||||
|
typedef short dbus_int16_t;
|
||||||
|
typedef unsigned short dbus_uint16_t;
|
||||||
|
|
||||||
|
#define DBUS_SIZEOF_VOID_P 4
|
||||||
|
|
||||||
|
/* This is not really arch-dependent, but it's not worth
|
||||||
|
* creating an additional generated header just for this
|
||||||
|
*/
|
||||||
|
#define DBUS_MAJOR_VERSION 1
|
||||||
|
#define DBUS_MINOR_VERSION 15
|
||||||
|
#define DBUS_MICRO_VERSION 6
|
||||||
|
|
||||||
|
#define DBUS_VERSION_STRING "1.15.6"
|
||||||
|
|
||||||
|
#define DBUS_VERSION ((1 << 16) | (15 << 8) | (6))
|
||||||
|
|
||||||
|
DBUS_END_DECLS
|
||||||
|
|
||||||
|
#endif /* DBUS_ARCH_DEPS_H */
|
Binary file not shown.
1
code/lib/external/Makefile
vendored
1
code/lib/external/Makefile
vendored
|
@ -176,6 +176,7 @@ install:
|
||||||
@if [ -x ${INSTALL_DIR}/usr/lib ]; then \
|
@if [ -x ${INSTALL_DIR}/usr/lib ]; then \
|
||||||
cp -arvf ${INSTALL_DIR}/usr/lib/*.* ${LIBRARY_DIR}/output/usr/lib; \
|
cp -arvf ${INSTALL_DIR}/usr/lib/*.* ${LIBRARY_DIR}/output/usr/lib; \
|
||||||
fi
|
fi
|
||||||
|
@cp -darvf $(APP_DIR)/source/sf_app/tools/blue/lib/*.* $(LIBRARY_DIR)/output
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo ">>>>>>>>>>>>>>>>>>> Remove >>>>>>>>>>>>>>>>>>>"
|
@echo ">>>>>>>>>>>>>>>>>>> Remove >>>>>>>>>>>>>>>>>>>"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user