void cc3000_event::hci_unsol_handle_patch_request(uint8_t *event_hdr) { uint8_t *params = (uint8_t *)(event_hdr) + HCI_EVENT_HEADER_SIZE; uint32_t length = 0; uint8_t *patch; switch (*params) { case HCI_EVENT_PATCHES_DRV_REQ: { tDriverPatches func_pointer = (tDriverPatches)_simple_link.get_func_pointer(DRIVER_PATCHES); if (func_pointer) { patch = func_pointer(&length); if (patch) { _hci.patch_send(HCI_EVENT_PATCHES_DRV_REQ, _simple_link.get_transmit_buffer(), patch, length); return; } } // Send 0 length Patches response event _hci.patch_send(HCI_EVENT_PATCHES_DRV_REQ, _simple_link.get_transmit_buffer(), 0, 0); break; } case HCI_EVENT_PATCHES_FW_REQ: { tFWPatches func_pointer = (tFWPatches)_simple_link.get_func_pointer(FW_PATCHES); if (func_pointer) { patch = func_pointer(&length); // Build and send a patch if (patch) { _hci.patch_send(HCI_EVENT_PATCHES_FW_REQ, _simple_link.get_transmit_buffer(), patch, length); return; } } // Send 0 length Patches response event _hci.patch_send(HCI_EVENT_PATCHES_FW_REQ, _simple_link.get_transmit_buffer(), 0, 0); break; } case HCI_EVENT_PATCHES_BOOTLOAD_REQ: { tBootLoaderPatches func_pointer = (tBootLoaderPatches)_simple_link.get_func_pointer(BOOTLOADER_PATCHES); if (func_pointer) { patch = func_pointer(&length); if (patch) { _hci.patch_send(HCI_EVENT_PATCHES_BOOTLOAD_REQ, _simple_link.get_transmit_buffer(), patch, length); return; } } // Send 0 length Patches response event _hci.patch_send(HCI_EVENT_PATCHES_BOOTLOAD_REQ, _simple_link.get_transmit_buffer(), 0, 0); break; } } }
SmartList& for_each( std::function<void (SmartPtr<T>)> func_pointer ) { for( auto&& item : *this ) func_pointer( item ); return *this; }
/** * \brief This function creates a null pointer and then calls it */ uint8_t call_to_null_function(void) { void (*func_pointer)(void); func_pointer = 0; func_pointer(); return 0; }