int btstack_main(int argc, const char * argv[]){ l2cap_init(); ble_client_init(); ble_client_register_gatt_client_event_packet_handler(handle_gatt_client_event); ble_client_register_hci_packet_handler(handle_hci_event); // turn on! hci_power_control(HCI_POWER_ON); // go! run_loop_execute(); // happy compiler! return 0; }
BleStatus BLEPeripheral::_init() { BleStatus status; int8_t txPower = 127; if (BLE_PERIPH_STATE_NOT_READY != _state) return BLE_STATUS_WRONG_STATE; status = ble_client_init(blePeripheralGapEventHandler, this, blePeripheralGattsEventHandler, this); if (BLE_STATUS_SUCCESS != status) { return status; } status = ble_client_gap_set_enable_config(_device_name, &_local_bda, _appearance, txPower, _min_conn_interval, _max_conn_interval); if (BLE_STATUS_SUCCESS != status) { return status; } _state = BLE_PERIPH_STATE_READY; return BLE_STATUS_SUCCESS; }