don't set inquiry mode - already set by hci init

This commit is contained in:
Matthias Ringwald 2015-04-17 16:00:29 +02:00
parent a760ab3905
commit e2c8f70327

View File

@ -79,7 +79,7 @@ struct device devices[MAX_DEVICES];
int deviceCount = 0; int deviceCount = 0;
enum STATE {INIT, W4_INQUIRY_MODE_COMPLETE, ACTIVE} ; enum STATE {INIT, ACTIVE} ;
enum STATE state = INIT; enum STATE state = INIT;
@ -132,7 +132,7 @@ static void continue_remote_names(){
* *
* @text The Bluetooth logic is implemented as a state machine within the packet * @text The Bluetooth logic is implemented as a state machine within the packet
* handler. In this example, the following states are passed sequentially: * handler. In this example, the following states are passed sequentially:
* INIT, W4_INQUIRY_MODE_COMPLETE, and ACTIVE. * INIT, and ACTIVE.
*/ */
@ -148,24 +148,14 @@ static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
uint8_t event = packet[0]; uint8_t event = packet[0];
switch(state){ switch(state){
/* @text In INIT, the application enables the extended inquiry mode, /* @text In INIT, an inquiry scan is started, and the application transits to
* which includes RSSI values, and transits to W4_INQUIRY_MODE_COMPLETE state. * ACTIVE state.
*/ */
case INIT: case INIT:
if (packet[2] == HCI_STATE_WORKING) { if (packet[2] == HCI_STATE_WORKING) {
hci_send_cmd(&hci_write_inquiry_mode, 0x01); // with RSSI
state = W4_INQUIRY_MODE_COMPLETE;
}
break;
/* @text In W4_INQUIRY_MODE_COMPLETE, after the inquiry mode was set, an inquiry
* scan is started, and the application transits to ACTIVE state.
*/
case W4_INQUIRY_MODE_COMPLETE:
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_inquiry_mode) ) {
start_scan(); start_scan();
state = ACTIVE; state = ACTIVE;
} }
break;
/* @text In ACTIVE, the following events are processed: /* @text In ACTIVE, the following events are processed:
* - Inquiry result event: the list of discovered devices is processed and the * - Inquiry result event: the list of discovered devices is processed and the
* Class of Device (CoD), page scan mode, clock offset, and RSSI are stored in a table. * Class of Device (CoD), page scan mode, clock offset, and RSSI are stored in a table.