Exemplo n.º 1
0
        //创建一级设备分组
        public void TestCreateLevel1DeviceGroup()
        {
            DefaultAcsClient acsClient = Demo.IotClient.GetClient();
            String           groupName = "Group_0827";
            String           groupDesc = "0827 Device Group";

            CreateDeviceGroupRequest request = new CreateDeviceGroupRequest();

            request.GroupName = groupName;
            request.GroupDesc = groupDesc;

            CreateDeviceGroupResponse response = acsClient.GetAcsResponse(request);

            Console.WriteLine("Create level1 Device Group: " + response.Success);
            if (!(bool)response.Success)
            {
                Console.WriteLine(response.Code + ", " + response.ErrorMessage);
                Console.ReadKey();
                return;
            }
            CreateDeviceGroupResponse.CreateDeviceGroup_Data GroupData = response.Data;
            Console.WriteLine("Create Device Group: " + GroupData.GroupId);
            Console.WriteLine("Create Device Group: " + GroupData.GroupName);
            Console.WriteLine("Create Device Group: " + GroupData.UtcCreate);
            Console.WriteLine("Create Device Group: " + GroupData.GroupDesc);
        }
        public static CreateDeviceGroupResponse Unmarshall(UnmarshallerContext context)
        {
            CreateDeviceGroupResponse createDeviceGroupResponse = new CreateDeviceGroupResponse();

            createDeviceGroupResponse.HttpResponse = context.HttpResponse;
            createDeviceGroupResponse.RequestId    = context.StringValue("CreateDeviceGroup.RequestId");
            createDeviceGroupResponse.Success      = context.BooleanValue("CreateDeviceGroup.Success");
            createDeviceGroupResponse.Code         = context.StringValue("CreateDeviceGroup.Code");
            createDeviceGroupResponse.ErrorMessage = context.StringValue("CreateDeviceGroup.ErrorMessage");

            CreateDeviceGroupResponse.CreateDeviceGroup_Data data = new CreateDeviceGroupResponse.CreateDeviceGroup_Data();
            data.GroupId   = context.StringValue("CreateDeviceGroup.Data.GroupId");
            data.UtcCreate = context.StringValue("CreateDeviceGroup.Data.UtcCreate");
            data.GroupName = context.StringValue("CreateDeviceGroup.Data.GroupName");
            data.GroupDesc = context.StringValue("CreateDeviceGroup.Data.GroupDesc");
            createDeviceGroupResponse.Data = data;

            return(createDeviceGroupResponse);
        }