示例#1
0
 /// <summary>
 /// The only action that this method will perform. You can set the status of Dim from 0 to  100
 /// if you have a night light then that will be separately controlled. If you are not using the
 /// Night lamp then you can comment the line if(bNight)...up to else and opening { and the closing }
 /// braces of the else statement.
 /// </summary>
 /// <param name="dim"></param>
 public void ActionDim(int dim)
 {
     if (dim >= 0 && dim <= 100)
     {
         if (bNight)
         {
             SSL.SendMessageToHost(Constants.NIGHT + dim);
             dimmerNightValue = dim;
         }
         else
         {
             SSL.SendMessageToHost(Constants.BRIGHT + dim);
             dimmerValue = dim;
         }
     }
 }
示例#2
0
 /// <summary>
 /// Action messages to be sent to curtain motors. Typically Open, close and Stop
 /// </summary>
 /// <param name="msg">The message to be sent</param>
 public void ActionMessage(string msg)
 {
     if (msg.Contains(Constants.SCREENUP))
     {
         SS.SendMessageToHost(Constants.OPEN);
         CurtainDistance = MaxDistance;
     }
     else
     {
         if (msg.Contains(Constants.SCREENDOWN))
         {
             SS.SendMessageToHost(Constants.CLOSE);
             CurtainDistance = MinDistance;
         }
         else
         {
             SS.SendMessageToHost(Constants.STOP);
         }
     }
 }
示例#3
0
 /// <summary>
 /// Initialise and establish the connection. The socket is the same used by ListenSocketservices class
 /// </summary>
 /// <param name="ip">Unique IP address of each NodeMCU monitoring the PIR status</param>
 /// <param name="socket">ListenSocketservices which is common for all devices</param>
 public void EstablishConnection(string ip, string socket)
 {
     SSI.Initialise(ip, socket);
     //Send a Hello packet so the host can store the address though not required as it is hard coded
     SSI.SendMessageToHost(Constants.HELLO);
 }