Esempio n. 1
0
        /// <summary>
        /// Register to SHF.
        /// </summary>
        private static void OnOpen(object sender, EventArgs e)
        {
            var msg = new ClientRegister()
            {
                Id            = "Hardware",
                Modifications = new List <ClientRegisterModification>(),
                Type          = ClientRegisterType.ClientRegister
            };

            var audioIcon = new Icon
            {
                Data = "🎵",
                Type = IconType.Emoji
            };

            msg.Modifications.AddRange(AudioProvider
                                       .AudioFiles
                                       .Select(file => new ClientRegisterModification
            {
                Description = $"Play {file.Name}",
                Icon        = audioIcon,
                MaxLength   = Convert.ToInt32(file.Duration),
                Name        = file.Id
            })
                                       .ToList());

            msg.Modifications.Add(new ClientRegisterModification
            {
                Description = "Swap left and right mouse clicks",
                Icon        = new Icon
                {
                    Type = IconType.Emoji,
                    Data = "🖱️"
                },
                Name = SwapMouseClicks.MODIFICATION_ID
            });

            Send(msg.ToJson());
        }
Esempio n. 2
0
        /// <summary>
        /// Once the connection to SHF is open, register all modifications and three options.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void OnOpen(object sender, EventArgs e)
        {
            var msg = new ClientRegister()
            {
                Id            = "Empatica",
                Modifications = new List <ClientRegisterModification>(),
                Options       = new List <ClientRegisterOption>(),
                Type          = ClientRegisterType.ClientRegister
            };

            msg.Options.Add(new ClientRegisterOption
            {
                Default     = "",
                Description = "E4 ID",
                Id          = Globals.E4_ID
            });

            msg.Options.Add(new ClientRegisterOption
            {
                Default     = "localhost",
                Description = "Server Address",
                Id          = Globals.E4_SERVER_ADDRESS
            });

            msg.Options.Add(new ClientRegisterOption
            {
                Default     = 12000,
                Description = "Server Port",
                Id          = Globals.E4_SERVER_PORT,
                NumType     = NumType.Int
            });

            msg.Modifications.Add(new ClientRegisterModification
            {
                Description = "Measure heart rate",
                Icon        = new Icon
                {
                    Data = "💓",
                    Type = IconType.Emoji
                },
                Name = Globals.HEART_RATE_ID
            });

            msg.Modifications.Add(new ClientRegisterModification
            {
                Description = "Measure stress level",
                Icon        = new Icon
                {
                    Data = "😓",
                    Type = IconType.Emoji
                },
                Name = Globals.EDA_ID
            });

            msg.Modifications.Add(new ClientRegisterModification
            {
                Description = "Measure body temperature",
                Icon        = new Icon
                {
                    Data = "🌡️",
                    Type = IconType.Emoji
                },
                Name = Globals.TEMPERATURE_ID
            });

            Send(msg.ToJson());
        }