internal static ButtplugFFIDeviceHandle SendCreateDevice(ButtplugFFIClientHandle aHandle, uint aDeviceIndex)
        {
            var builder = new FlatBufferBuilder(128);

            CreateDevice.StartCreateDevice(builder);
            CreateDevice.AddIndex(builder, aDeviceIndex);
            var get_device_msg = CreateDevice.EndCreateDevice(builder);

            builder.Finish(get_device_msg.Value);
            var buf = builder.SizedByteArray();

            return(ButtplugFFICalls.buttplug_create_device(aHandle, buf, buf.Length));
        }
Esempio n. 2
0
        /// <summary>
        /// Event fired when the client receives a Log message. Should only fire if the client has
        /// requested that log messages be sent.
        /// </summary>
        //[CanBeNull]
        //public event EventHandler<LogEventArgs> Log;

        public ButtplugClient(string aClientName)
        {
            Name          = aClientName;
            _clientHandle = ButtplugFFI.SendCreateClient(aClientName, this.SorterCallback);
        }
        internal static Task <ServerMessage> SendClientMessage(ButtplugFFIMessageSorter aSorter, ButtplugFFIClientHandle aHandle, FlatBufferBuilder aBuilder, ClientMessageType aType, int aOffset)
        {
            ClientMessage.StartClientMessage(aBuilder);
            ClientMessage.AddMessageType(aBuilder, aType);
            ClientMessage.AddMessage(aBuilder, aOffset);
            var task = aSorter.PrepareClientMessage(aBuilder);
            var create_client_msg = CreateClient.EndCreateClient(aBuilder);

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

            ButtplugFFICalls.buttplug_parse_client_message(aHandle, buf, buf.Length);
            return(task);
        }
 internal static extern ButtplugFFIDeviceHandle buttplug_create_device(ButtplugFFIClientHandle client_handle, byte[] buf, int buf_length);
 internal static extern void buttplug_parse_client_message(ButtplugFFIClientHandle client_handle, byte[] buf, int buf_length);
        internal static Task <ServerMessage> SendStopScanning(ButtplugFFIMessageSorter aSorter, ButtplugFFIClientHandle aHandle)
        {
            var builder = new FlatBufferBuilder(1024);

            StopScanning.StartStopScanning(builder);
            var msg = StopScanning.EndStopScanning(builder);

            return(SendClientMessage(aSorter, aHandle, builder, ClientMessageType.StopScanning, msg.Value));
        }
        internal static Task <ServerMessage> SendConnectWebsocket(ButtplugFFIMessageSorter aSorter, ButtplugFFIClientHandle aHandle, string aAddress, bool aIgnoreCert)
        {
            var builder = new FlatBufferBuilder(1024);
            var msg     = ConnectWebsocket.CreateConnectWebsocket(builder, builder.CreateString(aAddress), aIgnoreCert);

            return(SendClientMessage(aSorter, aHandle, builder, ClientMessageType.ConnectWebsocket, msg.Value));
        }
        internal static Task <ServerMessage> SendConnectLocal(ButtplugFFIMessageSorter aSorter, ButtplugFFIClientHandle aHandle, string aServerName, uint aMaxPingTime, ushort aDeviceCommManagerTypes)
        {
            var builder = new FlatBufferBuilder(1024);
            var msg     = ConnectLocal.CreateConnectLocal(builder, builder.CreateString(aServerName), aMaxPingTime, aDeviceCommManagerTypes);

            return(SendClientMessage(aSorter, aHandle, builder, ClientMessageType.ConnectLocal, msg.Value));
        }