Exemplo n.º 1
0
        public async Task ExecuteGetDeviceInfo()
        {
            RestClientService restClientService = new RestClientService();

            BoardInfo = new Board();

            try
            {
                //TODO: clean up after working test
                BoardInfo = await restClientService.GetBoardInfo(DeviceIpAddress.Trim());

                if (BoardInfo == null)
                {
                    IsBoardConnected           = "Error";
                    ConnectedBoardType         = "Unable to detect";
                    ConnectedBoardChannelCount = 0;
                    //ConnectedBoardGains;
                }

                if (!BoardInfo.board_connected)
                {
                    LastConnectivityDisplay = "Error connecting to Board. Check Pins and EXTPWRSwitch and Try Again";
                    IsBoardConnected        = "No";
                }
                else
                {
                    LastConnectivityDisplay    = "Connected to WiFi Shield & Board";
                    IsBoardConnected           = "Yes";
                    ConnectedBoardType         = BoardInfo.board_type;
                    ConnectedBoardChannelCount = BoardInfo.num_channels;

                    StringBuilder builder = new StringBuilder();
                    foreach (int gain in BoardInfo.gains)     // Loop through all strings
                    {
                        builder.Append(gain).Append(", ");    // Append string to StringBuilder
                    }
                    ConnectedBoardGains = builder.ToString(); // Get string from StringBuilder

                    //ConnectedBoardGains = BoardInfo.gains.ToString();
                }
            }
            catch (Exception ex)
            {
                //this.PageLoadStatus = PageLoadStatus.Exception;

                ex.Data["method"] = "ExecuteGetDeviceInfo";
            }
        }