![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Fan Control Demo
Fork of mbed_fota by
dialog_fota/app.h
- Committer:
- dudnwjs
- Date:
- 2015-07-13
- Revision:
- 5:e11b23f9aacc
- Parent:
- 4:60be78a172c2
- Child:
- 6:8dd20294b2aa
File content as of revision 5:e11b23f9aacc:
#ifndef APP_H #define APP_H #include "BleMsgHandler.h" #include "app_sw_version.h" #include "diss_task.h" #include "dialog_fota_config.h" namespace sevencore_fota{ #define KE_IDX_GET(uint16_t) (((uint16_t) >> 8) & 0xFF) #define KE_BUILD_ID(type, index) ( (uint16_t)(((index) << 8)|(type)) ) /* * DISS DEFINITIONS **************************************************************************************** */ /// Manufacturer Name (up to 18 chars) #define APP_DIS_MANUFACTURER_NAME_STR ("SevenCore") #define APP_DIS_MANUFACTURER_NAME_STR_LEN (9) /// Model Number String (up to 18 chars) #define APP_DIS_MODEL_NB_STR ("DA14583") #define APP_DIS_MODEL_NB_STR_LEN (7) /// System ID - LSB -> MSB (FIXME) #define APP_DIS_SERIAL_NB_STR ("1234-00-6789") #define APP_DIS_SERIAL_NB_STR_LEN (12) /// System ID - LSB -> MSB (FIXME) #define APP_DIS_SYSTEM_ID ("\x12\x34\x56\xFF\xFE\x9A\xBC\xDE") #define APP_DIS_SYSTEM_ID_LEN (8) #define APP_DIS_SW_REV DA14583_REFDES_SW_VERSION #define APP_DIS_FIRM_REV DA14583_SW_VERSION #define APP_DIS_FEATURES (DIS_MANUFACTURER_NAME_CHAR_SUP | DIS_MODEL_NB_STR_CHAR_SUP | DIS_SYSTEM_ID_CHAR_SUP | DIS_SW_REV_STR_CHAR_SUP | DIS_FIRM_REV_STR_CHAR_SUP | DIS_PNP_ID_CHAR_SUP) /// Advertising minimum interval #define APP_ADV_INT_MIN 0x800 /// Advertising maximum interval #define APP_ADV_INT_MAX 0x800 /// Advertising channel map #define APP_ADV_CHMAP 0x07 /// Advertising data maximal length #define APP_ADV_DATA_MAX_SIZE (ADV_DATA_LEN - 3) /// Scan Response data maximal length #define APP_SCAN_RESP_DATA_MAX_SIZE (SCAN_RSP_DATA_LEN) #define APP_DFLT_ADV_DATA "\x09\x03\x03\x18\x02\x18\x04\x18\xF5\xFE" #define APP_DFLT_ADV_DATA_LEN (8+2) #define APP_SCNRSP_DATA "\x09\xFF\x00\x60\x52\x57\x2D\x42\x4C\x45" #define APP_SCNRSP_DATA_LENGTH (10) #define APP_DFLT_DEVICE_NAME ("DA14583") typedef struct { unsigned char free; struct bd_addr adv_addr; unsigned short conidx; unsigned short conhdl; unsigned char idx; unsigned char rssi; unsigned char data_len; unsigned char data[ADV_DATA_LEN + 1]; } ble_dev; #define MAX_SCAN_DEVICES 9 enum { /// Idle state APP_IDLE, /// Scanning state APP_CONNECTABLE, /// Connected state APP_CONNECTED, /// Number of defined states. APP_STATE_MAX, /// Scanning state APP_SCAN, }; struct app_env_tag { unsigned char state; unsigned char num_of_devices; ble_dev devices[MAX_SCAN_DEVICES]; }; extern struct app_env_tag app_env; void app_rst_gap(BleMsgHandler *BMH); void app_diss_db_create(BleMsgHandler* BMH); void app_fota_server_db_create(BleMsgHandler* BMH); void app_adv_start(BleMsgHandler* BMH); void app_set_mode(BleMsgHandler* BMH); void app_fota_server_enable(ble_dev *device,BleMsgHandler* BMH); void app_dis_enable(ble_dev *device,BleMsgHandler* BMH); void app_connect_confirm(uint8_t auth,ble_dev *device,BleMsgHandler* BMH); void app_send_disconnect(uint16_t dst, uint16_t conhdl, uint8_t reason,BleMsgHandler* BMH); }//namespace #endif//APP_H