use of com.microsoft.azure.sdk.iot.device.ClientOptions in project azure-iot-sdk-java by Azure.
the class TokenCredentialTests method createDeviceClient.
private DeviceClient createDeviceClient(IotHubClientProtocol protocol, RegistryManager registryManager) throws IOException, IotHubException, URISyntaxException {
ClientOptions options = new ClientOptions();
options.setModelId(THERMOSTAT_MODEL_ID);
String deviceId = "some-device-" + UUID.randomUUID();
Device device = Device.createDevice(deviceId, AuthenticationType.SAS);
Device registeredDevice = registryManager.addDevice(device);
String deviceConnectionString = registryManager.getDeviceConnectionString(registeredDevice);
return new DeviceClient(deviceConnectionString, protocol, options);
}
use of com.microsoft.azure.sdk.iot.device.ClientOptions in project azure-iot-sdk-java by Azure.
the class DigitalTwinClientTests method createDeviceClient.
private DeviceClient createDeviceClient(IotHubClientProtocol protocol, String modelId) throws IOException, IotHubException, URISyntaxException {
ClientOptions options = new ClientOptions();
options.setModelId(modelId);
this.deviceId = DEVICE_ID_PREFIX.concat(UUID.randomUUID().toString());
Device device = Device.createDevice(deviceId, AuthenticationType.SAS);
Device registeredDevice = registryManager.addDevice(device);
String deviceConnectionString = registryManager.getDeviceConnectionString(registeredDevice);
return new DeviceClient(deviceConnectionString, protocol, options);
}
Aggregations