Configure device using RM Interface

This page guides user to configure reader using Reader Management Interface.

Important

This guide uses Postman Tool for sending API calls to reader.

Import Certificates and Generate Endpoint Configuration

  1. Import AWS device certificates downloaded into reader.

  • Method-1: Using SCP.

    • Copy <id>-certificate.pem.crt, <id>-private.pem.key and AmazonRootCA1.pem created in AWS IoT Core Setup into reader. (copy to desired folder inside /apps/).

  • Method-2: Using reader certificate webpage.

    • Create PFX file from certificate generated in AWS IoT Core Setup.

    • Import Certificates into reader using certificate page.

  • Method-3: pass certificates contents along with Endpoint Config.

  1. Create AWS Endpoint JSON object (when used Method-1 or Method-2 for importing certificates).

Edit Example AWS endpoint JOSN object shown below.

{
    "type": "AWS",
    "name": "AWS #1",
    "description": "AWS Demo",
    "configuration": {
        "connectionParams": {
            "clientId": "test-12345",
            "debug": false,
            "deviceEndpoint": "{deviceEndpoint}",
            "port": 8883
        },
        "security": {
            "useLocalCerts": true,
            "certificates": {
                "CACertificatePath": "{CACertificatePath}",
                "certAlgorithm": "RS256",
                "certFormat": "PEM",
                "certificatePath": "{certificatePath}",
                "privateKeyPath": "{privateKeyPath}"
            },
            "verifyServerCertificate": true
        },
        "topics": {
            "control": {
                "command": {
                    "qos": 0,
                    "retain": false,
                    "topic": "commands"
                },
                "response": {
                    "qos": 0,
                    "retain": false,
                    "topic": "responses"
                }
            },
            "management": {
                "command": {
                    "qos": 0,
                    "retain": false,
                    "topic": "commands"
                },
                "response": {
                    "qos": 0,
                    "retain": false,
                    "topic": "responses"
                }
            },
            "managementEvents": {
                "qos": 0,
                "retain": false,
                "topic": "asynevents"
            },
            "tagEvents": {
                "qos": 0,
                "retain": false,
                "topic": "events"
            }
        }
    }
}
  1. Replace {deviceEndpoint} string with Endpoint URL copied in AWS IoT Core Setup.

  2. Replace {certificatePath} string with path of public certificate downloaded.

    • If certificates are imported using Method-1: Replace with "/apps/<id>-certificate.pem.crt"

    • If certificates are imported using Method-2: Replace with "/readerConfig/keystore/<id>-certificate.pem.crt"

  3. Replace {PrivateKeyPath} string with path of private key downloaded.

    • If certificates are imported using Method-1: Replace with "/apps/<id>-private.pem.key".

    • If certificates are imported using Method-2: Replace with "/readerConfig/keystore/<id>-private.pem.key".

  4. Replace {CACertificatePath} string with path of root CA downloaded.

    • If certificates are imported using Method-1: Replace with /apps/AmazonRootCA1.pem".

    • If certificates are imported using Method-2: Replace with "/readerConfig/keystore/AmazonRootCA1.pem".

  1. Create AWS Endpoint JSON object without local certificates (when used Method-3 for importing certificates).

Edit Example AWS endpoint JOSN object shown below.

{
    "type": "AWS",
    "name": "AWS #1",
    "description": "AWS Demo",
    "configuration": {
        "connectionParams": {
            "clientId": "test-12345",
            "debug": false,
            "deviceEndpoint": "{deviceEndpoint}",
            "port": 8883
        },
        "security": {
            "useLocalCerts": false,
            "certificates": {
                "certificateContent": "{certificateContent}",
                "certAlgorithm": "RS256",
                "certFormat": "PEM",
                "privateKeyContent": "{privateKeyContent}",
                "CACertificateContent": "{CACertificateContent}"
            },
            "verifyServerCertificate": true
        },
        "topics": {
            "control": {
                "command": {
                    "qos": 0,
                    "retain": false,
                    "topic": "commands"
                },
                "response": {
                    "qos": 0,
                    "retain": false,
                    "topic": "responses"
                }
            },
            "management": {
                "command": {
                    "qos": 0,
                    "retain": false,
                    "topic": "commands"
                },
                "response": {
                    "qos": 0,
                    "retain": false,
                    "topic": "responses"
                }
            },
            "managementEvents": {
                "qos": 0,
                "retain": false,
                "topic": "asynevents"
            },
            "tagEvents": {
                "qos": 0,
                "retain": false,
                "topic": "events"
            }
        }
    }
}
  1. Replace {deviceEndpoint} with Endpoint URL copied from AWS IoT Core Setup.

  2. Replace {certificateContent} with content of <id>-certificate.pem.crt.

  3. Replace {privateKeyContent} with content of <id>-private.pem.key.

  4. Replace {CACertificateContent} with content of AmazonRootCA1.pem.

In certificate content replace newline \\n character with \\r\\n characters as shown below for proper JSON object.

../../_images/AWS_5.png

Note

tagEvents
  • Reader uses this topic to send tag read events.

managementEvents
  • Reader uses this topic to send asynchronous events like heartbeats, GPI, userapp, errors and warnings.

command
  • Reader will subscribe to this topic and listening for commands from cloud.

response
  • Reader uses this topic to send responses to commands.

Import Configuration into Reader

  1. Download and import postman collections Cloud Connect Enhanced UI.postman_collection.json and Cloud Connect - RM-commands.postman_collection.json.

  2. Create an environment variables protocol (http/https) and reader-ip (10.17.231.7).

  3. Execute Login API.

    Important

    change username and password field in the body with readers username and password configured.

    ../../_images/AWS_6.png
  4. Goto ADD endpoint (AWS) API and replace the JSON object between <motorm:data> </motorm:data> with the AWS Endpoint JSON object created in Import Certificates and Generate Endpoint Configuration.

    ../../_images/AWS_7.png
    • The response 200 OK indicate the endpoint got added successfully.

    • Status other than 200 indicate error and response contain the failure reason and check reader syslog to get more info on error.

  5. Create Endpoint Mapping for AWS.

    • Goto UPDATE endpoint mapping API and edit control, data, event, and management endpoints to the name used in AWS endpoint JSON object.

    Important

    Reader is configured to AWS endpoint for all the interfaces.

    ../../_images/AWS_8.png
    • The response 200 OK indicate the endpoint got added successfully.

    • Status other than 200 indicate error and response contain the failure reason and check reader syslog to get more info on error.

Connect to Cloud

  1. Goto isEnrolledToCloud and check if reader is enrolled for IoT connect or not.

../../_images/AWS_9.png
  1. If device is not enrolled currently, Send EnrollToCloud API.

../../_images/AWS_10.png
  1. If device is already enrolled, Send disconnectFromCloud API and connectToCloud API.

disconnectFromCloud API:

../../_images/AWS_11.png

connectToCloud API:

../../_images/AWS_12.png

Verify Cloud Connection

  1. Check Cloud Connection Status using isConnectedToCloud API.

../../_images/AWS_13.png