Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在向外围设备写入特性时是否有保证的顺序?_Ios_Swift_Bluetooth Lowenergy_Core Bluetooth - Fatal编程技术网

Ios 在向外围设备写入特性时是否有保证的顺序?

Ios 在向外围设备写入特性时是否有保证的顺序?,ios,swift,bluetooth-lowenergy,core-bluetooth,Ios,Swift,Bluetooth Lowenergy,Core Bluetooth,我试图了解,在如何使用CoreBluetooth从iOS设备向连接的外围设备发送BLE数据包方面,是否存在任何顺序 我有两个外设连接到一个iOS设备,并且能够成功写入两个外设上的特征。此特性具有在外围设备上接收高或低信号的效果 我以一种有序的方式打开特征(A然后B),然后以相同的顺序关闭它们 toggleState(peripheral: primary, stateChar: g1StateChar, state: true) toggleState(peripheral: secondary

我试图了解,在如何使用CoreBluetooth从iOS设备向连接的外围设备发送BLE数据包方面,是否存在任何顺序

我有两个外设连接到一个iOS设备,并且能够成功写入两个外设上的特征。此特性具有在外围设备上接收高或低信号的效果

我以一种有序的方式打开特征(A然后B),然后以相同的顺序关闭它们

toggleState(peripheral: primary, stateChar: g1StateChar, state: true)
toggleState(peripheral: secondary, stateChar: g2StateChar, state: true)
sleep(1)
toggleState(peripheral: primary, stateChar: g1StateChar, state: false)
toggleState(peripheral: secondary, stateChar: g2StateChar, state: false)

func toggleState(peripheral: CBPeripheral, stateChar: CBCharacteristic, state: Bool) {

    var devState = "S"

    //S for Stop, A for Active
    if(state){
        devState = "S"
    } else {
        devState = "A"
    }

    let newState = Data(devState.utf8)
    //Transmit new State of System

    peripheral.writeValue(newState, for: stateChar, type: CBCharacteristicWriteType.withResponse)
}
我希望看到的是与A相关的信号变高,然后是与B相关的信号,间隔约7.5ms,因为外围设备编程为使用7.5ms的连接间隔

实际观察到的情况是上述情况的许多倍,但在其他情况下,信号B先变高,然后在22毫秒后变高