pub enum ProtocolKeepaliveStrategy {
    NoStrategy,
    RepeatPacketStrategy(HardwareWriteCmd),
    RepeatLastPacketStrategy,
    CustomStrategy,
}
Expand description

Strategy for situations where hardware needs to get updates every so often in order to keep things alive. Currently this only applies to iOS backgrounding with bluetooth devices, but since we never know which of our hundreds of supported devices someone might connect, we need context as to which keepalive strategy to use.

When choosing a keepalive strategy for a protocol:

  • All protocols use NoStrategy by default. For many devices, sending trash will break them in very weird ways and we can’t risk that, so we need to know the protocol context.
  • If the protocol already needs its own keepalive (Satisfyer, Mysteryvibe, etc…), use NoStrategy for now. RepeatLastPacketStrategy could be used, but we’d need per-protocol timeouts at that point.
  • If the protocol has a command that essentially does nothing to the actuators, set up RepeatPacketStrategy to use that. This is useful for devices that have info commands (like Lovense), ping commands (like The Handy), sensor commands that aren’t yet subscribed to output notifications, etc…
  • For many devices with only scalar actuators, RepeatLastPacketStrategy should work. You just need to make sure the protocol doesn’t have a packet counter or something else that will trip if the same packet is replayed multiple times.
  • For all other devices, use Custom Strategy. This assumes the protocol will have implemented a method to generate a valid packet.

Variants§

§

NoStrategy

Do nothing. This is for protocols that already require internal keepalives, like satisfyer, mysteryvibe, etc.

§

RepeatPacketStrategy(HardwareWriteCmd)

Repeat a specific packet, such as a ping or a no-op

§

RepeatLastPacketStrategy

Repeat whatever the last packet sent was, and send Stop commands until first packet sent. This will be useful for most devices that purely use scalar commands.

§

CustomStrategy

Call a specific method on the protocol implementation to generate keepalive packets.

Trait Implementations§

source§

impl Debug for ProtocolKeepaliveStrategy

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more