O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning Internet of Things

Book Description

Explore and learn about Internet of Things with the help of engaging and enlightening tutorials designed for Raspberry Pi

In Detail

This book starts by exploring the popular HTTP, UPnP, CoAP, MQTT, and XMPP protocols. You will learn how protocols and patterns can put limitations on network topology and how they affect the direction of communication and the use of firewalls. Thing registries and delegation of trust are introduced as important tools to secure the life cycle of Things on the Internet. Once the fundamentals have been mastered, your focus will move to the Internet of Things architecture. A secure architecture is proposed that will take full advantage of the power of Internet of Things and at the same time protect end user integrity and private personal data without losing flexibility and interoperability.

This book provides you with a practical overview of the existing protocols, communication patterns, architectures, and security issues important to Internet of Things.

What You Will Learn

  • Know the capabilities and limitations of the HTTP, UPnP, CoAP, MQTT, and XMPP protocols
  • Use important communication patterns, such as the request/respond, publish/subscribe, event subscription, asynchronous messaging, and multicasting patterns
  • Secure the life cycle of Things on the Internet by using Thing registries and delegation of trust
  • Decrease complexity and development time by using Internet of Things service platforms
  • Understand basic threats on the Internet and implement effective counter measures
  • Combine interoperability and security to create open yet secure solutions
  • Implement secure, scalable, decentralized, and interoperable architectures and solutions for Internet of Things

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Learning Internet of Things
    1. Table of Contents
    2. Learning Internet of Things
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. A definition for Internet of Things
      2. Competing definitions
      3. Direct consequences
      4. What this book covers
      5. What you need for this book
      6. Who this book is for
      7. Conventions
      8. Reader feedback
      9. Customer support
      10. Downloading the example code
        1. Viewing or downloading the online appendices
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Preparing our IoT Projects
      1. Creating the sensor project
        1. Preparing Raspberry Pi
        2. Clayster libraries
        3. Hardware
        4. Interacting with our hardware
        5. Interfacing the hardware
        6. Internal representation of sensor values
        7. Persisting data
        8. External representation of sensor values
        9. Exporting sensor data
      2. Creating the actuator project
        1. Hardware
        2. Interfacing the hardware
      3. Creating a controller
        1. Representing sensor values
        2. Parsing sensor data
        3. Calculating control states
      4. Creating a camera
        1. Hardware
        2. Accessing the serial port on Raspberry Pi
        3. Interfacing the hardware
        4. Creating persistent default settings
        5. Adding configurable properties
        6. Persisting the settings
        7. Working with the current settings
        8. Initializing the camera
      5. Summary
    9. 2. The HTTP Protocol
      1. HTTP basics
      2. Adding HTTP support to the sensor
        1. Setting up an HTTP server on the sensor
        2. Setting up an HTTPS server on the sensor
        3. Adding a root menu
        4. Displaying measured information in an HTML page
        5. Generating graphics dynamically
        6. Creating sensor data resources
        7. Interpreting the readout request
        8. Testing our data export
        9. User authentication
        10. Adding events for enhanced network performance
      3. Adding HTTP support to the actuator
        1. Creating the web services resource
        2. Accessing individual outputs
        3. Collective access to outputs
        4. Accessing the alarm output
        5. Using the test form
        6. Accessing WSDL
        7. Using the REST web service interface
      4. Adding HTTP support to the controller
        1. Subscribing to events
        2. Creating the control thread
        3. Controlling the actuator
      5. Summary
    10. 3. The UPnP Protocol
      1. Introducing UPnP
        1. Providing a service architecture
        2. Documenting device and service capabilities
      2. Creating a device description document
        1. Choosing a device type
        2. Being friendly
        3. Providing the device with an identity
        4. Adding icons
        5. Adding references to services
        6. Topping off with a URL to a web presentation page
      3. Creating the service description document
        1. Adding actions
        2. Adding state variables
        3. Adding a unique device name
      4. Providing a web interface
      5. Creating a UPnP interface
        1. Registering UPnP resources
        2. Replacing placeholders
        3. Adding support for SSDP
        4. Notifying the network
        5. Responding to searches
      6. Implementing the Still Image service
        1. Initializing evented state variables
        2. Providing web service properties
        3. Adding service properties
        4. Adding actions
      7. Using our camera
        1. Setting up UPnP
        2. Discovering devices and services
        3. Subscribing to events
        4. Receiving events
        5. Executing actions
      8. Summary
    11. 4. The CoAP Protocol
      1. Making HTTP binary
        1. Finding development tools
      2. Adding CoAP to our sensor
        1. Defining our first CoAP resources
        2. Manually triggering an event notification
        3. Registering data readout resources
        4. Returning XML
        5. Returning JSON
        6. Returning plain text
        7. Discovering CoAP resources
        8. Testing our CoAP resources
      3. Adding CoAP to our actuator
        1. Defining simple control resources
        2. Parsing the URL in CoAP
        3. Controlling the output using CoAP
      4. Using CoAP in our controller
        1. Monitoring observable resources
        2. Receiving notifications
        3. Performing control actions
      5. Summary
    12. 5. The MQTT Protocol
      1. Publishing and subscribing
      2. Adding MQTT support to the sensor
        1. Controlling the thread life cycle
        2. Flagging significant events
        3. Connecting to the MQTT server
        4. Publishing the content
      3. Adding MQTT support to the actuator
        1. Initializing the topic content
        2. Subscribing to topics
        3. Receiving the published content
        4. Decoding and parsing content
      4. Adding MQTT support to the controller
        1. Handling events from the sensor
        2. Decoding and parsing sensor values
        3. Subscribing to sensor events
        4. Controlling the actuator
          1. Controlling the LED output
          2. Controlling the alarm output
      5. Summary
    13. 6. The XMPP Protocol
      1. XMPP basics
        1. Federating for global scalability
        2. Providing a global identity
        3. Authorizing communication
        4. Sensing online presence
        5. Using XML
        6. Communication patterns
        7. Extending XMPP
        8. Connecting to a server
        9. Provisioning for added security
      2. Adding XMPP support to a thing
        1. Connecting to the XMPP network
        2. Monitoring connection state events
        3. Notifying your friends
        4. Handling HTTP requests over XMPP
      3. Providing an additional layer of security
        1. The basics of provisioning
        2. Initializing the Thing Registry interface
        3. Registering a thing
        4. Updating a public thing
        5. Claiming a thing
        6. Removing a thing from the registry
        7. Disowning a thing
        8. Initializing the provisioning server interface
        9. Handling friendship recommendations
        10. Handling requests to unfriend somebody
        11. Searching for a provisioning server
        12. Providing registry information
        13. Maintaining a connection
        14. Negotiating friendships
        15. Handling presence subscription requests
        16. Continuing interrupted negotiations
        17. Adding XMPP support to the sensor
        18. Adding a sensor server interface
        19. Updating event subscriptions
        20. Publishing contracts
      4. Adding XMPP support to the actuator
        1. Adding a controller server interface
      5. Adding XMPP support to the camera
      6. Adding XMPP support to the controller
        1. Setting up a sensor client interface
          1. Subscribing to sensor data
          2. Handling incoming sensor data
        2. Setting up a controller client interface
        3. Setting up a camera client interface
        4. Fetching the camera image over XMPP
        5. Identifying peer capabilities
        6. Reacting to peer presence
        7. Detecting rule changes
      7. Connecting it all together
      8. Summary
    14. 7. Using an IoT Service Platform
      1. Selecting an IoT platform
      2. The Clayster platform
        1. Downloading the Clayster platform
        2. Creating a service project
        3. Adding references
        4. Making a Clayster module
        5. Executing the service
        6. Using a package manifest
        7. Executing from Visual Studio
        8. Configuring the Clayster system
        9. Using the management tool
        10. Browsing data sources
      3. Interfacing our devices using XMPP
        1. Creating a class for our sensor
          1. Finding the best class
          2. Subscribing to sensor data
          3. Interpreting incoming sensor data
        2. Creating a class for our actuator
          1. Customizing control operations
        3. Creating a class for our camera
      4. Creating our control application
        1. Understanding rendering
        2. Defining the application class
        3. Initializing the controller
        4. Adding control rules
        5. Understanding application references
        6. Defining brieflets
        7. Displaying a gauge
        8. Displaying a binary signal
        9. Pushing updates to the client
        10. Completing the application
        11. Configuring the application
        12. Viewing the 10-foot interface application
      5. Summary
    15. 8. Creating Protocol Gateways
      1. Understanding protocol bridging
      2. Using an abstraction model
      3. The basics of the Clayster abstraction model
        1. Understanding editable data sources
        2. Understanding editable objects
        3. Using common data sources
        4. Overriding key properties and methods
          1. Controlling structure
          2. Publishing properties
          3. Publishing commands
        5. Handling communication with devices
          1. Reading devices
          2. Configuring devices
      4. Understanding the CoAP gateway architecture
      5. Summary
    16. 9. Security and Interoperability
      1. Understanding the risks
        1. Reinventing the wheel, but an inverted one
        2. Knowing your neighbor
      2. Modes of attack
        1. Denial of Service
        2. Guessing the credentials
        3. Getting access to stored credentials
        4. Man in the middle
        5. Sniffing network communication
        6. Port scanning and web crawling
        7. Search features and wildcards
        8. Breaking ciphers
      3. Tools for achieving security
        1. Virtual Private Networks
        2. X.509 certificates and encryption
        3. Authentication of identities
        4. Usernames and passwords
        5. Using message brokers and provisioning servers
        6. Centralization versus decentralization
      4. The need for interoperability
        1. Solves complexity
        2. Reduces cost
        3. Allows new kinds of services and reuse of devices
        4. Combining security and interoperability
      5. Summary
    17. Index