Transcript [pptx2]

Systems for Smart Home
Automation
Nilanjan Banerjee
Writing Drivers
Five steps for writing applications
Instantiating Roles
Instantiating Ports
Binding roles to ports
Registering the port with the platform
Implementing functions for handling operation
invocations
Roles Data Structure
Base class: Role (Your role will extend Role)
e.g.: DummyRole:Role
Roles have Operation
Operation (name, arguments, returnvalue)
name: :dummy:->echo (Name, function name)
arguments, returnvalue of type ParamType
List<VParamType> args = new
List<VParamType>() { new ParamType(0) };
Writing Drivers (setting up Roles)
Writing Drivers (instantiating ports)
portInfo = GetPortInfoFromPlatform(nameofdevice)
port = InitPort(portInfo)
List<VRole> listroles = new List<Vrole>(){Role.Instance}
BindRoles(port, RoleList)
Writing Drivers logic (synchronous)
Putting all of this together
lets see an example.
Scouts
Scouts are used for discovering devices
Discovers devices in the environment
Makes the core platform aware of the devices
User can query the platform for discovered devices
that are not part of the platform
Device setup is performed through HTML pages
Initial page enables setting up the configurations
Core function that you have to
implement in Scouts
public List<Common.Device> GetDevices()
{
Device device = new Device("dummydevice", "dummydevice", "",
DateTime.Now, "HomeOS.Hub.Drivers.Dummy", false);
Device device1 = new Device("dummy2device", "dummy2device", "",
DateTime.Now, "HomeOS.Hub.Drivers.Dummy2", false);
//intialize the parameters for this device
device.Details.DriverParams = new List<string>() { device.UniqueName };
device1.Details.DriverParams = new List<string>() { device1.UniqueName };
return new List<Device>() {device, device1};
}