/*
         * 调用此接口,触发云端向网关设备下达指令(添加子设备拓扑关系),网关如果订阅对应的Topic,则会受到消息通知
         * 拓扑关系的添加成功与否是要看网关动作成功与否
         * 调用此接口的前提是,网关设备要在线,子设备也要在线,目前一台子设备只能绑定到一台网关设备上
         * */
        public void TestNotifyAddThingTopo()
        {
            DefaultAcsClient acsClient = Demo.IotClient.GetClient();

            //网关设备
            String gwProductKey = "<productKey>";
            String gwDevicename = "device_0821_148";
            //普通设备(子设备)
            String ProductKey = "<productKey>";
            String DeviceName = "<deviceName>";

            NotifyAddThingTopoRequest request = new NotifyAddThingTopoRequest();

            request.GwProductKey = gwProductKey;
            request.GwDeviceName = gwDevicename;

            String deviceListString = "[{\"productKey\":\"" + ProductKey + "\", \"deviceName\":\"" + DeviceName + "\"}]";

            request.DeviceListStr = deviceListString;

            NotifyAddThingTopoResponse response = acsClient.GetAcsResponse(request);

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

            NotifyAddThingTopoResponse.NotifyAddThingTopo_Data Data = response.Data;
            Console.WriteLine("Notify Add ThingTopo MessageId: " + Data.MessageId);
        }
Beispiel #2
0
        public static NotifyAddThingTopoResponse Unmarshall(UnmarshallerContext context)
        {
            NotifyAddThingTopoResponse notifyAddThingTopoResponse = new NotifyAddThingTopoResponse();

            notifyAddThingTopoResponse.HttpResponse = context.HttpResponse;
            notifyAddThingTopoResponse.RequestId    = context.StringValue("NotifyAddThingTopo.RequestId");
            notifyAddThingTopoResponse.Success      = context.BooleanValue("NotifyAddThingTopo.Success");
            notifyAddThingTopoResponse.ErrorMessage = context.StringValue("NotifyAddThingTopo.ErrorMessage");

            return(notifyAddThingTopoResponse);
        }
        public static NotifyAddThingTopoResponse Unmarshall(UnmarshallerContext _ctx)
        {
            NotifyAddThingTopoResponse notifyAddThingTopoResponse = new NotifyAddThingTopoResponse();

            notifyAddThingTopoResponse.HttpResponse = _ctx.HttpResponse;
            notifyAddThingTopoResponse.RequestId    = _ctx.StringValue("NotifyAddThingTopo.RequestId");
            notifyAddThingTopoResponse.Success      = _ctx.BooleanValue("NotifyAddThingTopo.Success");
            notifyAddThingTopoResponse.ErrorMessage = _ctx.StringValue("NotifyAddThingTopo.ErrorMessage");
            notifyAddThingTopoResponse.Code         = _ctx.StringValue("NotifyAddThingTopo.Code");

            NotifyAddThingTopoResponse.NotifyAddThingTopo_Data data = new NotifyAddThingTopoResponse.NotifyAddThingTopo_Data();
            data.MessageId = _ctx.StringValue("NotifyAddThingTopo.Data.MessageId");
            notifyAddThingTopoResponse.Data = data;

            return(notifyAddThingTopoResponse);
        }