logo资料库

Learning.Internet.of.Things.pdf

第1页 / 共242页
第2页 / 共242页
第3页 / 共242页
第4页 / 共242页
第5页 / 共242页
第6页 / 共242页
第7页 / 共242页
第8页 / 共242页
资料共242页,剩余部分请下载后查看
Cover
Copyright
Credits
About the Author
About the Reviewers
www.PacktPub.com
Table of Contents
Preface
Chapter 1: Preparing our IoT Projects
Creating the sensor project
Preparing the Raspberry Pi
Clayster libraries
Hardware
Interacting with our hardware
Interfacing the hardware
Internal representation of sensor values
Persisting data
External representation of sensor values
Exporting sensor data
Creating the actuator project
Hardware
Interfacing the hardware
Creating a controller
Representing sensor values
Parsing sensor data
Calculating control states
Creating a camera
Hardware
Accessing the serial port on Raspberry Pi
Interfacing the hardware
Creating persistent default settings
Adding configurable properties
Persisting the settings
Working with current settings
Initializing the camera
Summary
Chapter 2: The HTTP Protocol
HTTP basics
Adding HTTP support to the sensor
Setting up an HTTP server on the sensor
Setting up an HTTPS server on the sensor
Adding a root menu
Displaying measured information in an HTML page
Generating graphics dynamically
Creating sensor data resources
Interpreting the readout request
Testing our data export
User authentication
Adding events for enhanced network performance
Adding HTTP support to the actuator
Creating the web services resource
Accessing individual outputs
Collective access to outputs
Accessing the alarm output
Using the test form
Accessing WSDL
Using the REST web service interface
Adding HTTP support to the controller
Subscribing to events
Creating the control thread
Controlling the actuator
Summary
Chapter 3: The UPnP Protocol
Introducing UPnP
Providing a service architecture
Documenting device and service capabilities
Creating a device description document
Choosing a device type
Being friendly
Providing the device with an identity
Adding icons
Adding references to services
Topping off with a URL to a web presentation page
Creating the service description document
Adding actions
Adding state variables
Adding a unique device name
Providing a web interface
Creating a UPnP interface
Registering UPnP resources
Replacing placeholders
Adding support for SSDP
Notifying the network
Responding to searches
Implementing the Still Image service
Initializing evented state variables
Providing web service properties
Adding service properties
Adding actions
Using our camera
Setting up UPnP
Discovering devices and services
Subscribing to events
Receiving events
Executing actions
Summary
Chapter 4: The CoAP Protocol
Making HTTP binary
Finding development tools
Adding CoAP to our sensor
Defining our first CoAP resources
Manually triggering an event notification
Registering data readout resources
Returning XML
Returning JSON
Returning plain text
Discovering CoAP resources
Testing our CoAP resources
Adding CoAP to our actuator
Defining simple control resources
Parsing the URL in CoAP
Controlling the output using CoAP
Using CoAP in our controller
Monitoring observable resources
Receiving notifications
Performing control actions
Summary
Chapter 5: The MQTT Protocol
Publishing and subscribing
Adding MQTT support to the sensor
Controlling the thread life cycle
Flagging significant events
Connecting to the MQTT server
Publishing the content
Adding MQTT support to the actuator
Initializing the topic content
Subscribing to topics
Receiving the published content
Decoding and parsing content
Adding MQTT support to the controller
Handling events from the sensor
Decoding and parsing sensor values
Subscribing to sensor events
Controlling the actuator
Controlling the LED output
Controlling the alarm output
Summary
Chapter 6: The XMPP Protocol
XMPP basics
Federating for global scalability
Providing a global identity
Authorizing communication
Sensing online presence
Using XML
Communication patterns
Extending XMPP
Connecting to a server
Provisioning for added security
Adding XMPP support to a thing
Connecting to the XMPP network
Monitoring connection state events
Notifying your friends
Handling HTTP requests over XMPP
Providing an additional layer of security
The basics of provisioning
Initializing the Thing Registry interface
Registering a thing
Updating a public thing
Claiming a thing
Removing a thing from the registry
Disowning a thing
Initializing the provisioning server interface
Handling friendship recommendations
Handling requests to unfriend somebody
Searching for a provisioning server
Providing registry information
Maintaining a connection
Negotiating friendships
Handling presence subscription requests
Continuing interrupted negotiations
Adding XMPP support to the sensor
Adding a sensor server interface
Updating event subscriptions
Publishing contracts
Adding XMPP support to the actuator
Adding a controller server interface
Adding XMPP support to the camera
Adding XMPP support to the controller
Setting up a sensor client interface
Subscribing to sensor data
Handling incoming sensor data
Setting up a controller client interface
Setting up a camera client interface
Fetching the camera image over XMPP
Identifying peer capabilities
Reacting to peer presence
Detecting rule changes
Connecting it all together
Summary
Chapter 7: Using an IoT Service Platform
Selecting an IoT platform
The Clayster platform
Downloading the Clayster platform
Creating a service project
Adding references
Making a Clayster module
Executing the service
Using a package manifest
Executing from Visual Studio
Configuring the Clayster system
Using the management tool
Browsing data sources
Interfacing our devices using XMPP
Creating a class for our sensor
Finding the best class
Subscribing to sensor data
Interpreting incoming sensor data
Creating a class for our actuator
Customizing control operations
Creating a class for our camera
Creating our control application
Understanding rendering
Defining the application class
Initializing the controller
Adding control rules
Understanding application references
Defining brieflets
Displaying a gauge
Displaying a binary signal
Pushing updates to the client
Completing the application
Configuring the application
Viewing the 10 foot interface application
Summary
Chapter 8: Creating Protocol Gateways
Understanding protocol bridging
Using an abstraction model
The basics of the Clayster abstraction model
Understanding editable data sources
Understanding editable objects
Using common data sources
Overriding key properties and methods
Controlling structure
Publishing properties
Publishing commands
Handling communication with devices
Reading devices
Configuring devices
Understanding the CoAP gateway architecture
Summary
Chapter 9: Security and Interoperability
Understanding the risks
Reinventing the wheel, but an inverted one
Knowing your neighbor
Modes of attack
Denial of Service
Guessing the credentials
Getting access to stored credentials
Man in the middle
Sniffing network communication
Port scanning and web crawling
Search features and wildcards
Breaking ciphers
Tools for achieving security
Virtual Private Networks
X.509 certificates and encryption
Authentication of identities
Usernames and passwords
Using message brokers and provisioning servers
Centralization versus decentralization
The need for interoperability
Solves complexity
Reduces cost
Allows new kinds of services and reuse of devices
Combining security and interoperability
Summary
Index
Learning Internet of Things Explore and learn about Internet of Things with the help of engaging and enlightening tutorials designed for Raspberry Pi Peter Waher BIRMINGHAM - MUMBAI
Learning Internet of Things Copyright © 2015 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: January 2015 Production reference: 1210115 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78355-353-2 www.packtpub.com
Credits Author Peter Waher Reviewers Fiore Basile Dominique Guinard Phodal Huang Joachim Lindborg Ilesh Patel Commissioning Editor Akram Hussain Acquisition Editors Richard Brookes-Bland Richard Harvey Project Coordinator Neha Bhatnagar Proofreaders Ameesha Green Amy Johnson Indexer Hemangini Bari Graphics Sheetal Aute Valentina D'silva Production Coordinator Manu Joseph Content Development Editor Anila Vincent Cover Work Manu Joseph Technical Editor Anushree Arun Tendulkar Copy Editors Gladson Monteiro Jasmine Nadar
About the Author Peter Waher is the cofounder of Clayster, a company with its origin in Scandinavia but now operates in four continents. Clayster is dedicated to the development of Internet of Things applications and provides an IoT platform for rapid application development. Currently, Peter lives and works in Chile where he is the CEO of Clayster Laboratorios Chile S.A., a subsidiary of Clayster that provides development expertise to partner companies and promotes the Internet of Things technology to research institutions. Originally a mathematician, commercial pilot, and computer games developer, he has worked for 20 years with computers and device communication, including low-level development in assembler for resource-constrained devices to high-level system design and architecture. He's currently participating in various standardization efforts within IEEE, UPnP, and XSF, working on designing standards for Internet of Things. His work on smart applications for Internet of Things and the development of the IP-TV application "Energy Saving through Smart Applications" won the Urban Living Labs global showcase award in the Cultural and Societal Participation and Collaboration Tools category. Peter Waher can be found on LinkedIn at http://linkedin.com/in/peterwaher/. I'd like to thank the founder of Clayster, Rikard Strid, and Packt Publishing for the opportunity to write this book; Joachim Lindborg for the many ideas and discussions related to Internet of Things; Fernando Cruz and Freddy Jimenez for their invaluable help with many practical details; my eldest daughter, Maria-Lorena, for accepting to stand model and offer to break into my office at night; and finally my wife and children for tolerating the many late hours it took to write this book.
About the Reviewers Fiore Basile is a programmer, system administrator, creative, entrepreneur and maker. Since 1996, he has served as project manager, consultant, and technology officer in industrial and research projects of many sizes across Italy and Europe. He worked in the fields of cultural heritage, e-health, digital preservation, multimodal interfaces, web and mobile publishing. During his career, he also founded two IT start-ups, held workshops at international conferences and events, and has been interviewed by national and international press. His work experience allowed him to build a broad expertise in systems, web and mobile software development, open source and open hardware, embedded programming, and electronics. He's currently conducting research on wearable technologies, effective computing, and smart connected devices, and he is working as the coordinator of FabLab Cascina, a digital fabrication laboratory in the middle of Tuscany.
Dominique "Dom" Guinard is the CTO and cofounder of EVRYTHNG, a Web of Things and Internet of Things software company that makes products smart by connecting them to the Web. Dom got his PhD from ETH Zurich where he worked on defining the Web of Things architecture, a worldwide network of interconnected objects (sensor networks, appliances, machines, and tagged objects). He also cofounded WebofThings.org and the Web of Things conference series. Before this, he worked on bringing industrial networks of RFID-tagged objects and smart things to the Web at the MIT Auto-ID Labs and was a visiting researcher at the MIT Mobile Experience Lab. He also worked for 4 years with SAP on designing scalable software architectures and infrastructures to integrate real-world objects with business systems. Dom was a researcher at the Auto-ID Labs, Zurich, where he worked on using mobile phones as gateways to Internet of Things (IoT) for Nokia. Before this, he worked on scalable IoT enterprise software architectures for RFID and embedded devices in collaboration with Sun Microsystems. He holds an MSc degree in computer science and a BSc in computer science and management with a specialization in mobile and ubiquitous computing. In 2011, Dominique was listed fifth among the world's top 100 IoT thinkers. Early in 2012, his PhD research on the Web of Things was awarded the ETH Medal. Phodal Huang has over 4 years of experience in hardware and web development. He graduated from Xi'an University of Arts and Science. He currently works at ThoughtWorks as a developer. He is the owner of the mini IoT project (https://github.com/phodal/iot) and the author of the eBook, Design IoT (http://designiot.phodal.com, in Chinese). He loves designing, painting, writing, traveling, and hacking; you can find out more about him on his personal website at http://www.phodal.com.
Joachim Lindborg is a dedicated systems engineer with a long experience of all the technologies that have been passed through the years, starting from Texas Instrument TI-16 to deploying Docker components on Core-Os on a distributed network of Intel NUC machines. He is deeply into the exploding area of small devices. Electronics has always been fascinating and Joachim started soldering electronics in seventh grade. The Raspberry explosion with open hardware and software and MakerSpace enthusiasm is a revival and reclaim from the big producers. Joachim's current focus is to combine these different forms of knowledge of large systems and hardware with meters and actuators to create smart energy services. Starting in 1993, Joachim was part of the biggest telecom project in Ericsson. The project aimed at creating the next century telecom platforms, ATM. TCP/IP seems to be the winner. For his next big project, he was at the Swedish Utility for several years, building smart home services, which was a pre-millennium shift as they were using phone lines and modems. This is a dead technology now. It was really in 2002, when Joachim was one of the founders of homesolutions. se.loopiadns.com, that his system architect skills were used to create a distributed Linux system. Today, this system has some 46,000 apartments that measure electricity, water, and so on, and create advanced building automation. In his current assignment as the CTO for sustainable innovation, there is a constant need for IoT-distributed logic and advanced data analyses to gain energy efficiency and a sustainable society. He has also contributed to a Swedish IT architect book, http://www.thearchitectbook.com/. Ilesh Patel holds a bachelor's degree in electronics and communication and a master's degree in VLSI and Embedded System Design. He has more than 3 years of experience as an embedded engineer. He has good debugging skills and command over the high-level C/C++ language, the scripting language Python, and the hardware language VHDL. He has knowledge and hands-on experience on how to design and develop an automated test suite framework using Python, Microcontroller, and an FPGA-based system design development. I'd like to thank my friend Uchit Vyas for encouraging me to review this book.
分享到:
收藏