hci.c (99449554afb8ec6b5b18252e1c00217f2848182b) hci.c (2c12328286d14d1734e7ca25a31bb7428c57bf16)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 4585 unchanged lines hidden (view full) ---

4594 return 0;
4595}
4596
4597/**
4598 * @brief Stop GAP Classic Inquiry
4599 * @returns 0 if ok
4600 */
4601int gap_inquiry_stop(void){
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 4585 unchanged lines hidden (view full) ---

4594 return 0;
4595}
4596
4597/**
4598 * @brief Stop GAP Classic Inquiry
4599 * @returns 0 if ok
4600 */
4601int gap_inquiry_stop(void){
4602 if (hci_stack->inquiry_state >= GAP_INQUIRY_DURATION_MIN || hci_stack->inquiry_state <= GAP_INQUIRY_DURATION_MAX) {
4602 if (hci_stack->inquiry_state >= GAP_INQUIRY_DURATION_MIN && hci_stack->inquiry_state <= GAP_INQUIRY_DURATION_MAX) {
4603 // emit inquiry complete event, before it even started
4604 uint8_t event[] = { GAP_EVENT_INQUIRY_COMPLETE, 1, 0};
4605 hci_emit_event(event, sizeof(event), 1);
4606 return 0;
4607 }
4608 if (hci_stack->inquiry_state != GAP_INQUIRY_STATE_ACTIVE) return ERROR_CODE_COMMAND_DISALLOWED;
4609 hci_stack->inquiry_state = GAP_INQUIRY_STATE_W2_CANCEL;
4610 hci_run();

--- 210 unchanged lines hidden ---
4603 // emit inquiry complete event, before it even started
4604 uint8_t event[] = { GAP_EVENT_INQUIRY_COMPLETE, 1, 0};
4605 hci_emit_event(event, sizeof(event), 1);
4606 return 0;
4607 }
4608 if (hci_stack->inquiry_state != GAP_INQUIRY_STATE_ACTIVE) return ERROR_CODE_COMMAND_DISALLOWED;
4609 hci_stack->inquiry_state = GAP_INQUIRY_STATE_W2_CANCEL;
4610 hci_run();

--- 210 unchanged lines hidden ---