When developing IoT (Internet of Things) applications, context distribution is a key feature to support effective delivery of related contextual data obtained from things to all interested entities. With the advent of the IoT era, multiple billion devices can generate huge amounts of data that might be used in IoT applications. In this paper, we present a context distribution framework named SCondi utilizing the messaging service which supports MQTT—an OASIS standard IoT messaging protocol. SCondi provides the notion of
Context-aware computing, as a component of a ubiquitous computing [
The IoT which provides useful services combined with various IT technologies is considered to have the potential to change our world. The IoT is a future internet environment defined as a dynamic global network infrastructure [
With the advent of the IoT era, multiple billion devices can generate huge amounts of data that might be used in IoT applications. However, it is not an easy challenge to deliver these tremendous data at the right time, to the right place, and with the right quality. As one of the important components in context-aware computing, context distribution can be a key feature to support effective delivery of contextual data in the IoT environment [
In this paper, we propose a context distribution framework named SCondi utilizing the messaging service which supports MQTT. SCondi provides the notion of
IoT is a future internet environment that focuses on machine to machine communication, referring to uniquely identifiable objects and their virtual representations. MQTT is a standard Internet of Things connectivity protocol that is designed as an extremely lightweight publish/subscribe messaging transport, considering limited computing power and poor network connectivity. The MQTT protocol is developed by IBM and chosen as standard by OASIS.
As HTTP has made a web to be an infrastructure that share information over the internet, MQTT is expected to be a key infrastructure that makes billions of embedded low price devices to go online. It is already widely used in a lot of embedded systems.
Mosquitto is an open source (BSD licensed) message broker that implements the MQTT 3.1, providing a lightweight method of carrying out messaging using a publish/subscribe model [
Context-aware computing is a core technology that supports human-centric intelligent service using contextual information in real situations. Context refers to a variety of information that can define the state of the real world’s entities, generally consisting of information such as entity identity, activity, status, time, and location [
In this section, we introduce a context distribution framework named SCondi which is based on a messaging service for the IoT, supporting smart and effective dissemination of context data. We begin by mentioning the core requirements for the context data distribution proposed by Bellavista et al. [
Bellavista et al. mentioned that context data distribution needs to meet following 5 requirements for providing an effective context-aware service in IoT environment. Communication should be asynchronous and anonymous among context producers and consumers. To support mobile heterogeneous and wireless scenarios, the context data distribution has to promptly adapt to mobility and current available resources. The context data distribution must enforce visibility scopes of context data to avoid useless management overhead. The context data distribution has to enforce QoC-based constraints for timeliness and reliability guarantees of data delivery. The context data distribution has to handle data life cycle for self-control of the distribution process.
To satisfy the requirements, SCondi provides the following features. First, adopting MQTT as a messaging mechanism, our framework supports asynchronous and anonymous communication among message publishers and subscribers (satisfying (1)). Secondly, our framework provides effective mobility and reliable message delivery based on MQTT’s QoS (Quality of Service) in limited network environments (satisfying (2)). Thirdly, the context channel in our framework provides filter chain mechanism for the QoC constraints such as context data management, resource access control, data validation, and timeliness (satisfying (3) and (4)). Finally, it also provides common filters for general usage and customized filters through predefined interfaces (satisfying (5)).
SCondi has two key components: context channel and channel selector. The context channel is a transmission facility used to convey a collection of contextual data specified by the channel creator. The channel selector receives raw data from external data providers (e.g., sensors, SNS data, calendar data, email, etc.), spreading each raw context data to all the context channels that need the contextual data as their constituent, using the MQTT messaging facility as shown in Figure
Overall structure of SCondi.
A topic with unique namespace in MQTT is allocated to each context channel. The topic manages the associated contextual data as subtopic, forming a hierarchal structure. In other words, A channel ID is assigned as a main topic while each contextual data is assigned as a subtopic separated by a “/” following the channel ID. Based on the MQTT messaging facility, SCondi provides decoupled one-to-many pub/sub through the context channel which allows any contextual data to be published once and multiple consumers to receive the collection of the needed contextual data.
In SCondi, a context is composed of a set of context primitives (CPs), where a CP is a set of related data that are used as a practical unity in applications. For instance, most elevators in the modern era have been fitted with several safety devices such as overload sensor, door sensor, fire sensor, gas sensor, cable sensor, and fault diagnosis module as shown in Figure
Example of context primitive.
SCondi provides an authentication and authorization mechanism to manage access levels for context channels. To access a context channel, a subscriber should have a retrieval authority for the channel. For convenience of users, the framework supports three types of context channel according to the purpose of the application:
To process contextual data with different characteristics depending on the purposes of context channels, we provide context channels with the
QoC (Quality of Context) is a very important factor to be considered for the context data distribution efficiency and reliability. Traditionally QoC has focused on the quality of data only. Recently, to ensure the availability of data with the right quality, in the right place and at the right time, many related studies concentrate on complex characteristics such as data transmission time, data reliability, data accessibility, data refreshment/up-to-date, and data precision. In other words, QoC must be considered depending on the purpose of the services. To reflect these aspects, SCondi provides filter chain mechanism that allows filters to be applied for supporting QoC in context channels.
A filter changes original contextual data to qualified data according to QoC criteria. Also, as shown in Figure The value_range filter passes values only within a certain range. The time filter passes values within a specific time period. The value_changed filter passes values different from previous values. The average filter calculates the average value with the specified condition, transmitting the calculated value.
Pluggable ordered filter chain mechanism.
In addition, SCondi provides predefined interfaces to create a custom filter and to manage filter chain apart from the common filters.
In this section, we explain the implementation of context distribution framework to support reliable delivery of context data. SCondi is implemented with Java program language, using Mosquitto as the MQTT message broker to support efficient and reliable messaging. The context channel provides a filter chain mechanism through the filter interface and the filter chain interface. The
Filter interface.
Interface | Description |
---|---|
|
Changes original contextual data to qualified data according to the filter logic |
|
After execute(), passes context to next filter in the filter chain |
Filter chain interface.
Interface | Description |
---|---|
|
Adds the specified filter at the beginning of this chain |
|
Adds the specified filter at the end of this chain |
|
Adds the specified filter before the base filter in this chain |
|
Adds the specified filter after the base filter in this chain |
|
Invokes the filters of the chain in order |
|
Deletes the specified filter in this chain |
|
Replace the specified filter with new filter |
<Context> <Context Primitive1> <Overload Alarm>OFF</Overload Alarm> <Current Weight>120 KG</Current Weight> </Context Primitive1> <Context Primitive2> <Fire Alarm>OFF</Fire Alarm> <Current EV Temp>24°C</…> </Context Primitive 2> <Context Primitive 3> <Address>…… </Context Primitive 3> </Context>
Algorithm
FilterChain = Channel.getFilterChain(CurrentWeight) FilterChain.addFirst(new AverageFilter(10)); FilterChain.addLast(new ChangedValueFilter());
class AverageFilter implemented Filter
Object execute(Object c) sum += c; if (checkCount()) result = sum/avgCount; init(); return nextFilter.execute(result);
class ChangedValueFilter implemented Filter
Object execute(Object c) old = cur; cur = c; if (isChanged() == true) return nextFilter.execute(cur);
According to the rapidly increasing number of devices in the IoT, both context channels and the channel selector can impose heavy overloads on a single MQTT message broker. Thus, SCondi uses 2 message brokers for the channel selector and context channels, respectively. A topic of the first Mosquitto message broker (for channel selection) is assigned to each source of contextual data which is provided by the external context adapter. The channel selector manages a contextual data and the associated channels through the context-channel mapping table, publishing the data to the message broker through the assigned topic. To subscribe a specific contextual data, each context channel should request a subscription of the associated topic to the message broker. After acquiring the approval from subscription authorization, the context channel can receive the interested data from the message broker by subscribing to the associated topic.
After processing the received data through its filter chain, the context channel publishes the specified set of data to the second message broker (for end user delivery). To receive the set of interested contextual data from the context channel, end user applications should subscribe to the context channel. Our framework also provides the management facility for subscription permissions on context channels. In addition, the channel provides the context-filter mapping table to manage each context data and its related filters. The channel supports 2 types of filter:
Since SCondi provides higher level abstract mechanism for information delivery in the IoT environment, the qualitative effectiveness of our framework is very clear. So, we focus on the effectiveness in terms of quantity of delivered messages as illustrated in Figure
Then, in case that every CP is used once by application, the amount of source messages can be written as
Context distribution with/without context channel.
For simplicity, assume that every application receives its needed data once for a certain period of time
Example of delivered message comparison with practical data.
Common conditions | |
---|---|
|
|
MQTT broker case | SCondi case |
Let |
Let |
|
|
|
|
|
|
|
|
|
|
|
|
|
Figure
In this paper, we introduced a context distribution framework named SCondi that supports effective dissemination of context data through context channels. SCondi is based on two major components: channel selector and context channel. The channel selector sends each raw context data to each of the context channels that requires the contextual data, using the MQTT messaging facility which has been adopted by OASIS as a standard messaging facility for the IoT. The context channel provides a filter chain mechanism that supports effective extraction, tailoring, authentication, and security of information through various types of filters. Based on the MQTT messaging facility again, when receiving the collection of the associated contextual data, the context channel delivers the collection of data to each subscriber of the channel after processing the collection of data with the filter chain. In addition, SCondi supports three types of context channel according to the purpose of the application: open, access-limited, and group channel. We also showed that SCondi is very useful and effective both in quality and quantity of delivered messages. We believe that the novel concept of context channel and the presented framework can be very useful for context distribution in the IoT environment.
The authors declare that there is no conflict of interests regarding the publication of this paper.
This research was supported by Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education (no. 2013R1A1A4A01004459).