Skip to content

yarodevuci/IoTSwiftApp

Repository files navigation

The Amazon IoT Temperature Control Sample

This sample demonstrates use of the AWS IoT MQTT device shadow APIs over a WebSocket. It works in conjunction with the Temperature Control Example Program in the AWS IoT JavaScript SDK for Embedded Devices.

Requirements

  • Xcode 7 and later
  • iOS 8 and later

Using the Sample

  1. The AWS Mobile SDK for iOS is available through CocoaPods. If you have not installed CocoaPods, install CocoaPods:

     sudo gem install cocoapods
     pod setup
    
  2. To install the AWS Mobile SDK for iOS, simply add the following line to your Podfile:

     pod 'AWSIoT'
    

    Then run the following command:

     pod install
    
  3. In the Amazon IAM console, use Amazon IAM to create a new user. Obtain the Access Key ID and Secret Access Key constants. Make sure the policy attached to the user has full permissions to access the AWS IoT APIs, as shown in this example:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iot:*"
            ],
            "Resource": "*"
       }
    ]
}
  1. Open IoTTemperatureControlSample.xcworkspace.

  2. Open Constants.swift and update the following lines with the appropriate constants:

let AwsRegion = AWSRegionType.Unknown // e.g. AWSRegionType.USEast1
let IamAccessKeyId = "YourIAMAccessKeyId"
let IamSecretAccessKey = "YourIAMSecretAccessKey"

Note that the use of hard-coded IAM user credentials is not recommended for production applications.

  1. Install the AWS IoT JavaScript SDK for Embedded Devices.

  2. Follow the instructions in the AWS IoT JavaScript SDK for Embedded Devices to install depenedencies for the temperature-control example application.

  3. Start the AWS IoT JavaScript SDK for Embedded Devices temperature-control example application using '--test-mode=2' to simulate a temperature control device.

  4. Build and run the sample app.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published