Ejemplo n.º 1
0
        public void CreateGetRequestShouldReturnRequestWithCorrectProperties()
        {
            var request = RequestFactory.CreateGetRequest();

            CheckRequestProperties(
                request,
                command: Command.LightGet,
                ackRequired: false,
                resRequired: true,
                payloadType: typeof(RequestPayload)
                );
        }
Ejemplo n.º 2
0
Archivo: Light.cs Proyecto: treg/Lifx
        public async Task <LightState> GetStateAsync(CancellationToken cancellationToken)
        {
            var request = _requestFactory.CreateGetRequest();
            var payload = await _communicator.CommunicateAsync <StateResponsePayload>(request, cancellationToken)
                          .ConfigureAwait(false);

            return(new LightState(
                       payload.Label,
                       payload.Power,
                       payload.Brightness,
                       payload.Temperature,
                       payload.Color
                       ));
        }