| 737 | } |
| 738 | |
| 739 | static void scanResultEvent(void *the, void *refcon, uint8_t *message, uint16_t messageLength) |
| 740 | { |
| 741 | struct ble_scan_result_evt_param *scan_rst = (struct ble_scan_result_evt_param *)message; |
| 742 | uint8_t buffer[6]; |
| 743 | xsBeginHost(gBLE->the); |
| 744 | xsmcVars(2); |
| 745 | xsVar(0) = xsmcNewObject(); |
| 746 | xsmcSetArrayBuffer(xsVar(1), scan_rst->ble_adv, scan_rst->adv_data_len + scan_rst->scan_rsp_len); |
| 747 | xsmcSet(xsVar(0), xsID_scanResponse, xsVar(1)); |
| 748 | addressToBuffer(&scan_rst->bda, buffer); |
| 749 | xsmcSetArrayBuffer(xsVar(1), buffer, 6); |
| 750 | xsmcSet(xsVar(0), xsID_address, xsVar(1)); |
| 751 | xsmcSetInteger(xsVar(1), scan_rst->ble_addr_type); |
| 752 | xsmcSet(xsVar(0), xsID_addressType, xsVar(1)); |
| 753 | xsmcSetInteger(xsVar(1), scan_rst->rssi); |
| 754 | xsmcSet(xsVar(0), xsID_rssi, xsVar(1)); |
| 755 | xsCall2(gBLE->obj, xsID_callback, xsStringX("onDiscovered"), xsVar(0)); |
| 756 | xsEndHost(gBLE->the); |
| 757 | } |
| 758 | |
| 759 | static void rssiCompleteEvent(void *the, void *refcon, uint8_t *message, uint16_t messageLength) |
| 760 | { |
nothing calls this directly
no test coverage detected