예제 #1
0
        public async Task <IActionResult> GetPnPData(bool update = false)
        {
            try
            {
                _logger?.LogDebug("GetPnPData()...");

                if (!_bcontrol.IsLocked)
                {
                    return(StatusCode(StatusCodes.Status406NotAcceptable, "Locked: update not yet finished."));
                }

                if (update)
                {
                    await _bcontrol.ReadPnPDataAsync();

                    if (!_bcontrol.PnPData.IsGood)
                    {
                        return(StatusCode(StatusCodes.Status502BadGateway, _bcontrol.InternalData.Status));
                    }
                }

                return(Ok(_bcontrol.PnPData));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
            }
        }
예제 #2
0
        public async Task TestBControlReadPnP()
        {
            await _bcontrol.ReadPnPDataAsync();

            Assert.True(_bcontrol.PnPData.IsGood);
        }