Ejemplo n.º 1
0
        public async static void TurnLampToColor(LampColor color)
        {
            string    url  = LIGHTS_BASE + LIGHTS_GROUP_API;
            JsonValue json = Codec.EncodeHueChange(color);

            WazombiNetworkingResponse response = await WazombiNetworking.Put(url, json);
        }
Ejemplo n.º 2
0
        public static async Task <LampResponse> RegisterDevice()
        {
            LampResponse response = new LampResponse();

            string    url  = "http://" + IP + "/api";
            JsonValue json = Codec.EncodeRegistrationJson(APPNAME, APPKEY);

            WazombiNetworkingResponse intermediary = await WazombiNetworking.Post(url, json);

            if (intermediary.HasException)
            {
                response.Error = new LampError {
                    Type        = intermediary.Exception,
                    Description = "Oops! Something went terribly wrong. Please try again"
                };
            }
            else
            {
                response = Codec.DecodeLampResponse(intermediary.Json);

                if (response.IsOk)
                {
                    REGISTEREDUSERNAME = response.Username;
                }
            }

            return(response);
        }
Ejemplo n.º 3
0
        async static Task <WazombiNetworkingResponse> TurnLights(bool _on)
        {
            string    url  = LIGHTS_BASE + LIGHTS_GROUP_API;
            JsonValue json = Codec.TurnLights(_on);

            WazombiNetworkingResponse response = await WazombiNetworking.Put(url, json);

            return(response);
        }