Esempio n. 1
0
 private void OnSvcStatusUpdate(string msgIn)
 {/*
   * Service: Socket closed Normally:  Cancelled
   * Service: Starting Svc TestStream
   * Service: Svc Stream response received: Name=TestStream IsAccepted=True
   * Service: Stream is open.
   * Service: Stream is open. Waiting for msg to send.
   * Service: Sending msg.
   * Service: Sent msg.
   * Service: Svc Received stream data: MSG OUT
   * Service: Closing Svc Socket
   * Service: Socket closed Normally:
   */
     Task.Run(async() => {
         await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             tbSvcStat.Text = msgIn;
             if (msgIn.ToLower().Contains("Starting Svc".ToLower()))
             {
                 SvcState             = deviceStates.listening;
                 SvcIsRunningLED.Fill = Cols[0];
             }
             else if (msgIn.ToLower().Contains("Svc Stream response received".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 SvcIsRunningLED.Fill = Cols[1];
             }
             else if (msgIn.ToLower().Contains("Stream is open".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 DeviceIsRunningLED.Fill = Cols[2];
             }
             else if (msgIn.ToLower().Contains("Sending msg".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 SvcIsRunningLED.Fill = Cols[3];
             }
             else if (msgIn.ToLower().Contains("Sent msg".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 SvcIsRunningLED.Fill = Cols[4];
             }
             else if (msgIn.ToLower().Contains("Svc Received stream data".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 SvcIsRunningLED.Fill = Cols[5];
             }
             else if (msgIn.ToLower().Contains("Closing Svc Socket".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 SvcIsRunningLED.Fill = Cols[6];
             }
             else if (msgIn.ToLower().Contains("Socket closed Normally".ToLower()))
             {
                 DeviceState          = deviceStates.stopped;
                 SvcIsRunningLED.Fill = Cols[Cols.Count() - 1];
             }
         });
     });
 }
 private void OnDeviceStatusUpdate(string msgIn)
 {
     Task.Run(async() => {
         await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
         {
             /*
              * Device: Starting Device Stream Request. GREEN
              * Device: Device got a connection. AQUA
              * Device: Device got stream: Name=TestStream. Socket open. BLUE
              * Device: Device is connected and listening PURPLE
              * Device: Device Received stream data: ~01-Msg Out. BROWN
              * Device: Device Sent stream data: MSG OUT YELLOW
              * Device: Closing Device Socket Normally.  PINK
              * Device: Socket closed Normally: ORANGE
              * Device: Not listening  RED
              */
             if (msgIn.ToLower().Contains("Starting Device Stream Request".ToLower()))
             {
                 DeviceState             = deviceStates.listening;
                 DeviceIsRunningLED.Fill = Cols[0];
             }
             else if (msgIn.ToLower().Contains("Device got connection".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 DeviceIsRunningLED.Fill = Cols[1];
             }
             else if (msgIn.ToLower().Contains("Device got stream".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 DeviceIsRunningLED.Fill = Cols[2];
             }
             else if (msgIn.ToLower().Contains("Device is connected and listening".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 DeviceIsRunningLED.Fill = Cols[3];
             }
             else if (msgIn.ToLower().Contains("Device Received stream data:".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 DeviceIsRunningLED.Fill = Cols[4];
             }
             else if (msgIn.ToLower().Contains("Device Sent stream data".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 DeviceIsRunningLED.Fill = Cols[5];
             }
             else if (msgIn.ToLower().Contains("Closing Device Socket Normally".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 DeviceIsRunningLED.Fill = Cols[6];
             }
             else if (msgIn.ToLower().Contains("Socket closed Normally".ToLower()))
             {
                 //DeviceState = deviceStates.listening;
                 DeviceIsRunningLED.Fill = Cols[7];
             }
             else if (msgIn.ToLower().Contains("Not listening".ToLower()))
             {
                 DeviceState             = deviceStates.stopped;
                 DeviceIsRunningLED.Fill = Cols[Cols.Count() - 1];
             }
             tbDevMode.Text      = ListEnum2[Azure_IoTHub_Connections.MyConnections.DeviceAction];
             tbDeviceStatus.Text = msgIn;
         });
     });
 }