Unit Iv
Unit Iv
Device-management Gateway:
Device Management (DM) means provisioning for the device ID or address which is distinct
from other resources, device activating, configuring (managing device parameters and
settings), registering, deregistering, attaching and detaching. Device management also means
accepting subscription for its resources. Device fault management means course of actions and
guidelines to be followed in case if a fault
develops in the device.
Open Mobile Alliance (OMA)-DM and several standards are used for device management.
OMA-DM model suggests the use of a DM server which interacts with devices through a
gateway in case of IoT/M2M applications. A DM server is a server for assigning the device ID
or address, activating, configuring (managing device parameters and settings), subscribing to
device services or opting out of device services and configuring device modes. A device instead
of a DM server, communicates to a gateway in case of low-power loss environment.
Gateway functions for device management are:
Does forwarding function when the DM server and device can interact without
reformatting or structuring
Does protocol conversion when the device and DM server use distinct protocols
Does proxy function in case an intermediate pre-fetch is required in a lossy environment
or network environment needs.
Data communication between personal/local area network of devices and a gateway for
communicating via Internet.
Gateway enables data enrichment and consolidation and device management.
Data management functions at the gateway are transcoding, data privacy, data security,
data enrichment, data consolidation, transformation and device management.
Transcoding means adaptations, conversions, changes of protocol or format using
software which renders the web response/messages in formats/representations as
required and acceptable at the IoT device and rendering requests for messages in
formats/representations as required and acceptable at the server.
Data acquires and transfers to other end at scheduled intervals, on an event, or on
polling.
Data aggregation, compaction and fusion save energy during data dissemination.
Data destinations may use the 48-bit MAC address, 32-bit IPv4 address, 48-bit IPv6
address or port number during communication at the data-link or network layers.
Each device and application has an ID or address of communication source and each
destination has an ID or address. Communication between the end points and between
the layers is secure when using the authentication and authorisation processes.
Device management functions are the device ID or address, activation, configuring
(managing device parameters and settings), registering, deregistering, attaching,
detaching and fault management.
Gateway functions for device management are—forwarding function between DM
server and device; protocol conversion when device and DM server use distinct
protocols and proxy function.
Communication gateway enables protocol conversion between two ends.
Fig: Oracle’s IoT architecture (Device identity management means identifying a device,
registering a device for actions after identifying, de-registering the device, assigning unique
identity to the device. Device access management means enabling, disabling the device access,
authenticating a device for access, authorizing a device for access to a subsystem. Chapter 2
will explain these in greater detail.)
An architecture has the following features:
The architecture serves as a reference in applications of IoT in services and business
processes.
A set of sensors which are smart, capture the data, perform necessary data element
analysis and transformation as per device application framework and connect directly
to a communication manager.
A set of sensor circuits is connected to a gateway possessing separate data capturing,
gathering, computing and communication capabilities. The gateway receives the data
in one form at one end and sends it in another form to the other end.
The communication-management subsystem consists of protocol handlers, message
routers and message cache.
This management subsystem has functionalities for device identity database, device
identity management and access management.
Data routes from the gateway through the Internet and data centre to the application
server or enterprise server which acquires that data.
Organisation and analysis subsystems enable the services, business processes,
enterprise integration and complex processes
REGISTERING A DEVICE:
Device management functions are assigning each device ID or address, device activation,
configuring (managing device parameters and settings), registering, deregistering, attaching,
detaching, subscription and fault management.
Go to the Registries page in Google Cloud console.
At the top of the page, click Create a registry.
Enter a Registry ID and select a cloud region. For information on registry naming and
size requirements, see Permitted characters and size requirements.
Select the Protocols that devices in this registry will use to connect to Cloud IoT Core:
MQTT, HTTP, or both.
Select a Default telemetry topic or create a new one.
The default topic is used for published telemetry events that don't have a subfolder or
if the subfolder used doesn't have a matching Cloud Pub/Sub topic.
(Optional) If you want to publish separate streams of data from a device, add more
telemetry topics.
Each topic maps to a subfolder specified in either the MQTT topic path or the HTTP
request when the data is published.
To create additional telemetry topics:
a. Click Add more telemetry topics, then click Add topic and subfolder.
Characteristics
First, the cloud computing of IoT is an on-demand self service, meaning it‘s there when you
need it. Cloud computing is a web-based service that can be accessed without any special
assistance or permission from other people; however, you need at minimum some sort of
internet access.
Second, the cloud computing of IoT involves broad network access, meaning it offers several
connectivity options. Cloud computing resources can be accessed through a wide variety of
internet-connected devices such as tablets, mobile devices and laptops. This level of
convenience means users can access those resources in a wide variety of manners, even from
older devices. Again, though, this emphasizes the need for network access points.
Third, cloud computing allows for resource pooling, meaning information can be shared with
those who know where and how (have permission) to access the resource, anytime and
anywhere. This lends to broader collaboration or closer connections with other users. From an
IoT perspective, just as we can easily assign an IP address to every "thing" on theplanet, we
can share the "address" of the cloud-based protected and stored information with others and
pool resources.
Fourth, cloud computing features rapid elasticity, meaning users can readily scale the service
to their needs. You can easily and quickly edit your software setup, add or remove users,
increase storage space, etc. This characteristic will further empower IoT by providing elastic
computing power, storage and networking.
Finally, the cloud computing of IoT is a measured service, meaning you get what you pay for.
Providers can easily measure usage statistics such as storage, processing, bandwidth and active
user accounts inside your cloud instance. This pay per use (PPU) model means your costs scale
with your usage. In IoT terms, it's comparable to the ever-growing network of physical objects
that feature an IP address for internet connectivity, and the communication that occurs between
these objects and other internet-enabled devices and systems; just like your cloud service, the
service rates for that IoT infrastructure may also scale with use.
Service and Deployment
Service models
Service delivery in cloud computing comprises three different service models:
a. Software as a service (SaaS),
b. Platform as a service (PaaS),
c. Infrastructure as a service (IaaS).
Software as a service (SaaS) provides applications to the cloud‘s end user that are mainly
accessed via a web portal or service-oriented architecture-based web service technology. These
services can be seen as ASP (application service provider) on the application layer. Usually, a
specific company that uses the service would run, maintain and give support so that it can be
reliably used over a long period of time.
Platform as a service (PaaS) consists of the actual environment for developing and
provisioning cloud applications. The main users of this layer are developers that want to
develop and run a cloud application for a particular purpose. A proprietary language was
supported and provided by the platform (a set of important basic services) to ease
communication, monitoring, billing and other aspects such as startup as well as to ensure an
application‘s scalability and flexibility. Limitations regarding the programming languages
supported, the programming model, the ability to access resources, and the long-term
persistence are possibledisadvantages.
Infrastructure as a service (IaaS) provides the necessary hardware and software upon which
a customer can build a customized computing environment. Computing resources, data storage
resources and the communications channel are linked together with these essential IT resources
to ensure the stability of applications being used on the cloud. Those stack models can be
referred to as the medium for IoT, being used and conveyed by the users in different methods
for the greatest chance of interoperability. This includes connecting cars, wearables, TVs,
smartphones, fitness equipment, robots, ATMs, and vending machines as well as the vertical
applications, security and professional services, and analytics platforms that come withthem.
Deployment
Deployment models
Deployment in cloud computing comprises four deployment models: private cloud, public
cloud, community cloud and hybrid cloud.
A private cloud has infrastructure that‘s provisioned for exclusive use by a single organization
comprising multiple consumers such as business units. It may be owned, managed and operated
by the organization, a third party or some combination of them, and it may exist on or off
premises.
A public cloud is created for open use by the general public. Public cloud sells services to
anyone on the internet. (Amazon Web Services is an example of a large public cloud provider.)
This model is suitable for business requirements that require management of load spikes and
the applications used by the business, activities that would otherwise require greater investment
in infrastructure for the business. As such, public cloud also helps reduce capital expenditure
and bring down operational ITcosts.
A community cloud is managed and used by a particular group or organizations that have
shared interests, such as specific security requirements or a common mission.
Finally, a hybrid cloud combines two or more distinct private, community or public cloud
infrastructures such that they remain unique entities but are bound together by standardized or
proprietary technology that enables data and application portability. Normally, information
that‘s not critical is outsourced to the public cloud, while business-critical services and data are
kept within the control of the organization.
CLOUD STORAGE API:
A cloud storage API is an application program interface that connects a locally-based
application to a cloud-based storage system, so that a user can send data to it and access and
work with data stored in it. To the application, the cloud storage system is just another target
device, like tape or disk-based storage. An application program interface (API) is code that
allows two software programs to communicate with each other. The API defines the correct
way for a developer to write a program that requests services from an operating system (OS)
or other application. APIs are implemented by function calls composed of verbs and nouns.
The required syntax is described in the documentation of the application being called.
How APIs work
APIs are made up of two related elements. The first is a specification that describes how
information is exchanged between programs, done in the form of a request for processing and
a return of the necessary data. The second is a software interface written to that specification
and published in some way for use.The software that wants to access the features and
capabilities of the API is said to call it, and the software that creates the API is said to publish
it.
Why APIs are important for business
The web, software designed exchange information via the internet and cloud computing have
all combined to increase the interest in APIs in general and services in particular. Software that
was once custom-developed for a specific purpose is now often written referencing APIs that
provide broadly useful features, reducing development time and cost and mitigating the risk of
errors.APIs have steadily improved software quality over the last decade, and the growing
number of web services exposed through APIs by cloud providers is also encouraging the
creation of cloud-specific applications, internet of things (IoT) efforts and apps to support
mobile devices and users.
Three basic types of APIs
APIs take three basic forms: local, web-like and program-like:
1. Local APIs are the original form, from which the name came. They offer OS or
middleware services to application programs. Microsoft's .NET APIs, the TAPI
(Telephony API) for voice applications, and database access APIs are examples of the
local API form.
2. Web APIs are designed to represent widely used resources like HTML pages and are
accessed using a simple HTTP protocol. Any web URL activates a web API. Web APIs
are often called REST (representational state transfer) or RESTful because the publisher
of REST interfaces doesn't save any data internally between requests. As such, requests
from many users can be intermingled as they would be on the internet.
3. Program APIs are based on remote procedure call (RPC) technology that makes a
remote program component appear to be local to the rest of the software. Service
oriented architecture (SOA) APIs, such as Microsoft's WS-series of APIs, are program
APIs.
Web server for IoT:
Any computer that can implement http or https is able to play the role of a web server. Http is
a protocol, a way of communication which supplies web pages. It is pretty widely used and
easy to implement. Through http you can transfer html and create simple user interfaces, it can
implement Java Script and make more complicated web pages and it is available in most of the
browsers. One of the great qualities of this protocol is that it replaced complicated and heavy
displays with user friendly web pages.
How does it work? The browser sends a request to the server who searches the demanded page
and returns it to the browser for the user. The request will consist of information about the kind
of browser that is used, about the computer or about the document requested. It will have a
method, a URL, a query string and the upload body in case you want data to be sent to the
server.
The response will include the status, which tells the browser if the page was found or not (the
errors among the 400s are about a not found page, 300 are redirections and 200s are
confirmations of the page being found).
It encrypts the data. The request and the response will be both encrypted on sending
and decrypted when read.
The server is always asked for a certificate of authenticity before it is asked for a
page. This prevents against stolen data through false web pages.
What does a query consist of? It will always look like this: http://address: [port]URL? Query
string. The port can be absent, in which case it will be 80 for http and 443 for https. It has to be
specified if it is not one the two. Concerning the URL, when it is not written, the default will
be. The available methods in http are: get, post, put and delete. The main ones being the first
two.
Get method needs no upload body. It will only ask for data from the server and send
only the headers, the address, the URL.
Post sends important data to the server, which will be uploaded. Post has the role of
modifying data on the server. The response of both these methods is the page and any
additional information that was requested.
Put is similar to post, only that in the semantic way, this method only creates an object
on the server.
Delete also plays a semantic part. It needs no upload body and it deletes objects on the
server. The same action can be performed however using get.
On one server there can be more than one website, which means that, if the host is not specified
in the request, the response may not be the one the browser expects.
Also, the response may have more than text. Any additional feature: images, JavaScript objects
and so on will need a new request, so the process will be slowed down.
To create a webserver in wyliodrin you will need a web node. The simplest way to use a web
page in this particular way is to send static files. In the project files, create a new folder static.
Everything inside it will be sent back to the browser by the server, regardless of the fact that
they are html, Java Script or CSS files. Images can be added as well, but they will definitely
make the process slower. There are other ways of adding an image. For example, by using a
storage system and including the images from there. This method will solve speed and memory
issues.
The web node: The route option is actually the URL. The webserver will be active when it
stumbles upon the specified route. After words you choose the method, and write the port to
setup the server. This port will only be used once, in the beginning.
The payload goes either in the query string for the get method or in the upload data for post.
The message is built on this payload, on two mandatory variables: res which stands for the
response and req which is the request. Without the last two, the server won't be able to provide
a response.
The web response node: The message received by this node comes from one web node. For a
web response the simple way is to make a redirection. Which means, in the redirect field, you
can write the path to one of the static files and the browser will be sent to this page. On top of
these, you will need the board's IP address which might not be public unless it is in the same
network with the web server.
As a solution, IOT servers have a public adrdress. The port for these servers can be either 80
for http or 443 for https. The user accesses the public page, through the IOT server which is
connected to Wyliodrin as well as the board. Now the problem with the board and the web
being in the same network is solved as both can communicate with Wyliodrin.
Web templates: Just as for the static files, you will need a templates folder. This time, when
you use the node, you don't need the whole path. You can only write the name of the file in the
templates folder. What does the node do? It processes the response, meaning it loads the values
plus the payload in it and sends it back to the browser. The values need to be in between two
sets of curly brackets {{}}. Note that the values won't update unless the page is reloaded.
Web services:
A long time ago, the web services were more complicated. Now the application only requests
the web server for the data, and it is the browser's job to rearrange it so that it is in the right
format for the application.
How to implement it into a Wyliodrin application? Using a simple web response and web server
node, you send a static page to the user and each time you make a query, instead of a template,
you use a web response node and send the payload to the browser, which can be a number, an
object or anything else.
JQuery:
There is a library called JQuery, based on JavScript, thus available in any browser, which can
make function calls to the server.
Case study : You have the following situation: you change the payload into a variable which
stores values from a sensor. You want this variable to be shown in your web page. Practically,
when an API gets called, what you will do, will be to make a get request to the server using the
web address that you want with the URL /sensor . The web page will send values that you will
store in a variable in your html file.
Web sockets:
A web socket is based on the http or https protocol. It builds a connection between the browser
and the server, so that either one can send data. When the browser makes a request, the server
recognises the socket and doesn't close the connection. The two parties send the packages they
need to send. If the server does not know how to work with sockets, the socket io will go back
to querying.
AngularJS:
AngularJS is a library through which you can build browser applications. In the next example,
every web node will create a new socket and serve a static web page. If you include in the
response a variable, and this variable changes, wyliodrin controller will be notified every time
this kind of novelty appears and AngularJS will replace the old value of the variable with the
new one, creating a dynamic web page.