Developers

Developer's Overview: Programming Smart Homes

Smart homes are computer systems that integrate hardware devices, such as sensors and actuators, and software services/applications into homes to enrich the quality of life of their inhabitants. The gap between the "physical" world outside the computer and the "virtual" world inside the computer is bridged by using sensors make data about the physical world accessible to computer systems and actuators to make objects in the physical world controllable by computer systems. Software services and applications can then be built using these hardware devices to meet some user need, such as healthy aging or home security. The services and applications can also network the smart home with other smart homes and services. These are the basic steps to programming with devices and services.

Programming with Devices

Computers already use many hardware devices, e.g. memory, keyboard, video card, network card, etc. These devices are physically attached to the computer, and the operating system has software libraries that allow it to communicate with the devices without knowing the implementation details of the device protocol. This similar to the setup and use of devices in the smart home, which usually involves following three basic steps:

  1. Device Installation Device hardware need to be installed in the environment with which it will interact, which may be as simple as plugging in the device to a wall outlet or as complicated as replacing already existing fixtures/appliances. The device may also have to be physically attached to a host via RS-232 or USB to be able to interact with it. Unless the device has its own server running inside it, e.g. a web cam or sensor node, software will also need to be installed on the host to enable its operating system to communicate with the device.
  2. Device Configuration After installing hardware and software, devices may also need to be configured to work with the host or other devices, such as setting a device's address on the device or selecting the frequency on which the device operates. Sometimes, configuration must be done physically to the device, and other times it must be done through software via a third-party application or the device's API.
  3. Device Utilization To use the device in a program, some sort of device library will usually need to be placed on the project build path so the compiler has access to the device code. However, in some cases, the device may be networked, in which case it can be invoked by using some device-specific protocol over standard sockets.

Visit the Devices page for an overview of the different types of devices used in the ISU smart home.

Programming with Smart Home Services

In the physical world, we rely on the concept of services quite frequently when interacting with businesses and individuals. For example, when depositing money at the bank, you know that you need to go to the bank and fill out a deposit slip and give it to the teller to perform the transaction. You don't care which teller you see, and you don't know exactly how they perform the transaction, but you know the result of the transaction should be an increase in the balance of your account. The teller thus provides the service of depositing money into your bank account. There is a well-known set of inputs and a well-known set of results or outputs to interact with the teller.

The service-oriented computing paradigm is similar to this situation. A service is a software component with a well-known interface that can be obtained from a well-known location, called the registry. Service providers create services and publish their interfaces (and possibly their implementations) to the registry so that service consumers can query/search the registry to obtain the services and use them according to their interfaces. Service-oriented architectures (SOA) are software frameworks that manage the service registries and the related activities of service providers and clients. These activities include

  1. For Service Providers
    1. Create a new registry or access an existing one
    2. Create and configure a service
    3. Publish the service to the registry
    4. Update the service registration
    5. Remove the service from the registry
  2. For Service Clients
    1. Find a service registry
    2. Query the registry for a particular type of service
    3. Bind to the service
    4. Invoke the service
    5. Release the service

In the smart home lab, we use two popular SOA, the centralized, Java-based Open Service Gateway initiative (OSGi) and the decentralized Java-based implementation of the Web Services paradigm (WS). Click here for public tutorials on OSGi, WS, and here for tutorials developed by our lab.

Visit the Services page for an overview and description of the various services developed or used and offered by the ISU smart home lab

Development Practices and Processes

Both of the SOA used in the ISU Smart Home Lab are Java-based, and thus object-oriented in nature.

  • Language: Java JDK 1.6
  • SOA platform 1: Knopflerfish OSGi Framework v. 4.0.0
  • SOA platform 2: Standard OSGi Framework
  • SOA platform 3: ...
  • Version control: SVN
  • Development Environment: Eclipse with various plugins