public static GetGatewayBySubDeviceResponse Unmarshall(UnmarshallerContext context)
        {
            GetGatewayBySubDeviceResponse getGatewayBySubDeviceResponse = new GetGatewayBySubDeviceResponse();

            getGatewayBySubDeviceResponse.HttpResponse = context.HttpResponse;
            getGatewayBySubDeviceResponse.RequestId    = context.StringValue("GetGatewayBySubDevice.RequestId");
            getGatewayBySubDeviceResponse.Success      = context.BooleanValue("GetGatewayBySubDevice.Success");
            getGatewayBySubDeviceResponse.Code         = context.StringValue("GetGatewayBySubDevice.Code");
            getGatewayBySubDeviceResponse.ErrorMessage = context.StringValue("GetGatewayBySubDevice.ErrorMessage");

            GetGatewayBySubDeviceResponse.GetGatewayBySubDevice_Data data = new GetGatewayBySubDeviceResponse.GetGatewayBySubDevice_Data();
            data.ProductKey      = context.StringValue("GetGatewayBySubDevice.Data.ProductKey");
            data.ProductName     = context.StringValue("GetGatewayBySubDevice.Data.ProductName");
            data.DeviceSecret    = context.StringValue("GetGatewayBySubDevice.Data.DeviceSecret");
            data.DeviceName      = context.StringValue("GetGatewayBySubDevice.Data.DeviceName");
            data.FirmwareVersion = context.StringValue("GetGatewayBySubDevice.Data.FirmwareVersion");
            data.GmtCreate       = context.StringValue("GetGatewayBySubDevice.Data.GmtCreate");
            data.UtcCreate       = context.StringValue("GetGatewayBySubDevice.Data.UtcCreate");
            data.GmtActive       = context.StringValue("GetGatewayBySubDevice.Data.GmtActive");
            data.UtcActive       = context.StringValue("GetGatewayBySubDevice.Data.UtcActive");
            data.GmtOnline       = context.StringValue("GetGatewayBySubDevice.Data.GmtOnline");
            data.UtcOnline       = context.StringValue("GetGatewayBySubDevice.Data.UtcOnline");
            data.Status          = context.StringValue("GetGatewayBySubDevice.Data.Status");
            data.IpAddress       = context.StringValue("GetGatewayBySubDevice.Data.IpAddress");
            data.NodeType        = context.StringValue("GetGatewayBySubDevice.Data.NodeType");
            data.Region          = context.StringValue("GetGatewayBySubDevice.Data.Region");
            data.IotId           = context.StringValue("GetGatewayBySubDevice.Data.IotId");
            getGatewayBySubDeviceResponse.Data = data;

            return(getGatewayBySubDeviceResponse);
        }
コード例 #2
0
        //获取子设备所属的网关设备信息
        public void TestGetGatewayBySubDevice()
        {
            DefaultAcsClient acsClient = Demo.IotClient.GetClient();


            String ProductKey = "<productKey>";
            String Devicename = "device_0821_148";

            GetGatewayBySubDeviceRequest request = new GetGatewayBySubDeviceRequest();

            request.ProductKey = ProductKey;
            request.DeviceName = Devicename;

            GetGatewayBySubDeviceResponse response = acsClient.GetAcsResponse(request);

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

            GetGatewayBySubDeviceResponse.GetGatewayBySubDevice_Data gwDeviceData = response.Data;
            Console.WriteLine(gwDeviceData.ProductKey + ", " + gwDeviceData.DeviceName + ", " + gwDeviceData.NodeType + ", " + gwDeviceData.IotId);
        }