//在某一产品下创建一台设备 private static void TestRegisterDevice() { IClientProfile clientProfile = DefaultProfile.GetProfile("<your-region-id>", "<your-access-key-id>", "<your-access-key-secret>"); DefaultAcsClient client = new DefaultAcsClient(clientProfile); RegistDeviceRequest request = new RegistDeviceRequest(); request.ProductKey = "<productKey>"; request.DeviceName = "<deviceName>"; try { RegistDeviceResponse response = client.GetAcsResponse(request); Console.WriteLine(response.Success); Console.WriteLine(response.ErrorMessage); Console.WriteLine("Device Id: " + response.DeviceId); Console.WriteLine("Device Secret: " + response.DeviceSecret); Console.WriteLine("Device Status: " + response.DeviceStatus); } catch (ServerException e) { Console.WriteLine(e.ErrorCode); Console.WriteLine(e.ErrorMessage); } catch (ClientException e) { Console.WriteLine(e.ErrorCode); Console.WriteLine(e.ErrorMessage); } Console.ReadKey(); }
public static RegistDeviceResponse Unmarshall(UnmarshallerContext context) { RegistDeviceResponse registDeviceResponse = new RegistDeviceResponse(); registDeviceResponse.HttpResponse = context.HttpResponse; registDeviceResponse.Status = context.BooleanValue("RegistDevice.Status"); registDeviceResponse.Msg = context.StringValue("RegistDevice.Msg"); registDeviceResponse.Data = context.StringValue("RegistDevice.Data"); registDeviceResponse.ErrorCode = context.StringValue("RegistDevice.ErrorCode"); registDeviceResponse.RequestId = context.StringValue("RegistDevice.RequestId"); return(registDeviceResponse); }
public static RegistDeviceResponse Unmarshall(UnmarshallerContext context) { RegistDeviceResponse registDeviceResponse = new RegistDeviceResponse(); registDeviceResponse.HttpResponse = context.HttpResponse; registDeviceResponse.RequestId = context.StringValue("RegistDevice.RequestId"); registDeviceResponse.Success = context.BooleanValue("RegistDevice.Success"); registDeviceResponse.ErrorMessage = context.StringValue("RegistDevice.ErrorMessage"); registDeviceResponse.DeviceId = context.StringValue("RegistDevice.DeviceId"); registDeviceResponse.DeviceName = context.StringValue("RegistDevice.DeviceName"); registDeviceResponse.DeviceSecret = context.StringValue("RegistDevice.DeviceSecret"); registDeviceResponse.DeviceStatus = context.StringValue("RegistDevice.DeviceStatus"); return(registDeviceResponse); }