31 #ifndef HCIEVENTPACKET_H
32 #define HCIEVENTPACKET_H
50 this->command = HCI_EVENT_LE_META;
113 output[
"address"] = address.
toString();
115 output[
"rssi"] =
rssi;
117 Json::Value data_array(Json::arrayValue);
120 for (i = 0; i < data.size();i++){
121 data_array.append(data[i]);
123 output[
"data"] = data_array;
139 for (std::vector<advertising_report*>::iterator it = ad_report_items.begin(); it != ad_report_items.end();it++){
142 ad_report_items.clear();
147 this->subevent_code = HCI_EVENT_LE_ADVERTISING_REPORT;
162 addr.
address[0]=data[offset + 7];
163 addr.
address[1]=data[offset + 6];
164 addr.
address[2]=data[offset + 5];
165 addr.
address[3]=data[offset + 4];
166 addr.
address[4]=data[offset + 3];
167 addr.
address[5]=data[offset + 2];
173 std::vector<uint8_t> data_val;
177 data_val.push_back(data[offset + 9 + j]);
179 report->
data = data_val;
181 this->ad_report_items.push_back(report);
189 Json::Value parameters;
191 event_code[
"code"] = HCI_EVENT_LE_ADVERTISING_REPORT;
198 Json::Value report_list(Json::arrayValue);
200 for (i = 0; i < ad_report_items.size();i++){
201 report_list.append(ad_report_items[i]->
toJson());
203 parameters[
"reports"] = report_list;
204 output[
"parameters"] = parameters;
233 Json::Value parameters;
235 parameters[
"status"] =
status;
238 Json::Value command_opcode;
241 ogf_val[
"code"] =
ogf;
247 ocf_val[
"code"] =
ocf;
251 case HCI_CMD_OGF_LINK_CONTROL_COMMANDS:
257 case HCI_CMD_OGF_LINK_POLICY_COMMANDS:
263 case HCI_CMD_OGF_CONTROLLER_BASEBAND_COMMANDS:
270 case HCI_CMD_OGF_INFORMATIONAL_PARAMETERS:
277 case HCI_CMD_OGF_STATUS_PARAMETERS:
281 case HCI_CMD_OGF_TESTING_COMMANDS:
285 case HCI_CMD_OGF_LE_CONTROLLER_COMMANDS:
292 case HCI_CMD_OGF_VENDOR_SPECIFIC:
298 command_opcode[
"ogf"] = ogf_val;
299 command_opcode[
"ocf"] = ocf_val;
301 parameters[
"command_opcode"] = command_opcode;
302 output[
"parameters"] = parameters;
334 for (std::vector<completed_packet_t*>::iterator it = completed_packet_list.begin(); it != completed_packet_list.end();it++){
337 completed_packet_list.clear();
341 this->
event_code = HCI_EVENT_NUMBER_OF_COMPLETED_PACKET;
359 Json::Value parameters;
363 Json::Value completed_packet_arr(Json::arrayValue);
366 completed_packet_arr.append(completed_packet_list[i]->
toJson());
368 parameters[
"completed_packet_list"] = completed_packet_arr;
370 output[
"parameters"] = parameters;
384 this->
event_code = HCI_EVENT_DISCONNECTION_COMPLETE;
394 Json::Value parameters;
396 parameters[
"status"] =
status;
398 parameters[
"reason"] =
reason;
399 output[
"parameters"] = parameters;
411 this->
event_code = HCI_EVENT_INQUIRY_COMPLETE;
419 Json::Value parameters;
421 parameters[
"status"] =
status;
422 output[
"parameters"] = parameters;
441 this->
event_code = HCI_EVENT_EXTENDED_INQUIRY_RESULT;
455 for (
unsigned int i = 0 ; i< 240;i++){
463 Json::Value parameters;
466 parameters[
"bd_addr"] = bd_addr.
toString();
470 parameters[
"rssi"] =
rssi;
472 Json::Value inquiry_response_array(Json::arrayValue);
473 for (
unsigned int i = 0 ; i< 240;i++){
474 inquiry_response_array.append(extended_inquiry_response[i]);
476 parameters[
"extended_inquiry_response"] = inquiry_response_array;
478 output[
"parameters"] = parameters;
502 this->subevent_code = HCI_EVENT_LE_CONNECTION_COMPLETE;
526 Json::Value parameters;
527 event_code[
"code"] = HCI_EVENT_LE_CONNECTION_COMPLETE;
531 parameters[
"status"] =
status;
534 parameters[
"peer_address"] = peer_address.
toString();
539 output[
"parameters"] = parameters;
545 #endif //HCIEVENTPACKET_H
completed_packet(uint16_t connection_handle, uint16_t num_of_completed_packet)
Definition: hci_event_packet.h:313
std::string toString()
Definition: hci_global.h:144
Definition: hci_event_packet.h:430
const std::map< int, std::string > COMMAND_OCF_LINK_POLICY_STRING_ENUM
Definition: hci_global.h:81
disconnection_complete_event disconnection_complete_event_t
uint8_t status
Definition: hci_event_packet.h:408
command_status command_status_t
std::vector< uint8_t > data
Definition: hci_event_packet.h:104
uint16_t clock_offset
Definition: hci_event_packet.h:436
uint8_t event_type
Definition: hci_event_packet.h:88
uint8_t address[6]
Definition: hci_global.h:138
Json::Value toJsonObj()
toStyledJson convert frame information to beautiful json format
Definition: hci_event_packet.h:416
uint8_t ogf
Definition: hci_event_packet.h:218
extended_inquiry_result_event extended_inquiry_result_event_t
#define EVENT_FRAME_OFFSET
Definition: hci_global.h:41
uint8_t data_length
Definition: hci_event_packet.h:102
Json::Value toJson()
Definition: hci_event_packet.h:318
const std::map< int, std::string > COMMAND_OCF_LINK_CONTROL_STRING_ENUM
Definition: hci_global.h:91
uint16_t connection_handle
Definition: hci_event_packet.h:310
Definition: hci_event_packet.h:86
Definition: hci_event_packet.h:64
uint8_t subevent_code
Definition: hci_event_packet.h:80
disconnection_complete_event(const std::vector< char > &data)
Definition: hci_event_packet.h:383
inquiry_complete_event inquiry_complete_event_t
bt_address bd_addr
Definition: hci_event_packet.h:433
struct le_meta_event le_meta_event_t
uint8_t rssi
Definition: hci_event_packet.h:437
Definition: hci_event_packet.h:212
Definition: hci_event_packet.h:77
number_of_completed_packet_event(const std::vector< char > &data)
Definition: hci_event_packet.h:340
Json::Value toJson()
Definition: hci_event_packet.h:108
uint16_t connection_handle
Definition: hci_event_packet.h:380
Json::Value toJsonObj()
toStyledJson convert frame information to beautiful json format
Definition: hci_event_packet.h:460
const std::map< int, std::string > COMMAND_OCF_LE_STRING_ENUM
Definition: hci_global.h:51
uint8_t ocf
Definition: hci_event_packet.h:219
uint8_t num_hci_packet
Definition: hci_event_packet.h:215
uint8_t parameter_total_length
Definition: IHciEventFrame.h:103
uint8_t event_type
Definition: hci_event_packet.h:66
uint8_t get_ocf(uint8_t msb, uint8_t lsb)
Definition: hci_global.h:157
uint8_t address_type
Definition: hci_event_packet.h:67
uint8_t num_reports
Definition: hci_event_packet.h:81
LE_SUBEVENT_ENUM
Definition: hci_global.h:106
Json::Value toJsonObj()
toStyledJson convert frame information to beautiful json format
Definition: hci_event_packet.h:230
le_meta_advertising_report_event le_meta_advertising_report_event_t
void clear()
Definition: hci_event_packet.h:333
uint8_t number_of_handles
Definition: hci_event_packet.h:330
const std::map< int, std::string > LE_SUBEVENT_STRING_ENUM
Definition: hci_global.h:111
uint8_t rssi
Definition: hci_event_packet.h:71
uint8_t reason
Definition: hci_event_packet.h:381
Json::Value toJsonObj()
toStyledJson convert frame information to beautiful json format
Definition: hci_event_packet.h:391
uint8_t command
Definition: hci_event_packet.h:79
struct completed_packet completed_packet_t
uint8_t length_data
Definition: hci_event_packet.h:69
std::string toJson(bool beautify)
toStyledJson convert frame information to beautiful json format
Definition: IHciEventFrame.h:61
uint8_t address_type
Definition: hci_event_packet.h:94
uint8_t status
Definition: hci_event_packet.h:379
uint8_t rssi
Definition: hci_event_packet.h:106
Json::Value toJsonObj()
toStyledJson convert frame information to beautiful json format
Definition: hci_event_packet.h:356
uint16_t num_of_completed_packet
Definition: hci_event_packet.h:311
Definition: hci_event_packet.h:377
Definition: hci_event_packet.h:406
extended_inquiry_result_event(const std::vector< char > &data)
Definition: hci_event_packet.h:440
uint8_t page_repetition_mode
Definition: hci_event_packet.h:434
uint32_t class_of_device
Definition: hci_event_packet.h:435
const std::map< int, std::string > COMMAND_OCF_CTRL_BSB_STRING_ENUM
Definition: hci_global.h:61
const std::map< int, std::string > COMMAND_OGF_STRING_ENUM
Definition: hci_global.h:121
EVENT_ENUM event_code
Definition: IHciEventFrame.h:100
Definition: hci_event_packet.h:308
command_status(const std::vector< char > &data)
Definition: hci_event_packet.h:221
inquiry_complete_event(const std::vector< char > &data)
Definition: hci_event_packet.h:410
uint8_t get_ogf(uint8_t data)
Definition: hci_global.h:153
Definition: hci_event_packet.h:328
const std::map< int, std::string > COMMAND_OCF_INFORMATIONAL_STRING_ENUM
Definition: hci_global.h:71
IHciEventFrame class Interface defining all a generic HCI Event Frame.
Definition: IHciEventFrame.h:44
Definition: hci_global.h:136
bt_address address
Definition: hci_event_packet.h:99
std::vector< completed_packet_t * > completed_packet_list
Definition: hci_event_packet.h:331
void init(Json::Value &output)
Definition: IHciEventFrame.h:84
le_meta_connection_complete_event le_meta_connection_complete_event_t
number_of_completed_packet_event number_of_completed_packet_event_t
uint8_t num_responses
Definition: hci_event_packet.h:432
std::vector< uint8_t > extended_inquiry_response
Definition: hci_event_packet.h:438
uint8_t status
Definition: hci_event_packet.h:214