public static EnableThingResponse Unmarshall(UnmarshallerContext context)
        {
            EnableThingResponse enableThingResponse = new EnableThingResponse();

            enableThingResponse.HttpResponse = context.HttpResponse;
            enableThingResponse.RequestId    = context.StringValue("EnableThing.RequestId");
            enableThingResponse.Success      = context.BooleanValue("EnableThing.Success");
            enableThingResponse.ErrorMessage = context.StringValue("EnableThing.ErrorMessage");

            return(enableThingResponse);
        }
コード例 #2
0
        //重新启用设备,被禁用的设备启用后可以再次接入物联网平台
        public void TestEnableThing()
        {
            DefaultAcsClient acsClient = Demo.IotClient.GetClient();

            String productKey = "<productKey>";
            String deviceName = "device0821";

            DisableThingRequest request = new DisableThingRequest();

            request.ProductKey = productKey;
            request.DeviceName = deviceName;

            DisableThingResponse response = acsClient.GetAcsResponse(request);

            Console.WriteLine(response.Success);
            if (!(bool)response.Success)
            {
                Console.WriteLine(response.Code + ", " + response.ErrorMessage);
            }

            GetDeviceStatusRequest request2 = new GetDeviceStatusRequest();

            request2.ProductKey = productKey;
            request2.DeviceName = deviceName;

            GetDeviceStatusResponse response2 = acsClient.GetAcsResponse(request2);

            Console.WriteLine(response2.Success);
            if (!(bool)response2.Success)
            {
                Console.WriteLine(response2.Code + ", " + response2.ErrorMessage);
            }

            GetDeviceStatusResponse.GetDeviceStatus_Data Data = response2.Data;
            Console.WriteLine("Status: " + Data.Status);


            EnableThingRequest request3 = new EnableThingRequest();

            request3.ProductKey = productKey;
            request3.DeviceName = deviceName;

            EnableThingResponse response3 = acsClient.GetAcsResponse(request3);

            Console.WriteLine(response3.Success);
            if (!(bool)response3.Success)
            {
                Console.WriteLine(response3.Code + ", " + response3.ErrorMessage);
            }


            GetDeviceStatusRequest request4 = new GetDeviceStatusRequest();

            request4.ProductKey = productKey;
            request4.DeviceName = deviceName;

            GetDeviceStatusResponse response4 = acsClient.GetAcsResponse(request4);

            Console.WriteLine(response4.Success);
            if (!(bool)response4.Success)
            {
                Console.WriteLine(response4.Code + ", " + response4.ErrorMessage);
            }

            Data = response4.Data;
            Console.WriteLine("Status: " + Data.Status);
        }