Menu

IO Interface Overview

David McGinnis Kyle

What is an IO Interface?

An IO interface is a component for SAMI which enables input and/or output to external hardware or services. Some examples of IO interfaces include one which gathers movie showtimes, one which controls light switches, and one that controls the TV. IO interfaces may implement an interface which is accessible to outside apps, so that many different apps can use the component, with different interfaces or new functionality. These interfaces may also be implemented by many different IO interfaces, so that things like the brand of light switches are hidden from the user of an app that turns on or off a light switch. SAMI comes with some common interfaces already, along with a sample implementation of that interface, but we will be adding more to the SDK as time goes on, and we encourage you to make interfaces you see we are lacking, and share them with the community, so that more people can enjoy SAMI! The only requirement is that no matter which interface you use, it must inherit from IIOInterface.

How do I create one?

IOInterfaces are pretty open as to how you create it. The only real requirement is that it implements an interface that can be used to look up the IO interface by apps. This interface should implement IIOInterface, and should be persistent.

There are a few base classes created to make it easier to create IO interfaces for the common cases. Below is a list of these base classes, along with links to associated documentation.

  • FileAudioIOInterface - Base class which has methods to play audio files from either local or remote paths.
  • StreamingAudioIOInterface - Base class which has methods to play streaming binary audio data.
  • XBeeInterface - Base class which has methods to communicate to hardware that is connected to SAMI using the XBee wireless protocol.

How do I use one in my app?

Using a component is almost as easy. You just get an instance of the singleton ConfigurationManager, and call FindAllComponentsOfType<T>(). Below is an example that gets all of the light switch components:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ConfigurationManager.GetInstance().FindAllComponentsOfType<ILightSwitchController>()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Related

Documentation: Audio File-Based IO Interface
Documentation: Developing for SAMI
Documentation: Home
Documentation: Loading Configuration Data
Documentation: Streaming Audio IO Interface
Documentation: XBee IO Interface

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.