public static QueryDeviceStatisticsResponse Unmarshall(UnmarshallerContext context)
        {
            QueryDeviceStatisticsResponse queryDeviceStatisticsResponse = new QueryDeviceStatisticsResponse();

            queryDeviceStatisticsResponse.HttpResponse = context.HttpResponse;
            queryDeviceStatisticsResponse.RequestId    = context.StringValue("QueryDeviceStatistics.RequestId");
            queryDeviceStatisticsResponse.Success      = context.BooleanValue("QueryDeviceStatistics.Success");
            queryDeviceStatisticsResponse.ErrorMessage = context.StringValue("QueryDeviceStatistics.ErrorMessage");

            QueryDeviceStatisticsResponse.QueryDeviceStatistics_Data data = new QueryDeviceStatisticsResponse.QueryDeviceStatistics_Data();
            data.DeviceCount = context.LongValue("QueryDeviceStatistics.Data.DeviceCount");
            data.OnlineCount = context.LongValue("QueryDeviceStatistics.Data.OnlineCount");
            data.ActiveCount = context.LongValue("QueryDeviceStatistics.Data.ActiveCount");
            queryDeviceStatisticsResponse.Data = data;

            return(queryDeviceStatisticsResponse);
        }
        //查看某一产品下的设备统计数据
        public void TestQueryDeviceStatistics()
        {
            DefaultAcsClient acsClient  = Demo.IotClient.GetClient();
            String           productKey = "<productKey>";

            QueryDeviceStatisticsRequest request = new QueryDeviceStatisticsRequest();

            request.ProductKey = productKey;

            QueryDeviceStatisticsResponse response = acsClient.GetAcsResponse(request);

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

            QueryDeviceStatisticsResponse.QueryDeviceStatistics_Data data = response.Data;
            Console.WriteLine("DeviceCount: " + (long)data.DeviceCount);
            Console.WriteLine("ActiveCount: " + (long)data.ActiveCount);
            Console.WriteLine("OnlineCount: " + (long)data.OnlineCount);
        }
Exemple #3
0
        public static QueryDeviceStatisticsResponse Unmarshall(UnmarshallerContext context)
        {
            QueryDeviceStatisticsResponse queryDeviceStatisticsResponse = new QueryDeviceStatisticsResponse();

            queryDeviceStatisticsResponse.HttpResponse = context.HttpResponse;
            queryDeviceStatisticsResponse.RequestId    = context.StringValue("QueryDeviceStatistics.RequestId");

            List <QueryDeviceStatisticsResponse.PushDeviceStatisticsInfo> pushDeviceStatisticsInfos = new List <QueryDeviceStatisticsResponse.PushDeviceStatisticsInfo>();

            for (int i = 0; i < context.Length("QueryDeviceStatistics.PushDeviceStatisticsInfos.Length"); i++)
            {
                QueryDeviceStatisticsResponse.PushDeviceStatisticsInfo pushDeviceStatisticsInfo = new QueryDeviceStatisticsResponse.PushDeviceStatisticsInfo();
                pushDeviceStatisticsInfo.Date       = context.StringValue("QueryDeviceStatistics.PushDeviceStatisticsInfos[" + i + "].Date");
                pushDeviceStatisticsInfo.DeviceType = context.IntegerValue("QueryDeviceStatistics.PushDeviceStatisticsInfos[" + i + "].DeviceType");
                pushDeviceStatisticsInfo.Count      = context.IntegerValue("QueryDeviceStatistics.PushDeviceStatisticsInfos[" + i + "].Count");

                pushDeviceStatisticsInfos.Add(pushDeviceStatisticsInfo);
            }
            queryDeviceStatisticsResponse.PushDeviceStatisticsInfos = pushDeviceStatisticsInfos;

            return(queryDeviceStatisticsResponse);
        }