├── README.md ├── aws-mqtt.md ├── azure-mqtt.md ├── bluemix-mqtt.md ├── cpp-mqtt.md ├── images ├── att-m2x │ ├── click-create-device.png │ ├── create-another.png │ ├── define-device.png │ ├── device-info.png │ ├── generate-chart.png │ ├── m2x-add-stream-info.png │ ├── m2x-add-stream.png │ ├── m2x-create-device.png │ ├── m2x-devices.png │ ├── m2x-signup.png │ ├── name-project.png │ ├── select-device.png │ ├── signup-info.png │ ├── test-device-2.png │ ├── test-device.png │ └── verify-email.png ├── aws │ ├── aws-attach-cert-to-device.png │ ├── aws-create-account.png │ ├── aws-create-attach-policy.png │ ├── aws-create-device.png │ ├── aws-determine-endpoint.png │ ├── aws-list-things.png │ ├── aws-provision-a-cert.png │ ├── aws-verify-install.png │ ├── aws-win-path-setup1.png │ ├── aws-win-path-setup10.png │ ├── aws-win-path-setup2.png │ ├── aws-win-path-setup3.png │ ├── aws-win-path-setup4.png │ ├── aws-win-path-setup5.png │ ├── aws-win-path-setup6.png │ ├── aws-win-path-setup7.png │ ├── aws-win-path-setup8.png │ ├── aws-win-path-setup9.png │ ├── aws-winscp1.png │ ├── aws-winscp2.png │ └── aws-winscp3.png ├── azure │ ├── README.md │ ├── create-free-account.png │ ├── create-new-device-curl.png │ ├── create-new-iot-hub-2.png │ ├── create-new-iot-hub.png │ ├── device-sas-example.png │ ├── list-devices-curl.png │ ├── obtain-sas.png │ ├── sas-example.png │ └── sign-in-to-azure.png ├── ibm-bluemix │ ├── ibm-add-device-2.png │ ├── ibm-add-device-click.png │ ├── ibm-connect-launch.png │ ├── ibm-create-account.png │ ├── ibm-create-device-type.png │ ├── ibm-create-device-type2.png │ ├── ibm-define-temp.png │ ├── ibm-device-id.png │ ├── ibm-dont-lose-info.png │ ├── ibm-final-add.png │ ├── ibm-hit-create.png │ ├── ibm-internet-of-things-platform.png │ ├── ibm-login.png │ ├── ibm-meta.png │ ├── ibm-meta2.png │ ├── ibm-name-description.png │ ├── ibm-pricing-plan.png │ ├── ibm-sec-autogen.png │ ├── ibm-service-name.png │ ├── ibm-submit.png │ └── ibm-use-service-api.png ├── predix │ ├── predix-signup.png │ └── predix-toolkit.png └── sap │ ├── sap-device.png │ ├── sap-http-access-log.png │ ├── sap-iotmms-dashboard.png │ ├── sap-message-type.png │ └── sap-signup.png ├── installing-cygwin.md ├── js-mqtt.md ├── m2x-mqtt.md ├── predix-iot.md ├── sap-iot.md └── support ├── aws └── aws-device-policy.json └── azure ├── build ├── linux │ └── sastoken ├── osx │ └── sastoken └── windows │ └── sastoken.exe └── sastoken.go /README.md: -------------------------------------------------------------------------------- 1 | # DISCONTINUATION OF PROJECT # 2 | This project will no longer be maintained by Intel. 3 | Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project. 4 | Intel no longer accepts patches to this project. 5 | # Intel® how-to code samples cloud setup 6 | 7 | This repository contains the setup information needed to add IoT cloud support to the Intel® how-to code samples. 8 | 9 | The following cloud services are currently supported: 10 | 11 | - Amazon\* Web Services\* (AWS\*) 12 | - AT&T\* M2X\* IoT 13 | - GE\* Predix\* IoT 14 | - IBM\* Bluemix\* Internet of Things 15 | - Microsoft\* Azure\* IoT Hub. 16 | - SAP\* Cloud Platform Internet of Things 17 | 18 | Start by using the guide that corresponds to your backend environment (e.g., Microsoft\* Azure\*) to set up whatever needed cloud services. Then use the guide that corresponds to your programming language (e.g., C++) to add support to your code. 19 | -------------------------------------------------------------------------------- /aws-mqtt.md: -------------------------------------------------------------------------------- 1 | # Connecting to Amazon\* Web Services\* (AWS\*) IoT using MQTT* 2 | 3 | ## AWS* IoT initial setup 4 | 5 | 1. Create an account on https://aws.amazon.com, if you do not yet have one. 6 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-create-account.png) 7 | 8 | 2. Install the AWS\* CLI by following the instructions at http://docs.aws.amazon.com/cli/latest/userguide/installing.html. 9 | 10 | ### Adding the AWS\* CLI path to environment variables on Windows\* 11 | 12 | 1. Go to **Control Panel** and click **System**. 13 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-win-path-setup2.png) 14 | 15 | 2. Click **Advanced system settings**. 16 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-win-path-setup3.png) 17 | 18 | 3. On the **Advanced** tab, click **Environment Variables**.
19 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-win-path-setup4.png) 20 | 21 | 4. In the **User variables for me** box, double-click **PATH**. 22 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-win-path-setup5.png) 23 | 24 | 5. Click **New**, add the full path to the AWS\* CLI installation directory, and click **OK**. 25 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-win-path-setup6.png) 26 | 27 | 6. In the **System variables** box, double-click **Path**. 28 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-win-path-setup7.png) 29 | 30 | 7. If the AWS\* CLI installation directory is not listed, repeat the actions from step 5. 31 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-win-path-setup8.png) 32 | 33 | 8. In the **Environment Variables** window, click **OK**. 34 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-win-path-setup9.png) 35 | 36 | 9. In the **System Properties** window, click **OK**.
37 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-win-path-setup10.png) 38 | 39 | **Note:** For ease of use on Windows\*, while using the AWS\* CLI, follow the subsequent steps of this tutorial in the directory where you cloned this repository (for example, `C:\Users\me\Documents\GitHub\intel-iot-examples-mqtt\support\aws`). 40 | 41 | Verify the setup by running this command: 42 | 43 | aws iot help 44 | 45 | You should see the output like this: 46 | 47 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-verify-install.png) 48 | 49 | ## AWS permissions 50 | 51 | If you run into any errors such as "AccessDeniedException" when trying to use the AWS CLI, they are likely due to insufficient permissions having been granted to the user account you are trying to use. 52 | 53 | Make sure that the account has the needed IAM policy for access. Check out http://docs.aws.amazon.com/iot/latest/developerguide/iam-policies.html and make sure you have assigned them using http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-using.html 54 | 55 | ## Create a new device 56 | 57 | To create a new device, use the `create-thing` command as follows: 58 | 59 | aws iot create-thing --thing-name "edison1" 60 | 61 | You should see the output like this: 62 | 63 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-create-device.png) 64 | 65 | ## Get the list of devices 66 | 67 | To list your devices, use the `list-things` command as follows: 68 | 69 | aws iot list-things 70 | 71 | You should see the output like this: 72 | 73 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-list-things.png) 74 | 75 | ## Obtain and configure a certificate for device use 76 | 77 | 1. Provision a certificate: 78 | 79 | aws iot create-keys-and-certificate --set-as-active --certificate-pem-outfile cert.pem --public-key-outfile publicKey.pem --private-key-outfile privateKey.pem 80 | 81 | You should see the output like this: 82 | 83 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-provision-a-cert.png) 84 | 85 | 2. Create/attach policy: 86 | 87 | aws iot create-policy --policy-name "PubSubToAnyTopic" --policy-document file:///intel/how-to-code-samples/docs/mqtt/aws-device-policy.json 88 | 89 | You should see the output like this: 90 | 91 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-create-attach-policy.png) 92 | 93 | 3. Attach the certificate to a device: 94 | 95 | You need `certificate-arn` from step 1: 96 | 97 | aws iot attach-principal-policy --principal "certificate-arn" --policy-name "PubSubToAnyTopic" 98 | 99 | ## Determine the AWS* endpoint 100 | 101 | You can obtain the **host** to use by running the following command: 102 | 103 | aws iot describe-endpoint 104 | 105 | You should see the output like this: 106 | 107 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-determine-endpoint.png) 108 | 109 | ## Installing certificates to the Intel® Edison board 110 | 111 | From your computer, run the following commands: 112 | 113 | scp -r cert.pem USERNAME@xxx.xxx.x.xxx:/home/root/.ssh 114 | scp -r publicKey.pem USERNAME@xxx.xxx.x.xxx:/home/root/.ssh 115 | scp -r privateKey.pem USERNAME@xxx.xxx.x.xxx:/home/root/.ssh 116 | 117 | where `USERNAME@xxx.xxx.x.xxx` is the username and IP address you set for your board. 118 | 119 | ### Installing certificates to the Intel® Edison board (Windows* only) 120 | 121 | We'll be using WinSCP* for the next steps. For installation instructions, refer to https://github.com/intel-iot-devkit/how-to-code-samples/blob/master/docs/cpp/using-winscp.md. 122 | 123 | 1. Log into your device using WinSCP*. 124 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-winscp1.png) 125 | 126 | 2. Make sure your host machine is in the directory where you ran your previous AWS\* CLI commands. 127 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-winscp2.png) 128 | 129 | 3. Copy **cert.pem**, **privateKey.pem**, and **publicKey.pem** to your `/home/root` directory on your Intel® Edison board. 130 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/aws/aws-winscp3.png) 131 | 132 | ## Summary 133 | 134 | If you have followed all the steps above, you should have all the information that your program needs to connect to the MQTT* server: 135 | 136 | `hostname` - use the **host** value you obtained by running the `aws iot describe-endpoint` command, along with the `ssl://` (for C++) or `mqtts://` protocol (for JavaScript*) 137 | 138 | `client_id` - use `[Your device name]` 139 | 140 | `topic` - use `devices/[Your device name]` 141 | 142 | `cert` - use the filename of the device certificate as described above 143 | 144 | `key` - use the filename of the device key as described above 145 | 146 | `ca` - use the filename of the CA certificate (`/etc/ssl/certs/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem`) 147 | 148 | ## Additional setup for C++ 149 | 150 | When running your C++ code on the Intel® Edison board or Intel® IoT Gateway, you need to set the MQTT\* client parameters in Intel® System Studio\*. To do that: 151 | 152 | 1. Go to **Run configurations** and, in the **Commands to execute before application** field, type the following: 153 | 154 | export MQTT_SERVER="ssl://[hostname]:8883"; export MQTT_CLIENT_ID="[Your device ID]"; export MQTT_TOPIC="devices/[Your device ID]"; export MQTT_CERT="/home/root/.ssh/cert.pem"; export MQTT_CERT_KEY="/home/root/.ssh/privateKey.pem"; export MQTT_CA_ROOT="/etc/ssl/certs/VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem" 155 | 156 | 2. Click the **Apply** button to save these settings. 157 | 3. Click the **Run** button to run the code on your board. 158 | 159 | ## Additional setup for JavaScript* 160 | 161 | When running your JavaScript\* code on the Intel® Edison board or Intel® IoT Gateway, you need to set the MQTT\* client parameters in the Intel® XDK IDE. Add the following entries to the **config.json** file: 162 | 163 | ```json 164 | "services": { 165 | "mqtt": { 166 | "hostname": "[your host name]", 167 | "client_id": "[device id]", 168 | "topic": "devices/[your device name]", 169 | "cert": "[device certificate filename]", 170 | "key": "[device key filename]" 171 | } 172 | } 173 | ``` 174 | 175 | ## Additional setup for Python\* 176 | 177 | When running your Python\* code on the Intel® Edison board or Intel® IoT Gateway, you need to use the MQTT\* interface by setting the client parameters. Add the following entries to the **config.json** file: 178 | 179 | ```json 180 | "services": { 181 | "mqtt": { 182 | "server": "[your host name]", 183 | "port": "8883", 184 | "client_id": "[device id]", 185 | "topic": "devices/[your device name]", 186 | "cert": "[device certificate filename]", 187 | "key": "[device key filename]" 188 | } 189 | } 190 | ``` 191 | -------------------------------------------------------------------------------- /azure-mqtt.md: -------------------------------------------------------------------------------- 1 | # Connecting to Microsoft\* Azure\* IoT Hub using MQTT\* 2 | 3 | ## Microsoft\* Azure\* initial setup 4 | 5 | 1. Create an account on [https://azure.microsoft.com/en-us](https://azure.microsoft.com/en-us), if you do not yet have one. 6 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/azure/create-free-account.png) 7 | 8 | 2. Log into your account. 9 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/azure/sign-in-to-azure.png) 10 | 11 | 3. Click **New > Internet of Things > Azure IoT Hub**. 12 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/azure/create-new-iot-hub.png) 13 | 14 | 4. Enter the required information for your new Azure\* IoT Hub and click **Create**. 15 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/azure/create-new-iot-hub-2.png) 16 | 17 | Your new Azure\* IoT Hub is created within a few moments. 18 | 19 | ## Download the **sastoken** command line program 20 | 21 | In order to authenticate to the Azure\* IoT Hub, you need to create a Shared Access Signature (SAS) token. The easiest way to do this, is using a command-line program called **sastoken**. 22 | 23 | Precompiled binaries for Windows\*, OS X\*, and Linux\* have been created and can be found for download here: 24 | 25 | [https://github.com/intel-iot-devkit/intel-iot-examples-mqtt/releases](https://github.com/intel-iot-devkit/intel-iot-examples-mqtt/releases) 26 | 27 | All you need to do is download the correct version for your platform, and put the file somewhere where you will be able to run it from the command-line. 28 | 29 | You can find the source code for the `sastoken` program under `support/azure/sastoken.go`. 30 | 31 | ## Obtain a shared access signature (SAS) token for administrative use 32 | 33 | Once your Azure\* IoT Hub is created, you need to obtain an SAS token to perform administrative actions, such as creating or listing devices. To do this: 34 | 35 | 1. On your dashboard, click the link to your new Azure\* IoT Hub. 36 | 2. Go to **Settings > Shared access policies > registryReadWrite**. 37 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/azure/obtain-sas.png) 38 | 3. Obtain the **Primary key** and the corresponding **Connection string**. 39 | 4. Create an SAS token by running the command as follows: 40 | 41 | sastoken .azure-devices.net/devices/ 1440 registryReadWrite 42 | 43 | **Note:** For this to work, you must be in the directory where you downloaded the **sastoken** program (e.g., `C:\Users\me\Downloads`). 44 | 45 | Your SAS token should look similar to this: 46 | 47 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/azure/sas-example.png) 48 | 49 | This token will only be valid for 24 hours (1440 minutes) and should be used only for performing administrative functions, such as creating new devices. Each device also needs its own SAS token, which we will create in subsequent steps. 50 | 51 | ## Create a new device 52 | 53 | You can use the `curl` command to create a new device for your Azure\* IoT Hub using the SAS token with **registryReadWrite** access as obtained above. For example, to create a new device named "edison1", issue the following command: 54 | 55 | ``` 56 | $ curl -i -X PUT -H "Content-Type: application/json" -H "Authorization: " -d "{deviceId: \"edison1\"}" https://.azure-devices.net/devices/edison1?api-version=2016-02-03 57 | ``` 58 | 59 | If you are using Windows\*, you may need to install Cygwin* to be able to use `curl`. See [https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/feature/image-link/installing-cygwin.md](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/feature/image-link/installing-cygwin.md) for instructions. 60 | 61 | You should receive a response that looks like this: 62 | 63 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/azure/create-new-device-curl.png) 64 | 65 | ## Get the list of devices 66 | 67 | You can use `curl` to get the list of current devices for your Azure\* IoT Hub using the SAS token with **registryReadWrite** access as follows: 68 | 69 | ``` 70 | curl -i -H "Accept: application/json" -H "Authorization: " https://.azure-devices.net/devices?api-version=2016-02-03 71 | ``` 72 | 73 | You should receive a response that looks like this: 74 | 75 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/azure/list-devices-curl.png) 76 | 77 | You need the device's **Primary key** or **Secondary key** to obtain an SAS token for enabling the device to connect to the Azure\* IoT Hub. 78 | 79 | ## Obtain an SAS token for device use 80 | 81 | You need to create an SAS token for enabling the Intel® Edison board to connect to your Azure\* IoT Hub for recording data. The SAS token for this purpose has fewer privileges than the one created for administrative use. You can use `sastoken` as follows: 82 | 83 | ``` 84 | sastoken .azure-devices.net/devices/ 1440 85 | ``` 86 | 87 | Your SAS token should look similar to this: 88 | 89 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/azure/device-sas-example.png) 90 | 91 | It is valid for 24 hours (1440 minutes) and if you wish to change the duration for how long the SAS token will be valid, enter a different number of minutes. Note that the SAS token for a specific device should be used only for the device for which it is created. In other words, each device that you wish to connect needs its own SAS token. 92 | 93 | ## Summary 94 | 95 | If you have followed all the steps above, you should have all the information that your program needs to connect to the MQTT\* server: 96 | 97 | - `hostname` - use `[Your IoT Hub Name].azure-devices.net`, along with the `ssl://` (for C++) or the `mqtts://` (for JavaScript\*) protocol 98 | 99 | - `client_id` - use `[Your device name]` 100 | 101 | - `topic` - use `devices/[Your device name]/messages/events/` 102 | 103 | - `username` - use `[Your IoT Hub Name].azure-devices.net/[Your device name]` 104 | 105 | - `password` - use the string with your device's SAS token. 106 | 107 | ## Additional setup for C++ 108 | 109 | When running your C++ code on the Intel® Edison board or Intel® IoT Gateway, you need to set the MQTT\* client parameters in Intel® System Studio\*. To do that: 110 | 111 | 1. Go to **Run configurations** and, in the **Commands to execute before application** field, type the following: 112 | 113 | export MQTT_SERVER="ssl://[Your IoT Hub Name].azure-devices.net:8883"; export MQTT_TOPIC="devices/[Your device name]/messages/events/"; export MQTT_CLIENTID="[Your device ID]"; export MQTT_USERNAME="[Your IoT Hub Name].azure-devices.net/"; export MQTT_PASSWORD="[Your device SAS token]" 114 | 115 | 2. Click the **Apply** button to save these settings. 116 | 3. Click the **Run** button to run the code on your board. 117 | 118 | ## Additional setup for JavaScript* 119 | 120 | When running your JavaScript\* code on the Intel® Edison board or Intel® IoT Gateway, you need to set the MQTT\* client parameters in the Intel® XDK IDE. Add the following entries to the **config.json** file: 121 | 122 | ```json 123 | "services": { 124 | "mqtt": { 125 | "hostname": "mqtts://[Your IoT Hub Name].azure-devices.net:8883", 126 | "client_id": "[Your device name]", 127 | "topic": "devices/[Your device name]/messages/events/", 128 | "username": "[Your IoT Hub Name].azure-devices.net/[Your device name]", 129 | "password": "[Your device SAS token]" 130 | } 131 | } 132 | ``` 133 | 134 | ## Additional setup for Python\* 135 | 136 | When running your Python\* code on the Intel® Edison board or Intel® IoT Gateway, you need to use the MQTT\* interface by setting the client parameters. Add the following entries to the **config.json** file: 137 | 138 | ```json 139 | "services": { 140 | "mqtt": { 141 | "server": "[Your IoT Hub Name].azure-devices.net", 142 | "port": "8883", 143 | "client_id": "[Your device name]", 144 | "topic": "devices/[Your device name]/messages/events/", 145 | "username": "[Your IoT Hub Name].azure-devices.net/[Your device name]", 146 | "password": "[Your device SAS token]" 147 | } 148 | } 149 | ``` 150 | -------------------------------------------------------------------------------- /bluemix-mqtt.md: -------------------------------------------------------------------------------- 1 | # Connecting to IBM\* Bluemix\* Internet of Things using MQTT\* 2 | 3 | ## IBM\* Bluemix\* IoT initial setup 4 | 5 | 1. Create an account on http://www.ibm.com/cloud-computing/bluemix, if you do not yet have one. 6 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-create-account.png) 7 | 8 | 2. Log into your account. 9 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-login.png) 10 | 11 | 3. Select **New Dashboard** if that option is presented. 12 | 13 | ## Add an Internet of Things Platform 14 | 15 | 1. Go to your dashboard and click **Use Services or APIs** to add a new service. 16 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-use-service-api.png) 17 | 18 | 2. Click **Internet of Things Platform**. 19 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-internet-of-things-platform.png) 20 | 21 | 3. In the **Service name** field, type a name of your choosing. 22 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-service-name.png) 23 | 24 | 4. From the **Selected Plan** drop-down list, choose a pricing plan. 25 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-pricing-plan.png) 26 | 27 | 5. Click the **Create** button. 28 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-hit-create.png) 29 | 30 | ## Add a device type 31 | 32 | 1. Under **Connect your devices**, click the **Launch dashboard** button.
This opens a new **IBM Watson IoT Platform** window. 33 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-connect-launch.png) 34 | 35 | 2. On the **Device Types** tile, click the **Add Device** button. 36 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-add-device-click.png) 37 | 38 | 3. Click the **Create device type** button.
This opens the **Create Device Type** page. 39 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-create-device-type.png) 40 | 41 | 4. Click the **Create device type** button. 42 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-create-device-type2.png) 43 | 44 | 5. Fill the **Name** and **Description** fields and click **Next**. 45 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-name-description.png) 46 | 47 | 6. Specify the attributes for your template and click **Next**. 48 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-define-temp.png) 49 | 50 | 7. In the **Submit Information** step, click **Next**. 51 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-submit.png) 52 | 53 | 8. If necessary, add metadata and click **Create**. 54 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-meta.png) 55 | 56 | ## Add a device 57 | 58 | 1. From the **Choose Device Type** drop-down list, select the new device type you created in the previous section, and click **Next**. 59 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-add-device-2.png) 60 | 61 | 2. In the **Device ID** field, type the ID of your device and click **Next**. 62 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-device-id.png) 63 | 64 | 3. If necessary, add metadata and click **Next**. 65 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-meta2.png) 66 | 67 | 4. In the **Security** step, auto-generate an authentication token by clicking **Next**. 68 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-sec-autogen.png) 69 | 70 | 5. Click **Add**. 71 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-final-add.png) 72 | 73 | 6. Make a note of the **Authentication Token** displayed under **Your Device Credentials**. 74 | ![](https://github.com/hybridgroup/intel-iot-examples-mqtt/blob/master/images/ibm-bluemix/ibm-dont-lose-info.png) 75 | 76 | ## Summary 77 | 78 | If you have followed all the steps above, you should have all the information that your program needs to connect to the MQTT\* server: 79 | 80 | `hostname` - use `[Your organization ID].messaging.internetofthings.ibmcloud.com`, along with the `ssl://` (for C++) or `mqtts://` (for JavaScript*) protocol 81 | 82 | `client_id` - use `d:[Your organization ID]:[Your device type]:[Your device ID]` 83 | 84 | `topic` - use `iot-2/evt/status/fmt/json` 85 | 86 | `username` - use `use-token-auth` 87 | 88 | `password` - use the string with the authorization token of your device 89 | 90 | ## Additional setup for C++ 91 | 92 | When running your C++ code on the Intel® Edison board or Intel® IoT Gateway, you need to set the MQTT\* client parameters in Intel® System Studio\*. To do that: 93 | 94 | 1. Go to **Run configurations** and, in the **Commands to execute before application** field, type the following: 95 | 96 | export MQTT_SERVER="ssl://[Your organization ID].messaging.internetofthings.ibmcloud.com:8883"; export MQTT_CLIENTID="d:[Your organization ID]:[Your device type]:[Your device ID]"; export MQTT_USERNAME="use-token-auth"; export MQTT_PASSWORD="[Your authorization token]"; export MQTT_TOPIC="iot-2/evt/status/fmt/json" 97 | 98 | 2. Click the **Apply** button to save these settings. 99 | 3. Click the **Run** button to run the code on your board. 100 | 101 | ## Additional setup for JavaScript* 102 | 103 | When running your JavaScript\* code on the Intel® Edison board or Intel® IoT Gateway, you need to set the MQTT\* client parameters in the Intel® XDK IDE. Add the following entries to the **config.json** file: 104 | 105 | ```json 106 | "services": { 107 | "mqtt": { 108 | "hostname": "mqtts://[Your organization ID].messaging.internetofthings.ibmcloud.com:8883", 109 | "client_id": "d:[Your organization ID]:[Your device type]:[Your device ID]", 110 | "topic": "iot-2/evt/status/fmt/json", 111 | "username": "use-token-auth", 112 | "password": "[Your authorization token]" 113 | } 114 | } 115 | ``` 116 | 117 | ## Additional setup for Python\* 118 | 119 | When running your Python\* code on the Intel® Edison board or Intel® IoT Gateway, you need to use the MQTT\* interface by setting the client parameters. Add the following entries to the **config.json** file: 120 | 121 | ```json 122 | "services": { 123 | "mqtt": { 124 | "server": "[Your organization ID].messaging.internetofthings.ibmcloud.com", 125 | "port": "8883", 126 | "client_id": "d:[Your organization ID]:[Your device type]:[Your device ID]", 127 | "topic": "iot-2/evt/status/fmt/json", 128 | "username": "use-token-auth", 129 | "password": "[Your authorization token]" 130 | } 131 | } 132 | ``` 133 | -------------------------------------------------------------------------------- /cpp-mqtt.md: -------------------------------------------------------------------------------- 1 | # C++ additional setup 2 | 3 | ## Updating the MQTT\* C client library 4 | 5 | ### Updating the MQTT\* C client library on the Intel® Edison board 6 | 7 | To use MQTT\* with the how-to code examples, you need to update the Paho\* MQTT\* C client libraries on the Intel® Edison board. To do this: 8 | 9 | 1. Establish an SSH connection to your Intel® Edison board, and then run the following commands from the board: 10 | 11 | opkg install coreutils 12 | opkg remove paho-mqtt-dev 13 | opkg remove paho-mqtt --force-depends 14 | git clone https://github.com/eclipse/paho.mqtt.c.git 15 | cd paho.mqtt.c 16 | export prefix=/usr; make install 17 | 18 | 2. Log out from the SSH session using the `exit` command. 19 | 20 | ### Updating the MQTT\* C client library on the Intel® IoT Gateway. 21 | 22 | To use MQTT\* with the how-to code examples, you need to update the Paho\* MQTT\* C client libraries on the Intel® IoT Gateway. To do this: 23 | 24 | 1. Establish an SSH connection to your Intel® IoT Gateway, and then run the following commands from the gateway: 25 | 26 | smart install openssl-dev 27 | git clone https://github.com/eclipse/paho.mqtt.c.git 28 | cd paho.mqtt.c 29 | export prefix=/usr; make install 30 | 31 | 2. Log out from the SSH session using the `exit` command. 32 | 33 | ### Updating the MQTT\* C client library in Intel® System Studio. 34 | 35 | 1. First, connect to the Docker\* container that corresponds to the target platform you would like to build for. Determine the container ID by listing all of the current containers using the `docker ps` command. You should see output like the following: 36 | 37 | ``` 38 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 39 | 56d3928f0a67 inteliotdevkit/intel-iot-wrs-64:latest "bash" 5 days ago Up 33 minutes 0.0.0.0:32771->22/tcp intel-iot-wrs-64-workspace-iot1-160081000 40 | 4b91ecd3d1ad inteliotdevkit/intel-iot-yocto:latest "/bin/bash" 5 weeks ago Up 2 days 0.0.0.0:32769->22/tcp intel-iot-yocto-workspace-iot1-160081000 41 | \ 42 | ``` 43 | 44 | in this case, let's assume we want to connect to the `inteliotdevkit/intel-iot-wrs-64:latest` container. The **Container ID** for this container is `56d3928f0a67`. Attach to it as follows: 45 | 46 | docker exec -t -i 56d3928f0a67 /bin/bash 47 | 48 | This should bring up the bash prompt on the running container. 49 | 50 | 2. Now you should be able to run the following commands within the container: 51 | 52 | git clone https://github.com/eclipse/paho.mqtt.c.git 53 | cd paho.mqtt.c 54 | export prefix=/usr; make install 55 | 56 | 3. Once these commands have completed with the installation, you can exit the container by running the `exit` command. 57 | 58 | ## Updating the Websocketpp\* library 59 | 60 | ### Updating the Websocketpp\* library on the Intel® Edison board 61 | 62 | 1. Establish an SSH connection to your Intel® Edison board, and then run the following commands from the board: 63 | 64 | cd ~ 65 | git clone https://github.com/zaphoyd/websocketpp.git 66 | cd websocketpp 67 | cmake . 68 | make install 69 | 70 | ### Updating the Websocketpp\* library on the Intel® IoT Gateway. 71 | 72 | 1. First, check to see if you have CMake\* installed: 73 | 74 | cmake --version 75 | 76 | If CMake is already installed, you can skip to the next step. 77 | 78 | If you receive an error message, it means you need to install CMake. Run the following commands: 79 | 80 | cd ~ 81 | wget https://cmake.org/files/v2.8/cmake-2.8.12.tar.gz 82 | tar -zxvf cmake-2.8.12.tar.gz 83 | cd cmake-2.8.12 84 | ./bootstrap 85 | make 86 | make install 87 | 88 | 3. Now, install Websocketpp\* by running the following commands: 89 | 90 | cd ~ 91 | git clone https://github.com/zaphoyd/websocketpp.git 92 | cd websocketpp 93 | cmake . 94 | make install 95 | 96 | ### Updating the Websocketpp\* library in Intel® System Studio. 97 | 98 | 1. First, connect to the Docker\* container that corresponds to the target platform you would like to build for. Determine the container ID by listing all of the current containers using the `docker ps` command. You should see output like the following: 99 | 100 | ``` 101 | CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 102 | 56d3928f0a67 inteliotdevkit/intel-iot-wrs-64:latest "bash" 5 days ago Up 33 minutes 0.0.0.0:32771->22/tcp intel-iot-wrs-64-workspace-iot1-160081000 103 | 4b91ecd3d1ad inteliotdevkit/intel-iot-yocto:latest "/bin/bash" 5 weeks ago Up 2 days 0.0.0.0:32769->22/tcp intel-iot-yocto-workspace-iot1-160081000 104 | \ 105 | ``` 106 | 107 | in this case, let's assume we want to connect to the `inteliotdevkit/intel-iot-wrs-64:latest` container. The **Container ID** for this container is `56d3928f0a67`. Attach to it as follows: 108 | 109 | docker exec -t -i 56d3928f0a67 /bin/bash 110 | 111 | This should bring up the bash prompt so you can run commands within the container. 112 | 113 | 2. First, check to see if you have CMake\* installed: 114 | 115 | cmake --version 116 | 117 | If CMake is already installed, you can skip to the next step. 118 | 119 | If you receive an error message, it means you need to install CMake. Run the following commands: 120 | 121 | cd ~ 122 | wget https://cmake.org/files/v2.8/cmake-2.8.12.tar.gz 123 | tar -zxvf cmake-2.8.12.tar.gz 124 | cd cmake-2.8.12 125 | ./bootstrap 126 | make 127 | make install 128 | 129 | 3. Now, install Websocketpp\* by running the following commands: 130 | 131 | cd ~ 132 | git clone https://github.com/zaphoyd/websocketpp.git 133 | cd websocketpp 134 | cmake . 135 | make install 136 | -------------------------------------------------------------------------------- /images/att-m2x/click-create-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/click-create-device.png -------------------------------------------------------------------------------- /images/att-m2x/create-another.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/create-another.png -------------------------------------------------------------------------------- /images/att-m2x/define-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/define-device.png -------------------------------------------------------------------------------- /images/att-m2x/device-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/device-info.png -------------------------------------------------------------------------------- /images/att-m2x/generate-chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/generate-chart.png -------------------------------------------------------------------------------- /images/att-m2x/m2x-add-stream-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/m2x-add-stream-info.png -------------------------------------------------------------------------------- /images/att-m2x/m2x-add-stream.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/m2x-add-stream.png -------------------------------------------------------------------------------- /images/att-m2x/m2x-create-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/m2x-create-device.png -------------------------------------------------------------------------------- /images/att-m2x/m2x-devices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/m2x-devices.png -------------------------------------------------------------------------------- /images/att-m2x/m2x-signup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/m2x-signup.png -------------------------------------------------------------------------------- /images/att-m2x/name-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/name-project.png -------------------------------------------------------------------------------- /images/att-m2x/select-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/select-device.png -------------------------------------------------------------------------------- /images/att-m2x/signup-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/signup-info.png -------------------------------------------------------------------------------- /images/att-m2x/test-device-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/test-device-2.png -------------------------------------------------------------------------------- /images/att-m2x/test-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/test-device.png -------------------------------------------------------------------------------- /images/att-m2x/verify-email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/att-m2x/verify-email.png -------------------------------------------------------------------------------- /images/aws/aws-attach-cert-to-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-attach-cert-to-device.png -------------------------------------------------------------------------------- /images/aws/aws-create-account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-create-account.png -------------------------------------------------------------------------------- /images/aws/aws-create-attach-policy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-create-attach-policy.png -------------------------------------------------------------------------------- /images/aws/aws-create-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-create-device.png -------------------------------------------------------------------------------- /images/aws/aws-determine-endpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-determine-endpoint.png -------------------------------------------------------------------------------- /images/aws/aws-list-things.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-list-things.png -------------------------------------------------------------------------------- /images/aws/aws-provision-a-cert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-provision-a-cert.png -------------------------------------------------------------------------------- /images/aws/aws-verify-install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-verify-install.png -------------------------------------------------------------------------------- /images/aws/aws-win-path-setup1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-win-path-setup1.png -------------------------------------------------------------------------------- /images/aws/aws-win-path-setup10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-win-path-setup10.png -------------------------------------------------------------------------------- /images/aws/aws-win-path-setup2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-win-path-setup2.png -------------------------------------------------------------------------------- /images/aws/aws-win-path-setup3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-win-path-setup3.png -------------------------------------------------------------------------------- /images/aws/aws-win-path-setup4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-win-path-setup4.png -------------------------------------------------------------------------------- /images/aws/aws-win-path-setup5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-win-path-setup5.png -------------------------------------------------------------------------------- /images/aws/aws-win-path-setup6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-win-path-setup6.png -------------------------------------------------------------------------------- /images/aws/aws-win-path-setup7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-win-path-setup7.png -------------------------------------------------------------------------------- /images/aws/aws-win-path-setup8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-win-path-setup8.png -------------------------------------------------------------------------------- /images/aws/aws-win-path-setup9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-win-path-setup9.png -------------------------------------------------------------------------------- /images/aws/aws-winscp1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-winscp1.png -------------------------------------------------------------------------------- /images/aws/aws-winscp2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-winscp2.png -------------------------------------------------------------------------------- /images/aws/aws-winscp3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/aws/aws-winscp3.png -------------------------------------------------------------------------------- /images/azure/README.md: -------------------------------------------------------------------------------- 1 | Put screenshot images for Azure here. Please name them all lower case, no spaces, aka add-device.png 2 | -------------------------------------------------------------------------------- /images/azure/create-free-account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/azure/create-free-account.png -------------------------------------------------------------------------------- /images/azure/create-new-device-curl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/azure/create-new-device-curl.png -------------------------------------------------------------------------------- /images/azure/create-new-iot-hub-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/azure/create-new-iot-hub-2.png -------------------------------------------------------------------------------- /images/azure/create-new-iot-hub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/azure/create-new-iot-hub.png -------------------------------------------------------------------------------- /images/azure/device-sas-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/azure/device-sas-example.png -------------------------------------------------------------------------------- /images/azure/list-devices-curl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/azure/list-devices-curl.png -------------------------------------------------------------------------------- /images/azure/obtain-sas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/azure/obtain-sas.png -------------------------------------------------------------------------------- /images/azure/sas-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/azure/sas-example.png -------------------------------------------------------------------------------- /images/azure/sign-in-to-azure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/azure/sign-in-to-azure.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-add-device-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-add-device-2.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-add-device-click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-add-device-click.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-connect-launch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-connect-launch.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-create-account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-create-account.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-create-device-type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-create-device-type.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-create-device-type2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-create-device-type2.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-define-temp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-define-temp.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-device-id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-device-id.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-dont-lose-info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-dont-lose-info.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-final-add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-final-add.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-hit-create.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-hit-create.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-internet-of-things-platform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-internet-of-things-platform.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-login.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-meta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-meta.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-meta2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-meta2.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-name-description.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-name-description.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-pricing-plan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-pricing-plan.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-sec-autogen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-sec-autogen.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-service-name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-service-name.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-submit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-submit.png -------------------------------------------------------------------------------- /images/ibm-bluemix/ibm-use-service-api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/ibm-bluemix/ibm-use-service-api.png -------------------------------------------------------------------------------- /images/predix/predix-signup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/predix/predix-signup.png -------------------------------------------------------------------------------- /images/predix/predix-toolkit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/predix/predix-toolkit.png -------------------------------------------------------------------------------- /images/sap/sap-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/sap/sap-device.png -------------------------------------------------------------------------------- /images/sap/sap-http-access-log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/sap/sap-http-access-log.png -------------------------------------------------------------------------------- /images/sap/sap-iotmms-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/sap/sap-iotmms-dashboard.png -------------------------------------------------------------------------------- /images/sap/sap-message-type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/sap/sap-message-type.png -------------------------------------------------------------------------------- /images/sap/sap-signup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/images/sap/sap-signup.png -------------------------------------------------------------------------------- /installing-cygwin.md: -------------------------------------------------------------------------------- 1 | #Installing Cygwin\* on Windows* 2 | 3 | 1. Go to https://cygwin.com. 4 | ![](https://raw.githubusercontent.com/intel-iot-devkit/how-to-code-samples/master/images/cpp/shell-script.png) 5 | 6 | 2. In the pane on the left, click **Install Cygwin**. 7 | ![](https://raw.githubusercontent.com/intel-iot-devkit/how-to-code-samples/master/images/cpp/shell-script2.png) 8 | 9 | 3. Download and run the executable file.
10 | ![](https://raw.githubusercontent.com/intel-iot-devkit/how-to-code-samples/master/images/cpp/shell-script3.png) 11 | 12 | **Important:** Use the default installation settings. Otherwise, if you install all the packages, it takes up to several gigabytes of free space. 13 | 14 | 4. Go to Windows\* **Control Panel** and click **System**. 15 | ![](https://raw.githubusercontent.com/intel-iot-devkit/how-to-code-samples/master/images/cpp/shell-script5.png) 16 | 17 | 5. Click **Advanced system settings**. 18 | ![](https://raw.githubusercontent.com/intel-iot-devkit/how-to-code-samples/master/images/cpp/shell-script6.png) 19 | 20 | 6. On the **Advanced** tab, click **Environment Variables**.
21 | ![](https://raw.githubusercontent.com/intel-iot-devkit/how-to-code-samples/master/images/cpp/shell-script7.png) 22 | 23 | 7. In the **System variables** box, double-click **Path**.
24 | ![](https://raw.githubusercontent.com/intel-iot-devkit/how-to-code-samples/master/images/cpp/shell-script8.png) 25 | 26 | 8. In the **Variable value** field, add the full path to the Cygwin\* installation directory (for example, `C\cygwin64\bin`) at the end of the line.
27 | ![](https://raw.githubusercontent.com/intel-iot-devkit/how-to-code-samples/master/images/cpp/shell-script9.png) 28 | 29 | **Note:** Do not forget to add a semicolon (;) before the value to separate it from the other values. 30 | 31 | Now you can use Linux\*/Unix\* commands in Windows\* Command Prompt. 32 | -------------------------------------------------------------------------------- /js-mqtt.md: -------------------------------------------------------------------------------- 1 | # JavaScript MQTT* setup 2 | 3 | To use MQTT\* with the how-to code examples, the Intel® XDK IoT Edition will automatically install the JavaScript client libraries on the Intel® Edison board. No additional steps are required. 4 | -------------------------------------------------------------------------------- /m2x-mqtt.md: -------------------------------------------------------------------------------- 1 | # Connecting to AT&T\* M2X\* IoT using MQTT\* 2 | 3 | ## AT&T\* M2X\* IoT initial signup 4 | 5 | 1. Create an account on https://m2x.att.com, if you do not yet have one. If you already have an account, you can skip directly to "Adding your first device" below. 6 | ![](./images/att-m2x/m2x-signup.png) 7 | 8 | 2. Fill out your information when signing up. 9 | ![](./images/att-m2x/signup-info.png) 10 | 11 | 3. Verify your email address by clicking the link in the email recieved by AT&T\*. (Be sure to check your spam folder, the verification is requred to continue.) 12 | ![](./images/att-m2x/verify-email.png) 13 | 14 | ## Adding your first device 15 | 16 | If you have a brand new account, and are adding your very first device, follow these instructions. Otherwise, skip to "Adding another device" 17 | 18 | 1. Click on the "Devices" link on the top of the page to navigate to the "Devices" page, then click on the "Create Device" 19 | ![](./images/att-m2x/click-create-device.png) 20 | 21 | 1. Select the "Select Device" button. 22 | ![](./images/att-m2x/select-device.png) 23 | 24 | 2. Define your device. Select "other" in the select your device dropdown box. Then continue to define your device. Make sure that you create a new Stream at the same time that you create your device. 25 | ![](./images/att-m2x/define-device.png) 26 | 27 | ## Adding another device 28 | 29 | If you have an existing account, and are adding another device, follow these instructions. 30 | 31 | 1. Click on the "Devices" link on the top of the page to navigate to the "Devices" page. 32 | ![](./images/att-m2x/m2x-devices.png) 33 | 34 | 2. Click on the "Create New" dropdown, and choose "Device" to display the "Create Device" dialog. Complete the needed information, then click on "Create" to define your device: 35 | ![](./images/att-m2x/m2x-create-device.png) 36 | 37 | Next, add a stream for your new device. 38 | 39 | ## Adding a Stream 40 | 41 | 1. Click on the link for your new Device from the "Devices" page, then scroll down and click on the "Add Stream" button: 42 | ![](./images/att-m2x/m2x-add-stream.png) 43 | 44 | 1. Now enter all of the needed information for your new stream: 45 | ![](./images/att-m2x/m2x-add-stream-info.png) 46 | 47 | ## Testing your device (optional) 48 | 49 | If you want to test your new device using the cURL command, follow these instructions. 50 | 51 | 1. Copy the cURL command and click the "generate my chart" button. 52 | ![](./images/att-m2x/test-device.png) 53 | 54 | 2. Paste the cURL command into your command line interface connected to your device and run the command. 55 | ![](./images/att-m2x/test-device-2.png) 56 | 57 | You should now see a chart with the information you entered via the curl command on the new chart. 58 | ![](./images/att-m2x/generate-chart.png) 59 | 60 | When you now log into AT&T M2X platform you will now be able to view all of your device information. 61 | ![](./images/att-m2x/device-info.png) 62 | 63 | ## Summary 64 | 65 | If you have followed all the required steps above, you should have all the information that your program needs to connect to the M2X server: 66 | 67 | - `API_KEY` - set to ``. 68 | 69 | - `DEVICE_ID` - set to ``. 70 | 71 | - `STREAM_ID` - set to ``. 72 | 73 | ## Additional setup for C++ 74 | 75 | When running your C++ code on the Intel® Edison board or Intel® IoT Gateway, you need to set the M2X client parameters in Intel® System Studio. To do that: 76 | 77 | 1. Go to **Run configurations** and, in the **Commands to execute before application** field, type the following: 78 | 79 | export M2X_API_KEY="[M2X API Key]"; export M2X_DEVICE_ID="[M2X Device ID]"; export M2X_STREAM_ID="[M2X Stream ID]" 80 | 81 | 2. Click the **Apply** button to save these settings. 82 | 3. Click the **Run** button to run the code on your board. 83 | 84 | ## Additional setup for JavaScript\* 85 | 86 | When running your JavaScript\* code on the Intel® Edison board or Intel® IoT Gateway, you need to set the M2X\* client parameters in the Intel® XDK IDE. Add the following entries to the **config.json** file: 87 | 88 | ```json 89 | "services": { 90 | "m2x": { 91 | "api_key": "[M2X Primary API Key]", 92 | "device_id": "[M2X Device ID]", 93 | "stream_id": "[M2X Stream ID]" 94 | } 95 | } 96 | ``` 97 | 98 | ## Additional setup for Python\* 99 | 100 | When running your Python\* code on the Intel® Edison board or Intel® IoT Gateway, you need to set the M2X client parameters on the board itself. Add the following entries to the **config.json** file: 101 | 102 | ```json 103 | "services": { 104 | "m2x": { 105 | "api_key": "[M2X Primary API Key]", 106 | "device_id": "[M2X Device ID]", 107 | "stream_id": "[M2X Stream ID]" 108 | } 109 | } 110 | ``` 111 | -------------------------------------------------------------------------------- /predix-iot.md: -------------------------------------------------------------------------------- 1 | # Connecting to Predix\* from GE IoT 2 | 3 | To get started using Predix\* from GE IoT (https://www.predix.io/), you must first setup your development machine. These instructions follow the "Development machine configurations and step-by-step to building Predix Application and Services" steps listed at https://github.com/PredixDev/predix-scripts#development-machine-configurations-and-step-by-step-to-building-predix-application-and-services 4 | 5 | ## Register for a Predix\* account 6 | 7 | First, signup for a Predix\* Developer account. 8 | 9 | Follow the [registration instructions](https://docs.predix.io/en-US/content/platform/get_started/get_started_for_predix_developers/predix-development-environment-setup#task_a0b9d32e-24ff-4c84-a210-713527bce17c). 10 | 11 | If you already have an account, you can skip to the next step. 12 | 13 | ![](./images/predix/predix-signup.png) 14 | 15 | ## Install the Cloud Foundry\* Command Line Tool 16 | 17 | Now, install the Cloud Foundry\* Command Line Tool. 18 | 19 | Follow the installation instructions from the [Cloud Foundry Downloads](https://github.com/cloudfoundry/cli#downloads). 20 | 21 | If you already have installed it, you can skip to the next step. 22 | 23 | ## Install Maven\* 24 | 25 | Now, install the Maven\* Command Line Tool. 26 | 27 | https://docs.predix.io/en-US/content/platform/get_started/get_started_for_predix_developers/installing-the-maven-build-tool 28 | 29 | If you already have installed it, you can skip to the next step. 30 | 31 | ## Predix\* setup 32 | 33 | 1. Clone the predix-scripts repository 34 | 35 | Use git to clone the Predix\* repository that contains the setup scripts, as follows: 36 | 37 | ``` 38 | git clone https://github.com/PredixDev/predix-scripts.git 39 | cd predix-scripts 40 | ``` 41 | 42 | 2. Edit the variables file 43 | 44 | Use your text editor to open and modify the file `/bash/scripts/variables.sh` to enter your account's UAA configuration data for the following values: 45 | 46 | ``` 47 | # The username of the new user to authenticate with the application 48 | UAA_USER_NAME="" 49 | 50 | # The email address of username above 51 | UAA_USER_EMAIL="" 52 | 53 | # The password of the user above 54 | UAA_USER_PASSWORD="" 55 | 56 | # The secret of the Admin client ID (Administrator Credentails) 57 | UAA_ADMIN_SECRET="" 58 | 59 | # The generic client ID that will be created with necessary UAA scope/autherities 60 | UAA_CLIENTID_GENERIC="" 61 | 62 | # The generic client ID password 63 | UAA_CLIENTID_GENERIC_SECRET="" 64 | ``` 65 | 66 | For UAA_USER_NAME, UAA_USER_EMAIL, and UAA_USER_PASSWORD you must enter the same values that match those for your Predix account. 67 | 68 | Note that for UAA_ADMIN_SECRET, UAA_CLIENTID_GENERIC, and UAA_CLIENTID_GENERIC_SECRET you should enter values of your own choosing, since those accounts will be created as part of provisioning your new app. 69 | 70 | 3. Create application and services 71 | 72 | Now you are ready to run the script that creates your Predix\* application and all needed services. Run the following command: 73 | 74 | ``` 75 | ./bash/quickstart.sh -cs 76 | ``` 77 | 78 | Once the script is done, it will have created the application in the Predix\* cloud, and deployed all needed service. You can now obtain all of the information you need to connect your device to the Predix\* service, by looking in the `bash/log/predix-services-summary.txt` file. 79 | 80 | ## Summary 81 | 82 | If you have followed all the steps above, you should now have all the information that your program needs to connect to Predix\*: 83 | 84 | `uaa_client_id` - The UAA Client ID for your account 85 | 86 | `uaa_client_secret` - The UAA client secret 87 | 88 | `uaa_url` - Which UAA URL to use 89 | 90 | `timeseries_zone_id` - timeseries zone id 91 | 92 | `timeseries_ingest_url` - timeseries ingestion url 93 | 94 | ## Additional setup for C++ 95 | 96 | When running your C++ code on the Intel® Edison board or Intel® IoT Gateway, you will need to install the "websocketspp" client libraries, add the "USE_PREDIX_SERVICE" symbol, and create and use a run configuration with the needed parameters. 97 | 98 | ### Install the "websocketspp" client libraries 99 | 100 | To install the "websocketspp" client libraries, follow the instructions at: 101 | [https://github.com/intel-iot-devkit/iot-samples-cloud-setup/blob/master/cpp-mqtt.md](https://github.com/intel-iot-devkit/iot-samples-cloud-setup/blob/master/cpp-mqtt.md) 102 | 103 | ### Add the USE_PREDIX_SERVICE symbol 104 | 105 | 1. From the main menu, select **Project > Properties** dialog box is displayed. 106 | ![](./../../images/cpp/click-project-properties.png) 107 | 2. Expand the section **C/C++ General**.
Click on the **Paths and Symbols** sub-section, and click on the **Symbols** tab. 108 | ![](./../../images/cpp/click-gen-path-symbols.png) 109 | 3. Now click on **GNU C++**, and click on the **Add** button. 110 | ![](./../../images/cpp/click-gnupp-add.png) 111 | 4. In the **Name** field, enter "USE_PREDIX_SERVICE". Leave the **Value** field blank. 112 | ![](./../../images/cpp/add-name-and-var.png) 113 | 5. Your new name symbol will now be displayed. Click **OK**. 114 | ![](./../../images/cpp/name-var-ok.png) 115 | 116 | ### Use a run configuration 117 | 118 | 1. Go to **Run configurations** and, in the **Commands to execute before application** field, type the following: 119 | 120 | export PREDIX_UAA_CLIENT_ID="[uaa client id]"; export PREDIX_UAA_CLIENT_SECRET="[uaa client secret]"; export PREDIX_UAA_URL="[uaa url]"; export PREDIX_TIMESERIES_ZONE_ID="[timeseries zone id]"; export PREDIX_TIMESERIES_INGEST_URL="[timeseries ingest url]" 121 | 122 | 2. Click the **Apply** button to save these settings. 123 | 3. Click the **Run** button to run the code on your board. 124 | 125 | ## Additional setup for JavaScript\* 126 | 127 | When running your JavaScript\* code on the Intel® Edison board or Intel® IoT Gateway, you need to use the WebSockets interface, by setting the client parameters in the Intel® XDK IDE. Add the following entries to the **config.json** file: 128 | 129 | ```json 130 | "services": { 131 | "predix": { 132 | "uaa_client_id": "", 133 | "uaa_client_secret": "", 134 | "uaa_url": "", 135 | "timeseries_zone_id": "", 136 | "timeseries_ingest_url": "l" 137 | } 138 | } 139 | ``` 140 | 141 | ## Additional setup for Python\* 142 | 143 | When running your Python\* code on the Intel® Edison board or Intel® IoT Gateway, you need to use the WebSockets interface, by setting the client parameters. Add the following entries to the **config.json** file: 144 | 145 | ```json 146 | "services": { 147 | "predix": { 148 | "uaa_client_id": "", 149 | "uaa_client_secret": "", 150 | "uaa_url": "", 151 | "timeseries_zone_id": "", 152 | "timeseries_ingest_url": "l" 153 | } 154 | } 155 | ``` 156 | 157 | ## Viewing data for debugging 158 | 159 | You can view data for debugging by using the Predix\* Tool Kit. 160 | 161 | 1. Go to [https://www.predix.io/predix-env/predix-toolkit](https://www.predix.io/predix-env/predix-toolkit) 162 | 163 | ![](./images/predix/predix-toolkit.png) 164 | 165 | 2. Login to your account, using the "Login as Client" link. Enter the UAA URL, client ID, and client secret that you obtained when you created your Predix\* application. 166 | 167 | 3. Click on "Time Series Query" link. 168 | 169 | 4. Select "Latest Datapoints Request" from the "Choose Request" dropdown. Enter the "predix-zone-id" that you obtained when you created your Predix\* application. In the "Request Body" change the value "Compressor-2015:CompressionRatio" to "sensor-data". 170 | 171 | 5. Click on the "Submit" button, and the most recent data should be displayed. 172 | 173 | ## Deleting Your Sample App 174 | 175 | You can delete your sample Predix\* application using the following commands. 176 | 177 | First, obtain the name of your application's "space" by running: 178 | 179 | ``` 180 | cf spaces 181 | ``` 182 | 183 | Determine which space name you want to delete. Then run the following command: 184 | 185 | ``` 186 | cf delete-space [name] 187 | ``` 188 | 189 | where [name] should be replaced with the name of the space you want to delete. 190 | 191 | BE CAREFUL: deleting a space is permanent and your data cannot be recovered. 192 | -------------------------------------------------------------------------------- /sap-iot.md: -------------------------------------------------------------------------------- 1 | # Connecting to SAP Cloud Platform\* Internet of Things 2 | 3 | To get started using the SAP\* IoT Starter Kit, you must first setup your account, by following the "Getting Started in the Cloud" steps listed at https://github.com/SAP/iot-starterkit#getting-started-in-the-cloud 4 | 5 | ## SAP Cloud Platform\* Developer signup 6 | 7 | ![](./images/sap/sap-signup.png) 8 | 9 | First, signup for an SAP Cloud Platform\* Developer account. If you already have an account, you can skip to the next step. 10 | 11 | Otherwise following the instructions at: 12 | [https://github.com/SAP/iot-starterkit/tree/master/src/prerequisites/account](https://github.com/SAP/iot-starterkit/tree/master/src/prerequisites/account) 13 | 14 | ## SAP\* IoT setup 15 | 16 | 1. Login to SAP 17 | 18 | Login to your SAP Cloud Platform Cockpit at [https://account.hanatrial.ondemand.com](https://account.hanatrial.ondemand.com) 19 | 20 | 2. Enable Internet of Things 21 | 22 | Next, enable the "Internet of Things" in your SAP Cloud Platform Cockpit. 23 | 24 | Follow the instructions at: 25 | [https://github.com/SAP/iot-starterkit/tree/master/src/prerequisites/service](https://github.com/SAP/iot-starterkit/tree/master/src/prerequisites/service) 26 | 27 | 3. Create Device Information in Internet of Things Cockpit 28 | 29 | To complete the needed prerequisites, you need to follow the following 3 steps: 30 | - Create a Message Type 31 | - Create a Device Type 32 | - Create a Device, and copy the generated Device Token. This is will be needed later to connect the Device. 33 | 34 | Follow the instructions at: 35 | [https://github.com/SAP/iot-starterkit/tree/master/src/prerequisites/cockpit](https://github.com/SAP/iot-starterkit/tree/master/src/prerequisites/cockpit) 36 | 37 | 3. Deploy the Message Management Service (MMS) 38 | 39 | Once the configuration is defined, the last step is to deploy the Message Management Service. Make sure that you perform role assignment of the `iotmms` application to your user account. 40 | 41 | Follow the instructions located at: 42 | [https://github.com/SAP/iot-starterkit/src/prerequisites/mms](https://github.com/SAP/iot-starterkit/tree/master/src/prerequisites/mms) 43 | 44 | ## Summary 45 | 46 | If you have followed all the steps above, you should have all the information that your program needs to connect to the SAP Cloud Platform Internet of Things: 47 | 48 | ![](./images/sap/sap-iotmms-dashboard.png) 49 | 50 | `application_url` - The MMS endpoint application for your account. Located on the Java\* Application Dashboard of your account for the SAP\* Cloud Platform cockpit. 51 | 52 | ![](./images/sap/sap-device.png) 53 | 54 | `device_id` - The device ID for the device you want to connect. Located on the Internet of Things Service Cockpit "Devices" page. 55 | 56 | `oauth_token` - OAuth token for the device. This is the generated Device Token from the original setup. You can regenerate the token if needed on the Internet of Things Service Cockpit "Devices" page, using the "Authentication" tab for the device. 57 | 58 | ![](./images/sap/sap-message-type.png) 59 | 60 | `message_type_id` - OutboundMessage Type ID. Located on the Internet of Things Service Cockpit "Message Types" page. 61 | 62 | ## Additional setup for C++ 63 | 64 | When running your C++ code on the Intel® Edison board or Intel® IoT Gateway, you will need to use the RESTful client interface by setting the correct parameters in Eclipse\*. To do that: 65 | 66 | 1. Go to **Run configurations** and, in the **Commands to execute before application** field, type the following: 67 | 68 | export SAP_MMS_ENDPOINT="[application_url]/v1/api/http/data"; export SAP_DEVICE_ID="[device_id]"; export SAP_MESSAGE_TYPE_ID="[message_type_id]"; export SAP_OAUTH_TOKEN="[oauth_token]" 69 | 70 | 2. Click the **Apply** button to save these settings. 71 | 3. Click the **Run** button to run the code on your board. 72 | 73 | ## Additional setup for JavaScript\* 74 | 75 | When running your JavaScript\* code on the Intel® Edison board or Intel® IoT Gateway, you need to use the REST interface, by setting the client parameters in the Intel® XDK IDE. Add the following entries to the **config.json** file: 76 | 77 | ```json 78 | "services": { 79 | "sap": { 80 | "mms_endpoint": "[application_url]/v1/api/http/data", 81 | "device_id": "[device id]", 82 | "message_type_id": "[OutboundMessage Type Id]", 83 | "oauth_token": "[oauth token]" 84 | } 85 | } 86 | ``` 87 | 88 | ## Additional setup for Python\* 89 | 90 | When running your Python\* code on the Intel® Edison board or Intel® IoT Gateway, you need to use the REST interface, by setting the client parameters. Add the following entries to the **config.json** file: 91 | 92 | ```json 93 | "services": { 94 | "sap": { 95 | "mms_endpoint": "[application_url]/v1/api/http/data", 96 | "device_id": "[device id]", 97 | "message_type_id": "[OutboundMessage Type Id]", 98 | "oauth_token": "[oauth token]" 99 | } 100 | } 101 | ``` 102 | 103 | ## Viewing data for debugging 104 | 105 | You can monitor the state of the Message Management Service application deployed in the Java Application Dashboard of your account for the SAP Cloud Platform cockpit. 106 | 107 | ![](./images/sap/sap-iotmms-dashboard.png) 108 | 109 | 1. Login to your SAP Cloud Platform Cockpit at [https://account.hanatrial.ondemand.com](https://account.hanatrial.ondemand.com) 110 | 111 | 2. Click on "Applications", then click on "Java Applications". This will display a new page with the list of Java applications. 112 | 113 | 3. Click on the name "iotmms" in the list of applications. This will open the "iotmms - Overview" page. 114 | 115 | 4. Scroll down the page to the section labeled "Most Recent Logging". Click on the eyeglasses icon next to the "HTTP Access Logs" log you want to view, and the most recent data should be displayed in a new tab. 116 | 117 | ![](./images/sap/sap-http-access-log.png) 118 | -------------------------------------------------------------------------------- /support/aws/aws-device-policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2012-10-17", 3 | "Statement": [{ 4 | "Effect": "Allow", 5 | "Action":["iot:*"], 6 | "Resource": ["*"] 7 | }] 8 | } 9 | -------------------------------------------------------------------------------- /support/azure/build/linux/sastoken: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/support/azure/build/linux/sastoken -------------------------------------------------------------------------------- /support/azure/build/osx/sastoken: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/support/azure/build/osx/sastoken -------------------------------------------------------------------------------- /support/azure/build/windows/sastoken.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel-iot-devkit/iot-samples-cloud-setup/c8caa588ec8c04bd561847933abab5bae2027aec/support/azure/build/windows/sastoken.exe -------------------------------------------------------------------------------- /support/azure/sastoken.go: -------------------------------------------------------------------------------- 1 | // Golang command line utility to generate an Microsoft Azure SAS token for use 2 | // with the MS Azure IoT Hub. 3 | // 4 | // USAGE: USAGE: sastoken [policy] 5 | // 6 | // Copyright © 2016 The Hybrid Group (http://hybridgroup.com) 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the “Software”), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | // SOFTWARE. 25 | 26 | package main 27 | 28 | import ( 29 | "crypto/hmac" 30 | "crypto/sha256" 31 | "encoding/base64" 32 | "fmt" 33 | "log" 34 | "os" 35 | "strconv" 36 | "text/template" 37 | "time" 38 | ) 39 | 40 | func ComputeHmac256(message string, secret string) string { 41 | data, _ := base64.StdEncoding.DecodeString(secret) 42 | key := []byte(data) 43 | h := hmac.New(sha256.New, key) 44 | h.Write([]byte(message)) 45 | return base64.StdEncoding.EncodeToString(h.Sum(nil)) 46 | } 47 | 48 | func GenerateSasToken(resourceUri string, signingKey string, expiresInMins string, policyName string) string { 49 | uri := template.URLQueryEscaper(resourceUri) 50 | 51 | duration, _ := strconv.Atoi(expiresInMins) 52 | expire := time.Now().Add(time.Duration(duration) * time.Minute) 53 | secs := expire.Unix() 54 | signed := uri + "\n" + strconv.FormatInt(secs, 10) 55 | 56 | val := ComputeHmac256(signed, signingKey) 57 | encoded_val := template.URLQueryEscaper(val) 58 | 59 | token := "SharedAccessSignature sr=" + uri + "&sig=" + encoded_val + "&se=" + strconv.FormatInt(secs, 10) 60 | if len(policyName) > 0 { 61 | token += "&skn=" + policyName 62 | } 63 | 64 | return token 65 | } 66 | 67 | func main() { 68 | if len(os.Args) < 4 { 69 | log.Fatal("USAGE: sastoken [policy]") 70 | } 71 | 72 | policy := "" 73 | if len(os.Args) == 5 { 74 | policy = os.Args[4] 75 | } 76 | 77 | token := GenerateSasToken(os.Args[1], os.Args[2], os.Args[3], policy) 78 | fmt.Println(token) 79 | } 80 | --------------------------------------------------------------------------------