# SCM-IoT: An Approach for Internet of Things Services Integration and Coordination
## 3 Methodology
### Conceptual Model  
The SCM-IoT model consists of a centralized, shared, stable storage medium for uncoupled interaction among agents, where a privileged agent, called the (_content_) _editor_, controls the storage access through storage services provided to the other agents. The editor can analyze, modify, produce and store new data into the storage medium based on predefined rules. The editor can consume, produce, and publish data by receiving service requests and perceiving changes in the storage contents, making the storage change. Publishing data generates and propagates notifications about the rising of expected data from the storage. Clients of the editing services are differentiated between (_content_) _producers_ and (_content_) _subscribers_ according to the services they request. SCM-IoT proposes an architectural pattern for the design and implementation of IoT systems with loosely coupled components in a data-oriented approach as opposed to the entirely based message-oriented approach. Figure 1 shows the SCM-IoT deployment scenario. The storage medium is organized in tables with fixed structures. Tables are fixed collections of data where no rows can be deleted, nor new rows can be added. Column names are called _topics_. Rows are organized in fields of some type (string, enumeration, boolean, integer, or real) that store pieces of information. A row always has a _key_ field that uniquely identifies it. In SCM-IoT, rows and tables are called _pages_ and _notebooks_, respectively, and the message containing a request service is a _notification_, or simply, _note_. Figure 1: SCM-IoT deployment scenario. Table 1 shows the structure and content of a notebook for the home automation application presented in the case study. This table has seven pages (rows) and nine fields (columns). Each page is identified by the unique value of the \"id\" field. The notebook content shown in Table 1 shows the last state of the house as it is perceived by the sensors (presence, temperature, smoke, and toxic gas) installed in each room of the house. In this description, the state of the actuators (heater, cooler, alarm) is also included. The page representing the state of the dining room (with \"COM\" as \"id\") shows that this room is occupied, has low temperatures, and has no smoke and no toxic gas detected, with all the actuators not activated. In general, the information contained in the notebook has two properties:  
* At all times, the book contains the latest known information until a new update service is successfully consumed;
* Participants can serially access the notebook contents through the editor services, eliminating many concurrent access problems to the shared memory, such as those observed in distributed databases. Besides the primary editing notebook, there are also secondary notebooks that the editor uses to perform his services. The subscription notebook is used to register clients who wish to receive notifications of relevant data arising in its content due to the editor activity. The notification notebook is also used to register subscription data before sending it to the subscriber. The three basic storage services that the editor provides to their clients are:  
* _Update_, for modifying the data contained in the storage with new incoming or calculated data;
* _Subscribe_, for resuming clients' activity awaiting pages whose content satisfies the so-called notification conditions;
* _Collect_, for retrieving all pages from a notebook that satisfy a collection condition;
* There is no limit in the number of notebooks for edition. Each notebook may differ in its structure according to its intended purpose. * The services characterize the role of the actors that request them to the editor;
* Content producers request update services to introduce new data into a field or modify existing page data.