![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Fan Control Demo
Fork of mbed_fota by
dialog_fota/gapm_task.h
- Committer:
- dudnwjs
- Date:
- 2015-10-13
- Revision:
- 13:e6b38e2ebda2
- Parent:
- 10:18044afe4364
File content as of revision 13:e6b38e2ebda2:
/** * @file gapm_task.h * @brief Generic Access Profile Manager Task Header. * Copyright 2015 SEVENCORE Co., Ltd. * * @author HyeongJun Kim * @version 1.0.0 * @date 2015-08-20 */ #ifndef GAPM_TASK_H #define GAPM_TASK_H #include "dialog_fota_config.h" #include "gap.h" /** **************************************************************************************** * @addtogroup dialog_fota module * @brief Generic Access Profile Manager Task Header. * * @{ **************************************************************************************** */ namespace sevencore_fota{ /// Advertising or scanning report information event struct gapm_adv_report_ind { /// Advertising report structure struct adv_report report; }; /// Reset link layer and the host command struct gapm_reset_cmd { /// GAPM requested operation: /// - GAPM_RESET: Reset BLE subsystem: LL and HL. uint8_t operation; }; /// Command complete event data structure struct gapm_cmp_evt { /// GAP requested operation uint8_t operation; /// Status of the request uint8_t status; }; /// Air operation default parameters struct gapm_air_operation { /// Operation code. uint8_t code; /** Own BD address source of the device: * - GAPM_PUBLIC_ADDR: Public Address * - GAPM_PROVIDED_RND_ADDR: Provided random address * - GAPM_GEN_STATIC_RND_ADDR: Generated static random address * - GAPM_GEN_RSLV_ADDR: Generated resolvable private random address * - GAPM_GEN_NON_RSLV_ADDR: Generated non-resolvable private random address * - GAPM_PROVIDED_RECON_ADDR: Provided Reconnection address (only for GAPM_ADV_DIRECT) */ uint8_t addr_src; /// Dummy data use to retrieve internal operation state (should be set to 0). uint16_t state; /// Duration of resolvable address before regenerate it. uint16_t renew_dur; /// Provided own static private random address (addr_src = 1 or 5) struct bd_addr addr; }; /// Advertising data that contains information set by host. struct gapm_adv_host { /// Advertising mode : /// - GAP_NON_DISCOVERABLE: Non discoverable mode /// - GAP_GEN_DISCOVERABLE: General discoverable mode /// - GAP_LIM_DISCOVERABLE: Limited discoverable mode /// - GAP_BROADCASTER_MODE: Broadcaster mode uint8_t mode; /// Advertising filter policy: /// - ADV_ALLOW_SCAN_ANY_CON_ANY: Allow both scan and connection requests from anyone /// - ADV_ALLOW_SCAN_WLST_CON_ANY: Allow both scan req from White List devices only and /// connection req from anyone /// - ADV_ALLOW_SCAN_ANY_CON_WLST: Allow both scan req from anyone and connection req /// from White List devices only /// - ADV_ALLOW_SCAN_WLST_CON_WLST: Allow scan and connection requests from White List /// devices only uint8_t adv_filt_policy; /// Advertising data length - maximum 28 bytes, 3 bytes are reserved to set /// Advertising AD type flags, shall not be set in advertising data uint8_t adv_data_len; /// Advertising data uint8_t adv_data[ADV_DATA_LEN-3]; /// Scan response data length- maximum 31 bytes uint8_t scan_rsp_data_len; /// Scan response data uint8_t scan_rsp_data[SCAN_RSP_DATA_LEN]; }; /// Set advertising mode Command struct gapm_start_advertise_cmd { /// GAPM requested operation: /// - GAPM_ADV_NON_CONN: Start non connectable advertising /// - GAPM_ADV_UNDIRECT: Start undirected connectable advertising /// - GAPM_ADV_DIRECT: Start directed connectable advertising struct gapm_air_operation op; /// Minimum interval for advertising uint16_t intv_min; /// Maximum interval for advertising uint16_t intv_max; ///Advertising channel map uint8_t channel_map; /// Advertising information union gapm_adv_info { /// Host information advertising data (GAPM_ADV_NON_CONN and GAPM_ADV_UNDIRECT) struct gapm_adv_host host; /// Direct address information (GAPM_ADV_DIRECT) /// (used only if reconnection address isn't set or privacy disabled) struct gap_bdaddr direct; } info; }; /// Set device configuration command struct gapm_set_dev_config_cmd { /// GAPM requested operation: /// - GAPM_SET_DEV_CONFIG: Set device configuration uint8_t operation; /// Device Role: Central, Peripheral, Observer or Broadcaster uint8_t role; /// Device IRK used for resolvable random BD address generation (LSB first) struct gap_sec_key irk; /// Device Appearance (0x0000 - Unknown appearance) uint16_t appearance; /// Device Appearance write permission requirements for peer device (@see gapm_write_att_perm) uint8_t appearance_write_perm; /// Device Name write permission requirements for peer device (@see gapm_write_att_perm) uint8_t name_write_perm; /// Maximal MTU uint16_t max_mtu; /// Peripheral only: ***************************************************************** /// Slave preferred Minimum of connection interval uint16_t con_intv_min; /// Slave preferred Maximum of connection interval uint16_t con_intv_max; /// Slave preferred Connection latency uint16_t con_latency; /// Slave preferred Link supervision timeout uint16_t superv_to; /// Privacy settings bit field (0b1 = enabled, 0b0 = disabled) /// - [bit 0]: Privacy Support /// - [bit 1]: Multiple Bond Support (Peripheral only); If enabled, privacy flag is /// read only. /// - [bit 2]: Reconnection address visible. uint8_t flags; }; /// GAP Manager Message Interface enum gapm_msg_id { /* Default event */ /// Command Complete event GAPM_CMP_EVT = 13312, /// Event triggered to inform that lower layers are ready GAPM_DEVICE_READY_IND, /* Default commands */ /// Reset link layer and the host command GAPM_RESET_CMD, /// Cancel ongoing operation GAPM_CANCEL_CMD, /* Device Configuration */ /// Set device configuration command GAPM_SET_DEV_CONFIG_CMD, /// Set device name command GAPM_SET_DEV_NAME_CMD, /// Set device channel map GAPM_SET_CHANNEL_MAP_CMD, /* Local device information */ /// Get local device info command GAPM_GET_DEV_INFO_CMD, /// Local device name indication event GAPM_DEV_NAME_IND, /// Local device appearance indication event GAPM_APPEARANCE_IND, /// Local device version indication event GAPM_DEV_VERSION_IND, /// Local device BD Address indication event GAPM_DEV_BDADDR_IND, /* White List */ /// White List Management Command GAPM_WHITE_LIST_MGT_CMD, /// White List Size indication event GAPM_WHITE_LIST_SIZE_IND, /* Air Operations */ /// Set advertising mode Command GAPM_START_ADVERTISE_CMD, /// Set Scan mode Command GAPM_START_SCAN_CMD, /// Advertising or scanning report information event GAPM_ADV_REPORT_IND, /// Set connection initialization Command GAPM_START_CONNECTION_CMD, /// Name of peer device indication GAPM_PEER_NAME_IND, /// Confirm connection to a specific device (Connection Operation in Selective mode) GAPM_CONNECTION_CFM, /* Privacy update events */ /// Privacy flag value has been updated GAPM_UPDATED_PRIVACY_IND, /// Reconnection address has been updated GAPM_UPDATED_RECON_ADDR_IND, /* Security / Encryption Toolbox */ /// Resolve address command GAPM_RESOLV_ADDR_CMD, /// Indicate that resolvable random address has been solved GAPM_ADDR_SOLVED_IND, /// Generate a random address. GAPM_GEN_RAND_ADDR_CMD, /// Use the AES-128 block in the controller GAPM_USE_ENC_BLOCK_CMD, /// AES-128 block result indication GAPM_USE_ENC_BLOCK_IND, /// Generate a 8-byte random number GAPM_GEN_RAND_NB_CMD, /// Random Number Indication GAPM_GEN_RAND_NB_IND, /* Debug */ /// Indication containing information about memory usage. GAPM_DBG_MEM_INFO_IND, /* Local device information -cont */ /// Advertising channel Tx power level GAPM_DEV_ADV_TX_POWER_IND, /* Internal messages for timer events, not part of API*/ /// Limited discoverable timeout indication GAPM_LIM_DISC_TO_IND, /// Scan timeout indication GAPM_SCAN_TO_IND, /// Address renewal timeout indication GAPM_ADDR_RENEW_TO_IND, }; /// GAP Manager operation type - application interface enum gapm_operation { /* No Operation (if nothing has been requested) */ /* ************************************************ */ /// No operation. GAPM_NO_OP = 0x00, /* Default operations */ /* ************************************************ */ /// Reset BLE subsystem: LL and HL. GAPM_RESET, /// Cancel currently executed operation. GAPM_CANCEL, /* Configuration operations */ /* ************************************************ */ /// Set device configuration GAPM_SET_DEV_CONFIG, /// Set device name GAPM_SET_DEV_NAME, /// Set device channel map GAPM_SET_CHANNEL_MAP, /* Retrieve device information */ /* ************************************************ */ /// Get Local device name GAPM_GET_DEV_NAME, /// Get Local device version GAPM_GET_DEV_VERSION, /// Get Local device BD Address GAPM_GET_DEV_BDADDR, /* Operation on White list */ /* ************************************************ */ /// Get White List Size. GAPM_GET_WLIST_SIZE, /// Add devices in white list. GAPM_ADD_DEV_IN_WLIST, /// Remove devices form white list. GAPM_RMV_DEV_FRM_WLIST, /// Clear all devices from white list. GAPM_CLEAR_WLIST, /* Advertise mode operations */ /* ************************************************ */ /// Start non connectable advertising GAPM_ADV_NON_CONN, /// Start undirected connectable advertising GAPM_ADV_UNDIRECT, /// Start directed connectable advertising GAPM_ADV_DIRECT, /* Scan mode operations */ /* ************************************************ */ /// Start active scan operation GAPM_SCAN_ACTIVE, /// Start passive scan operation GAPM_SCAN_PASSIVE, /* Connection mode operations */ /* ************************************************ */ /// Direct connection operation GAPM_CONNECTION_DIRECT, /// Automatic connection operation GAPM_CONNECTION_AUTO, /// Selective connection operation GAPM_CONNECTION_SELECTIVE, /// Name Request operation (requires to start a direct connection) GAPM_CONNECTION_NAME_REQUEST, /* Security / Encryption Toolbox */ /* ************************************************ */ /// Resolve device address GAPM_RESOLV_ADDR, /// Generate a random address GAPM_GEN_RAND_ADDR, /// Use the controller's AES-128 block GAPM_USE_ENC_BLOCK, /// Generate a 8-byte random number GAPM_GEN_RAND_NB, /* DEBUG */ /* ************************************************ */ /// Get memory usage GAPM_DBG_GET_MEM_INFO, /// Perform a platform reset GAPM_PLF_RESET, /* Retrieve device information - cont */ /* ************************************************ */ /// Get device advertising power level GAPM_GET_DEV_ADV_TX_POWER, /// Last GAPM operation flag GAPM_LAST }; /// Own BD address source of the device enum gapm_own_addr_src { /// Public Address GAPM_PUBLIC_ADDR, /// Provided random address GAPM_PROVIDED_RND_ADDR, /// Provided static random address GAPM_GEN_STATIC_RND_ADDR, /// Generated resolvable private random address GAPM_GEN_RSLV_ADDR, /// Generated non-resolvable private random address GAPM_GEN_NON_RSLV_ADDR, /// Provided Reconnection address GAPM_PROVIDED_RECON_ADDR, }; /// Device Attribute write permission requirement enum gapm_write_att_perm { /// Disable write access GAPM_WRITE_DISABLE = 0, /// Enable write access GAPM_WRITE_ENABLE = 8, /// Write access requires unauthenticated link GAPM_WRITE_UNAUTH = 16, /// Write access requires authenticated link GAPM_WRITE_AUTH = 24, }; }//namespace /// @} dialog_fota module #endif//GAPM_TASK_H