File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,14 +56,26 @@ func (a *Advertisement) Configure(options AdvertisementOptions) error {
5656 return errAdvertisementPacketTooBig
5757 }
5858
59+ var typ uint8
60+ switch options .AdvertisementType {
61+ case AdvertisingTypeInd :
62+ typ = C .BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED
63+ case AdvertisingTypeDirectInd :
64+ typ = C .BLE_GAP_ADV_TYPE_CONNECTABLE_NONSCANNABLE_DIRECTED
65+ case AdvertisingTypeScanInd :
66+ typ = C .BLE_GAP_ADV_TYPE_NONCONNECTABLE_SCANNABLE_UNDIRECTED
67+ case AdvertisingTypeNonConnInd :
68+ typ = C .BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED
69+ }
70+
5971 data := C.ble_gap_adv_data_t {}
6072 data .adv_data = C.ble_data_t {
6173 p_data : (* C .uint8_t )(unsafe .Pointer (& a .payload .data [0 ])),
6274 len : C .uint16_t (a .payload .len ),
6375 }
6476 params := C.ble_gap_adv_params_t {
6577 properties : C.ble_gap_adv_properties_t {
66- _type : C . BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED ,
78+ _type : typ ,
6779 },
6880 interval : C .uint32_t (options .Interval ),
6981 }
You can’t perform that action at this time.
0 commit comments