/// <summary> /// Initializes a new instance of the <see cref="ButtplugClientDevice"/> class, using /// discrete parameters. /// </summary> /// <param name="aIndex">The device index.</param> /// <param name="aName">The device name.</param> /// <param name="aMessages">The device allowed message list, with corresponding attributes.</param> internal ButtplugClientDevice(ButtplugFFIMessageSorter aSorter, ButtplugFFIDeviceHandle aHandle, uint aIndex, string aName, Dictionary <ServerMessage.Types.MessageAttributeType, ButtplugMessageAttributes> aAllowedMessages) { Sorter = aSorter; Handle = aHandle; Index = aIndex; Name = aName; AllowedMessages = aAllowedMessages; }
/// <summary> /// Initializes a new instance of the <see cref="ButtplugClientDevice"/> class, using /// discrete parameters. /// </summary> /// <param name="aIndex">The device index.</param> /// <param name="aName">The device name.</param> /// <param name="aAllowedMessages">The device allowed message list, with corresponding attributes.</param> internal ButtplugClientDevice(ButtplugFFIMessageSorter aSorter, ButtplugFFIDeviceHandle aHandle, uint aIndex, string aName, Dictionary <ServerMessage.Types.MessageAttributeType, ButtplugMessageAttributes> aAllowedMessages, ButtplugCallback aCallback, IntPtr aCallbackCtx) { _disposeLock = new object(); _disposed = false; _sorter = aSorter; _handle = aHandle; Index = aIndex; Name = aName; AllowedMessages = aAllowedMessages; _sorterCallback = aCallback; _sorterCallbackCtx = aCallbackCtx; }
internal static extern void buttplug_device_protobuf_message(ButtplugFFIDeviceHandle client_handle, byte[] buf, int buf_length, ButtplugCallback callback, IntPtr ctx);
internal static Task <ButtplugFFIServerMessage> SendRotateCmd(ButtplugFFIMessageSorter aSorter, ButtplugFFIDeviceHandle aHandle, uint aDeviceIndex, Dictionary <uint, (double, bool)> aRotations, ButtplugCallback aCallback, IntPtr aCallbackCtx)
internal static Task <ButtplugFFIServerMessage> SendVibrateCmd(ButtplugFFIMessageSorter aSorter, ButtplugFFIDeviceHandle aHandle, uint aDeviceIndex, Dictionary <uint, double> aSpeeds, ButtplugCallback aCallback, IntPtr aCallbackCtx) { var msg = new DeviceMessage(); msg.Message = new DeviceMessage.Types.FFIMessage(); var command_list = new List <DeviceMessage.Types.VibrateComponent>(); foreach (var pair in aSpeeds) { command_list.Add(new DeviceMessage.Types.VibrateComponent { Index = pair.Key, Speed = pair.Value, }); } msg.Index = aDeviceIndex; var vibrate_cmd = new DeviceMessage.Types.VibrateCmd(); vibrate_cmd.Speeds.Add(command_list); msg.Message.VibrateCmd = vibrate_cmd; return(SendDeviceMessage(aSorter, aHandle, msg, aCallback, aCallbackCtx)); }
internal static Task <ButtplugFFIServerMessage> SendDeviceMessage(ButtplugFFIMessageSorter aSorter, ButtplugFFIDeviceHandle aHandle, DeviceMessage aMsg, ButtplugCallback aCallback, IntPtr aCallbackCtx) { var task = aSorter.PrepareDeviceMessage(aMsg); var buf = aMsg.ToByteArray(); ButtplugFFICalls.buttplug_device_protobuf_message(aHandle, buf, buf.Length, aCallback, aCallbackCtx); return(task); }
internal static extern void buttplug_parse_device_message(ButtplugFFIDeviceHandle client_handle, byte[] buf, int buf_length);
internal static Task <ButtplugFFIServerMessage> SendDeviceMessage(ButtplugFFIMessageSorter aSorter, ButtplugFFIDeviceHandle aHandle, DeviceMessage aMsg) { var task = aSorter.PrepareDeviceMessage(aMsg); var buf = aMsg.ToByteArray(); ButtplugFFICalls.buttplug_parse_device_message(aHandle, buf, buf.Length); return(task); }