/// <summary>
 /// send the message to discover all the smart objects registered in the middleware
 /// </summary>
 public void retrieveConfigurationSmartToy()
 {
     if (!MagicRoomSmartToyManager_active)
     {
         return;
     }
     command       = new SmartToyCommand();
     command.type  = "getAllDevicesAndConfiguration";
     command.value = "";
     StartCoroutine(sendCommand());
 }
    /// <summary>
    /// send the message to discover if the middleware is actve
    /// </summary>
    public void SendDiscoverySmartToyMessage()
    {
        if (!MagicRoomSmartToyManager_active)
        {
            return;
        }
        command      = new SmartToyCommand();
        command.type = "DiscoveryMessage";
        string listeningaddress = HttpListenerForMagiKRoom.instance.address + ":" + HttpListenerForMagiKRoom.instance.port + "/" + receivigCodeExpression;

        command.value = listeningaddress;
        StartCoroutine(sendCommand());
    }
 /// <summary>
 /// ask the smart toy to provide its state
 /// </summary>
 /// <param name="deviceName">the name of the device to ask</param>
 /// <param name="request">list of components to ask</param>
 public void sendCommandGetStateSmartToy(string deviceName, string request)
 {
     if (!MagicRoomSmartToyManager_active)
     {
         return;
     }
     command            = new SmartToyCommand();
     command.type       = "SmartToyCommand";
     command.command    = "GetState";
     command.namedevice = deviceName;
     command.value      = request;
     Logger.addToLogNewLine(deviceName, "state");
     StartCoroutine(sendCommand());
 }
 /// <summary>
 /// close the stream for the smart object
 /// </summary>
 /// <param name="deviceName"></param>
 public void closeStreamSmartToy(string deviceName)
 {
     if (!MagicRoomSmartToyManager_active)
     {
         return;
     }
     command            = new SmartToyCommand();
     command.type       = "SmartToyCommand";
     command.command    = "CloseStreamRequest";
     command.namedevice = deviceName;
     StartCoroutine(sendCommand());
     Logger.addToLogNewLine("ServerToy", "Close stream UDP for smart object " + deviceName);
     //UDPListenerForMagiKRoom.instance.StopReceiver();
 }
 /// <summary>
 /// open the event channel from the smart toy to the applicain to signal events
 /// </summary>
 /// <param name="deviceName">the name of the deivce who has to to open the stream</param>
 public void openEventChannelSmartToy(string deviceName)
 {
     if (!MagicRoomSmartToyManager_active)
     {
         return;
     }
     command            = new SmartToyCommand();
     command.type       = "SmartToyCommand";
     command.command    = "OpenChannelEvent";
     command.namedevice = deviceName;
     command.value      = HttpListenerForMagiKRoom.instance.address + ":" + HttpListenerForMagiKRoom.instance.port + "/" + receivigCodeExpression;
     Logger.addToLogNewLine("ServerToy", "Open event channel for smart bject " + deviceName);
     StartCoroutine(sendCommand());
 }
 /// <summary>
 /// command t open the streaming udp for the smart object
 /// </summary>
 /// <param name="deviceName">nameof the smart object who has to open the stream</param>
 /// <param name="freq">frequency of the udp stream</param>
 public void openStreamSmartToy(string deviceName, float freq)
 {
     if (!MagicRoomSmartToyManager_active)
     {
         return;
     }
     command            = new SmartToyCommand();
     command.type       = "SmartToyCommand";
     command.command    = "OpenStreamRequest";
     command.namedevice = deviceName;
     command.value      = UDPListenerForMagiKRoom.instance.address + ":" + UDPListenerForMagiKRoom.instance.port + "/" + receivigCodeExpression;
     command.frequency  = freq;
     Logger.addToLogNewLine("ServerToy", "Open stream UDP for smart object " + deviceName + " with frequency " + freq);
     StartCoroutine(sendCommand());
 }