buttplug icon indicating copy to clipboard operation
buttplug copied to clipboard

RFP - DelayedDeviceMessage message

Open qdot opened this issue 6 years ago • 2 comments

Name of Outgoing Message, if any: DelayedDeviceMessage

Name of Incoming Message, if any: N/A

Message Fields

  • DelayedDeviceMessage
    • Delay - number: Time in milliseconds to delay the message
    • Messages - array of Buttplug Device Messages: Device message(s)

Message Flow

  • DelayedDeviceMessage Sent
    • OkWithIndex returned on successful scheduling of all messages.
    • Error (with code ButtplugMessageError) returned on Error. Possible errors:
      • Delay <= 0
      • Messages array with no messages
      • Messages array with non-ButtplugDeviceMessage messages

Once Delayed Messages are being run:

  • Returns ErrorWithIndex if any message fails, due to wrong message type, device disconnection, etc...
  • Stops execution of all messages on error.
  • Can be cancelled using CancelIndex

Describe message usage scenario

A message that wraps a list of device messages, and adds a delay field (in milliseconds), allowing the wrapped messages to be executed at a later time.

Original bug here

qdot avatar Apr 23 '19 03:04 qdot

As I recall, the original use case was to make it easier to implement "vibrate for N seconds".

I think we also talked about a Repeat message, which would basically allow patterns to sent in a single message when used in conjunction with this Delay command. Would it be cleaner though to add a repeat flag to this Delay message rather than have 2 messages?

blackspherefollower avatar Apr 23 '19 06:04 blackspherefollower

Yup, that's something I was considering while writing this last night, since as you said, I can't really see why you'd want to use one without the other. It'll require renaming this since it'll be more than Delayed, but I'll figure out something. Got some time anyways, this is the milestone after initial input messages ship.

qdot avatar Apr 23 '19 19:04 qdot