Reading and writing state
Channels & subscriptions
Current version · 2.0.0
Inherits the read operations of ReadChannel and adds state writes and clearing. device.haptics() returns a haptics state channel.
StateChannel[T].set()
Write the current state; a haptics channel accepts haptic strength settings.
Type
StateChannel.set(value: T) -> NoneParameters
value: required, of typeT; a haptics channel usesGloveHaptics(also exported asHaptics).
Returns
None.
Details
- Call conditions: The device is connected and the capability is supported.
Errors
- Parameter, rejection or disconnection errors.
Example
device is connected, started, and supports fingertip haptics. Strength is in 0…127. Perform application work before clearing when a hold duration is needed; the complete example includes that duration.
from qnbot_sdk.glove import GloveFinger, Haptics
import time
haptics = device.haptics()
try:
haptics.set(Haptics({GloveFinger.THUMB: 30}))
time.sleep(0.5)
finally:
haptics.clear()Complete example: haptics.py.
See also
StateChannel[T].clear()
Clear the current state; a haptics channel clears its haptic setting.
Type
StateChannel.clear() -> NoneReturns
None.
Details
- Call conditions: The device is connected and the capability is supported.
Errors
- Rejection or disconnection errors.
See also