/// <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 <MessageAttributeType, ButtplugMessageAttributes> aAllowedMessages)
 {
     Sorter          = aSorter;
     Handle          = aHandle;
     Index           = aIndex;
     Name            = aName;
     AllowedMessages = aAllowedMessages;
 }
Exemplo n.º 2
0
 internal static extern void buttplug_parse_device_message(ButtplugFFIDeviceHandle client_handle, byte[] buf, int buf_length);
Exemplo n.º 3
0
        internal static Task <ServerMessage> SendVibrateCmd(ButtplugFFIMessageSorter aSorter, ButtplugFFIDeviceHandle aHandle, uint aDeviceindex, Dictionary <uint, double> aSpeeds)
        {
            var builder      = new FlatBufferBuilder(1024);
            var command_list = new List <Offset <VibrateComponent> >();

            foreach (var pair in aSpeeds)
            {
                VibrateComponent.StartVibrateComponent(builder);
                VibrateComponent.AddIndex(builder, pair.Key);
                VibrateComponent.AddSpeed(builder, pair.Value);
                var component = VibrateComponent.EndVibrateComponent(builder);
                command_list.Add(component);
            }
            var param_array = VibrateCmd.CreateSpeedsVector(builder, command_list.ToArray());

            VibrateCmd.StartVibrateCmd(builder);
            VibrateCmd.AddSpeeds(builder, param_array);
            var cmd = VibrateCmd.EndVibrateCmd(builder);

            return(SendDeviceMessage(aSorter, aHandle, aDeviceindex, builder, DeviceMessageType.VibrateCmd, cmd.Value));
        }
Exemplo n.º 4
0
 internal static Task <ServerMessage> SendRotateCmd(ButtplugFFIMessageSorter aSorter, ButtplugFFIDeviceHandle aHandle, uint aDeviceindex, Dictionary <uint, (double, bool)> aRotations)
Exemplo n.º 5
0
        internal static Task <ServerMessage> SendDeviceMessage(ButtplugFFIMessageSorter aSorter, ButtplugFFIDeviceHandle aHandle, uint aDeviceIndex, FlatBufferBuilder aBuilder, DeviceMessageType aType, int aOffset)
        {
            DeviceMessage.StartDeviceMessage(aBuilder);
            DeviceMessage.AddMessageType(aBuilder, aType);
            DeviceMessage.AddMessage(aBuilder, aOffset);
            DeviceMessage.AddDeviceIndex(aBuilder, aDeviceIndex);
            var task       = aSorter.PrepareClientMessage(aBuilder);
            var device_msg = DeviceMessage.EndDeviceMessage(aBuilder);

            aBuilder.Finish(device_msg.Value);
            var buf = aBuilder.SizedByteArray();

            ButtplugFFICalls.buttplug_parse_device_message(aHandle, buf, buf.Length);
            return(task);
        }