示例#1
0
        public GetStates DigitalWrite(Pins pin, SetStates state)
        {
            Response result = Post(Functions.digitalwrite,
                                   String.Format(payloadWrite,
                                                 HttpUtility.UrlEncode(AccessToken),
                                                 HttpUtility.UrlEncode(pin.ToString()), HttpUtility.UrlEncode(state.ToString())));

            switch (result.ReturnValue)
            {
            case -1:
                return(GetStates.FAIL);

            default:
                if (state == SetStates.HIGH)
                {
                    return(GetStates.HIGH);
                }
                return(GetStates.LOW);
            }
        }
示例#2
0
        public GetStates DigitalWrite(Pins pin, SetStates state)
        {
            Response result = Post(Functions.digitalwrite,
                String.Format(payloadWrite,
                              HttpUtility.UrlEncode(AccessToken),
                              HttpUtility.UrlEncode(pin.ToString()), HttpUtility.UrlEncode(state.ToString())));

            switch (result.ReturnValue)
            {
                case -1:
                    return GetStates.FAIL;
                default:
                    if (state == SetStates.HIGH) return GetStates.HIGH;
                    return GetStates.LOW;
            }
        }
示例#3
0
文件: LifxApi.cs 项目: h82258652/iot
		public async Task SetStates(Mix mix)
		{
			SetStates api = new SetStates(this.Identity);
			await api.Set(mix);
		}