Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos mbed mbed_fota_fan_control
Fork of mbed_fota_lamp_control by
app.h
00001 /** 00002 * @file app.h 00003 * @brief Application entry point 00004 * Copyright 2015 SEVENCORE Co., Ltd. 00005 * 00006 * @author HyeongJun Kim 00007 * @version 1.0.0 00008 * @date 2015-08-17 00009 */ 00010 #ifndef APP_H 00011 #define APP_H 00012 00013 #include "BleMsgHandler.h" 00014 #include "app_sw_version.h" 00015 #include "diss_task.h" 00016 #include "dialog_fota_config.h" 00017 00018 namespace sevencore_fota{ 00019 00020 /** 00021 **************************************************************************************** 00022 * @addtogroup dialog_fota module 00023 * @brief Application entry point Header. 00024 * 00025 * @{ 00026 **************************************************************************************** 00027 */ 00028 00029 #define KE_IDX_GET(uint16_t) (((uint16_t) >> 8) & 0xFF) 00030 #define KE_BUILD_ID(type, index) ( (uint16_t)(((index) << 8)|(type)) ) 00031 00032 /* 00033 * DISS DEFINITIONS 00034 **************************************************************************************** 00035 */ 00036 /// Manufacturer Name (up to 18 chars) 00037 #define APP_DIS_MANUFACTURER_NAME_STR ("SevenCore") 00038 #define APP_DIS_MANUFACTURER_NAME_STR_LEN (9) 00039 /// Model Number String (up to 18 chars) 00040 #define APP_DIS_MODEL_NB_STR ("SC-Lamp-02") 00041 #define APP_DIS_MODEL_NB_STR_LEN (10) 00042 /// System ID - LSB -> MSB (FIXME) 00043 #define APP_DIS_SERIAL_NB_STR ("123-456") 00044 #define APP_DIS_SERIAL_NB_STR_LEN (7) 00045 /// System ID - LSB -> MSB (FIXME) 00046 #define APP_DIS_SYSTEM_ID ("\x12\x34\x56\xFF\xFE\x9A\xBC\xDE") 00047 #define APP_DIS_SYSTEM_ID_LEN (8) 00048 00049 #define APP_DIS_SW_REV DA14583_REFDES_SW_VERSION 00050 #define APP_DIS_FIRM_REV DA14583_SW_VERSION 00051 #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) 00052 /// Advertising minimum interval 00053 #define APP_ADV_INT_MIN 0x800 00054 /// Advertising maximum interval 00055 #define APP_ADV_INT_MAX 0x800 00056 /// Advertising channel map 00057 #define APP_ADV_CHMAP 0x07 00058 /// Advertising data maximal length 00059 #define APP_ADV_DATA_MAX_SIZE (ADV_DATA_LEN - 3) 00060 /// Scan Response data maximal length 00061 #define APP_SCAN_RESP_DATA_MAX_SIZE (SCAN_RSP_DATA_LEN) 00062 #define APP_DFLT_ADV_DATA "\x09\x03\xF0\x18\xFF\x18\x0A\x18\xF1\x18" 00063 #define APP_DFLT_ADV_DATA_LEN (8+2) 00064 #define APP_SCNRSP_DATA "\x09\xFF\x00\x60\x52\x57\x2D\x42\x4C\x45" 00065 #define APP_SCNRSP_DATA_LENGTH (10) 00066 #define APP_DFLT_DEVICE_NAME ("SC-Lamp-02") 00067 00068 00069 typedef struct 00070 { 00071 unsigned char free; 00072 struct bd_addr adv_addr; 00073 unsigned short conidx; 00074 unsigned short conhdl; 00075 unsigned char idx; 00076 unsigned char rssi; 00077 unsigned char data_len; 00078 unsigned char data[ADV_DATA_LEN + 1]; 00079 00080 } ble_dev; 00081 00082 #define MAX_SCAN_DEVICES 9 00083 00084 enum 00085 { 00086 /// Idle state 00087 APP_IDLE, 00088 /// Scanning state 00089 APP_CONNECTABLE, 00090 /// Connected state 00091 APP_CONNECTED, 00092 /// Number of defined states. 00093 APP_STATE_MAX, 00094 /// Scanning state 00095 APP_SCAN, 00096 }; 00097 00098 struct app_env_tag 00099 { 00100 unsigned char state; 00101 unsigned char num_of_devices; 00102 ble_dev devices[MAX_SCAN_DEVICES]; 00103 }; 00104 00105 extern struct app_env_tag app_env; 00106 00107 /** 00108 **************************************************************************************** 00109 * @brief Send Reset request to GAPM task. 00110 * @param[in] BMH Ble Message Handler class reference 00111 * @return void. 00112 **************************************************************************************** 00113 */ 00114 void app_rst_gap(BleMsgHandler *BMH); 00115 /** 00116 **************************************************************************************** 00117 * @brief Send enable request to DISS profile task. 00118 * @param[in] BMH Ble Message Handler class reference 00119 * @return void. 00120 **************************************************************************************** 00121 */ 00122 void app_diss_db_create(BleMsgHandler* BMH); 00123 /** 00124 **************************************************************************************** 00125 * @brief Send enable request to FOTA profile task. 00126 * @param[in] BMH Ble Message Handler class reference 00127 * @return void. 00128 **************************************************************************************** 00129 */ 00130 void app_fota_server_db_create(BleMsgHandler* BMH); 00131 /** 00132 **************************************************************************************** 00133 * @brief Send enable request to Fan Control profile task. 00134 * @param[in] BMH Ble Message Handler class reference 00135 * @return void. 00136 **************************************************************************************** 00137 */ 00138 void app_fan_control_db_create(BleMsgHandler* BMH); 00139 /** 00140 **************************************************************************************** 00141 * @brief Send enable request to Lamp Control profile task. 00142 * @param[in] BMH Ble Message Handler class reference 00143 * @return void. 00144 **************************************************************************************** 00145 */ 00146 void app_lamp_control_db_create(BleMsgHandler* BMH); 00147 /** 00148 **************************************************************************************** 00149 * @brief Send Start Advertising command to GAPM task. 00150 * @param[in] BMH Ble Message Handler class reference 00151 * @return void. 00152 **************************************************************************************** 00153 */ 00154 void app_adv_start(BleMsgHandler* BMH); 00155 /** 00156 **************************************************************************************** 00157 * @brief Set Bondabe mode. 00158 * @param[in] BMH Ble Message Handler class reference 00159 * @return void. 00160 **************************************************************************************** 00161 */ 00162 void app_set_mode(BleMsgHandler* BMH); 00163 /** 00164 **************************************************************************************** 00165 * @brief Send enable request to DISS profile task. 00166 * @param[in] device Ble device info 00167 * @param[in] BMH Ble Message Handler class reference 00168 * @return void. 00169 **************************************************************************************** 00170 */ 00171 void app_dis_enable(ble_dev *device,BleMsgHandler* BMH); 00172 /** 00173 **************************************************************************************** 00174 * @brief Send enable request to FOTA profile task. 00175 * @param[in] device Ble device info 00176 * @param[in] BMH Ble Message Handler class reference 00177 * @return void. 00178 **************************************************************************************** 00179 */ 00180 void app_fota_server_enable(ble_dev *device,BleMsgHandler* BMH); 00181 /** 00182 **************************************************************************************** 00183 * @brief Send enable request to fan_control profile task. 00184 * @param[in] device Ble device info 00185 * @param[in] BMH Ble Message Handler class reference 00186 * @return void. 00187 **************************************************************************************** 00188 */ 00189 void app_fan_control_enable(ble_dev *device,BleMsgHandler* BMH); 00190 /** 00191 **************************************************************************************** 00192 * @brief Send enable request to Lamp_control profile task. 00193 * @param[in] device Ble device info 00194 * @param[in] BMH Ble Message Handler class reference 00195 * @return void. 00196 **************************************************************************************** 00197 */ 00198 void app_lamp_control_enable(ble_dev *device,BleMsgHandler* BMH); 00199 /** 00200 **************************************************************************************** 00201 * @brief Send connection confirmation. 00202 * param[in] auth Authentication requirements. 00203 * @param[in] device Ble device info 00204 * @param[in] BMH Ble Message Handler class reference 00205 * @return void. 00206 **************************************************************************************** 00207 */ 00208 void app_connect_confirm(uint8_t auth,ble_dev *device,BleMsgHandler* BMH); 00209 /** 00210 **************************************************************************************** 00211 * @brief Send the GAPC_DISCONNECT_IND message to a task. 00212 * @param[in] dst Task id of the destination task. 00213 * @param[in] conhdl The conhdl parameter of the GAPC_DISCONNECT_IND message. 00214 * @param[in] reason The reason parameter of the GAPC_DISCONNECT_IND message. 00215 * @param[in] BMH Ble Message Handler class reference 00216 * @return void. 00217 **************************************************************************************** 00218 */ 00219 void app_send_disconnect(uint16_t dst, uint16_t conhdl, uint8_t reason,BleMsgHandler* BMH); 00220 00221 }//namespace 00222 00223 /// @} dialog_fota module 00224 00225 #endif//APP_H
Generated on Tue Jul 12 2022 21:25:05 by
