Skip to content

Commit f199dfe

Browse files
committed
Edits
1 parent df1bfcd commit f199dfe

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

includes/iot-hub-howto-device-management-java.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ This article describes how to use the [Azure IoT SDK for Java](https://github.co
2121

2222
This section describes how to use device application code to create a direct method callback listener.
2323

24+
The [DeviceClient](/java/api/com.microsoft.azure.sdk.iot.device.deviceclient) class exposes all the methods you require to interact with direct methods on the device.
25+
2426
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
2527

2628
### Device import statement
@@ -37,9 +39,16 @@ import com.microsoft.azure.sdk.iot.device.transport.IotHubConnectionStatus;
3739
import com.microsoft.azure.sdk.iot.device.twin.SubscriptionAcknowledgedCallback;
3840
```
3941

40-
### Connect to a device
42+
### Connect a device to IoT Hub
4143

42-
The [DeviceClient](/java/api/com.microsoft.azure.sdk.iot.device.deviceclient) class exposes all the methods you require to interact with direct methods on the device.
44+
A device app can authenticate with IoT Hub using the following methods:
45+
46+
* Shared access key
47+
* X.509 certificate
48+
49+
[!INCLUDE [iot-authentication-device-connection-string.md](iot-authentication-device-connection-string.md)]
50+
51+
#### Authenticate using a shared access key
4352

4453
To connect to a device:
4554

@@ -62,6 +71,10 @@ To connect to a device:
6271
client.open(true);
6372
```
6473

74+
#### Authenticate using an X.509 certificate
75+
76+
[!INCLUDE [iot-hub-howto-auth-device-cert-java](iot-hub-howto-auth-device-cert-java.md)]
77+
6578
### Create a direct method callback listener
6679

6780
Use [subscribeToMethods](https://azure.github.io/azure-iot-sdk-java/master/device/com/microsoft/azure/sdk/iot/device/InternalClient.html#subscribeToMethods-com.microsoft.azure.sdk.iot.device.twin.MethodCallback-java.lang.Object-int-) to initialize a direct method callback listener. `subscribeToMethods` listens for incoming direct methods until the connection is terminated. The method name and payload is received for each direct method call.
@@ -92,7 +105,7 @@ The Azure IoT SDK for Java includes a working sample to test the device app conc
92105

93106
This section describes how to initiate a remote reboot on a device using a direct method.
94107

95-
The `ServiceClient` [DeviceMethod](/java/api/com.microsoft.azure.sdk.iot.service.devicetwin.devicemethod) class contains methods that services can use to access device twins.
108+
The `ServiceClient` [DeviceMethod](/java/api/com.microsoft.azure.sdk.iot.service.devicetwin.devicemethod) class contains methods that services can use to access direct methods.
96109

97110
### Service import statements
98111

includes/iot-hub-howto-device-management-python.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ To invoke a direct method on a device:
168168
1. Create a [CloudToDeviceMethod](/python/api/azure-iot-hub/azure.iot.hub.protocol.models.cloudtodevicemethod) object. Supply the method name and payload as parameters.
169169
1. Call [invoke_device_method](/python/api/azure-iot-hub/azure.iot.hub.iothub_registry_manager.iothubregistrymanager?#azure-iot-hub-iothub-registry-manager-iothubregistrymanager-invoke-device-method) to invoke a direct method on a device. Supply the device ID and `CloudToDeviceMethod` payload object as parameters.
170170

171-
This example calls `CloudToDeviceMethod` to invoke a direct method named "rebootDevice" on a device. After the direct method has been successfully invoked, the direct method response payload is displayed.
171+
This example calls `CloudToDeviceMethod` to invoke a direct method named "rebootDevice" on a device. After the direct method is successfully invoked, the direct method response payload is displayed.
172172

173173
```python
174174
CONNECTION_STRING = "{IoTHubConnectionString}"

0 commit comments

Comments
 (0)