1 / 40

An Operating System for the Home

An Operating System for the Home. HomeOS: An OS for the home. HomeStore. Video r ecording. Remote unlock. Climate c ontrol. HomeOS. Z-Wave, DLNA, UPnP, etc. HomeOS logically centralizes all devices. Users interact with HomeOS, not individual devices.

Download Presentation

An Operating System for the Home

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Operating System for the Home

  2. HomeOS: An OS for the home HomeStore Video recording Remote unlock Climate control HomeOS Z-Wave, DLNA, UPnP, etc. HomeOS logically centralizes all devices Users interact with HomeOS, not individual devices HomeStore helps find compatible devices and apps

  3. HomeOSarchitecture Heterogeneity source handled

  4. DCL and DFL (Drivers) DCL provides basic connectivity to devices • Discovery • Abstract differences in protocols • Connectivity DFL exports device functionality as a service • Services are protocol-independent • Exposed as roles and operations • Kernel does not parse or understand services • Allows subscriptions (e.g. when light is toggled) • Applications do not require changes

  5. Application layer Apps compose abstract rules from DFL Management layer interposes on accesses Manifests help with compatibility testing • Lists of mandatory and optional features • E.g., mandatory: {TV, SonyTV}, {MediaServer} optional : {Bass Speaker}

  6. Interaction between Apps and Drivers Applications Exposes Ports Core Platform Exports Ports Drivers Device (camera, thermostat)

  7. What are ports (classical definition) Hardware ports sockets that a device can plug into e.g., printer ports, mouse ports? Software ports locations/addresses that processes run e.g., Http (port 80), ssh (port 22) processes can read and write from ports

  8. Ports in Home Lab (HomeHub) Ports are uses as a communication abstraction between Drivers Platform (kernel)  Applications All modules (drivers, kernel, applications) can read/write using ports HomeHub ports are associated with Roles Driver Applications platform Read/write data Read/write data

  9. What are Roles? Roles define service and capabilities that a device offers Example role for a pan-tilt-zoom video camera: up, down, left, right, getImages Roles may be shared between devices same roles can be provided by multiple devices e.g. getTemperature() is a role that can be provided by a temperature sensor and a thermostat

  10. Interaction between Apps and Drivers Applications Bind Ports Invoke Roles Exposes Ports with Roles Core Platform implements roles Exports Ports with Roles Drivers Device (camera, thermostat)

  11. How would a camera device work? Camera Viewer Application Bind Ports Invoke Roles Scan for ports that exports a CamerRole Invoke the roles exported by CameraRole Core Platform implements roles • Port roles • (CameraRoles: move camera up, down,Left, right) Drivers Pan/Tilt/Zoom Camera

  12. How would you implement different components like kernel, drives, and apps Design goals you want isolation between the kernel, drivers, and applications Sandbox execution of different components? How would you implement something like this?

  13. What are different ways of implementing this? Processes High communication overhead High overhead for switching processes on and off Threads substantial amount of sharing minimal isolation

  14. .Net provides Application domains to implement this? Somewhere in between process and threads The common language infrastructure runs as a process and the sub processes or applications runs within the CLI process Each application domain has a separate virtual address space Provides isolation Exception in one domain does not affect other application domain, each application domain are assigned different access levels, and multiple threads can run in one domain

  15. How would you implement ports Use a framework called .Net Remote There are two ways to pass Objects from one process to the other By object copying and passing object references System.AddIn.AddIn Attributes provides a fairly complex way of implementing the communication using a similar idea. App domain 2 App domain 1 proxy responsible for marshalling/unmarshalling

  16. Implications to Garbage collection Object passed across boundaries are garbage collection It is slower than garbage collection inside app domains Each application domain has a separate virtual address space

  17. Programming Abstraction for HomeHub Drivers and Apps are modules Extends ModuleBase class provides four methods (start, stop, portregistered, portderegistered) Uses the System.AddIn.AddIn(“Appname”) attribute Modules export services and can use service Drivers and Apps therefore theoretically can export and use services Services are operations defined in roles associated with ports Input and output parameters of operations are of ParamType

  18. ParamType Used for transferring data between modules using ParamType class has two fields MainType: this can be an integer, image, sounds, txt MainType can be simple of complex object Value: captures the actual object Example ParamType (maintype=image, value=byte[])

  19. Helper Functions Logger class Generate log messages When a module is instantiated, HomeOS passes a pointer to the log object Redirect messages to a log or stdout logger.log(); SafeThread Focusses on communication between modules

  20. Example of Using SafeThread Logic inside the thread Parameter passed to the thread Parameter passed to the thread

  21. Writing Applications Two main steps for writing applications Discover Interesting ports Building application logic

  22. Example (discovering and registering ports) Port object Gets all the ports that are registered with the HomeOS platform This serves a dual purpose: (1) callback when a new port is registered (2) determine ports of interest Finding a port of interest

  23. Making calls to operations in roles Role arguments port Operations Synchronous invocation

  24. Making calls to operations in roles (Asynchronous)

  25. Putting all of this together lets see an example.

  26. HomeOS apps + Web interface Web App .Net App WCF framework Use WCF (Windows Communication Foundation) Allows communication between .Net and non-.Net entity This is unlike .Net Remote that is between .Net modules

  27. Web app is written in HTML+Javascript Invokes Javascript functions Web App (html, index.html) Calls made into .NET application

  28. How does WCF work server Service class that implements the interface Javascript functions interface client Interfaces define the contracts contracts are the functionality that the server implements and the client uses has two attributes [ServiceContract] – interface attribute [OperationContract] – function attribute [WebInvoke] --- function attribute stating that the function would be invoked through Javascript/WCF Rest interface

  29. Every HomeOS app has a index.html <div class="dashboard_toolbar"> <div class="homeID_title"><a href="../GuiWeb/index.html">Dashboard</a> | Dummy </div> </div> <div class="page"> <div class="row"> <div class="page_title col">Dummy Application</div> </div> <div><button class="app_button" id="Button1" onclick="ShowDummyPortsInfo()">Update</button></div> <textarea id="DummyList" class="app_form" rows="30" cols="50" wrap="hard"></textarea> <br />

  30. The Javascript function <script> functionShowDummyPortsInfo() { newPlatformServiceHelper().MakeServiceCall("webapp/GetReceivedMessages", "", GetReceivedMessagesCallback); } functionGetReceivedMessagesCallback(context, result) { varportsInfo = result.GetReceivedMessagesResult; $("#DummyList").html(''); for (i = 0; i < result.GetReceivedMessagesResult.length; i++) { $("#DummyList").append(portsInfo[i] + "<br />"); } } </script>

  31. How to instantiate the service from the server Start the server service DummyServicedummyService = new DummyService(logger, this); serviceHost = new SafeServiceHost(logger,typeof(IDummyContract), dummyService , this, Constants.AjaxSuffix, moduleInfo.BaseURL()); serviceHost.Open(); string binarydir = moduleInfo.BinaryDir(); //directory of where the dlls and libraries are string baseurl = moduleInfo.BaseURL(); // baseurl for the application appServer = new WebFileServer(moduleInfo.BinaryDir(), moduleInfo.BaseURL(), logger);

  32. Lets take a look at the implementation of the service class

  33. 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

  34. 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) };

  35. Writing Drivers (setting up Roles)

  36. Writing Drivers (instantiating ports) portInfo = GetPortInfoFromPlatform(name) InitPort(portInfo) BindRoles(port, RoleList)

  37. Writing Drivers logic (synchronous)

  38. Putting all of this together lets see an example.

  39. 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

  40. What do Scouts do Discover devices and report to the platform Host the UI for custom device configuration Hand over control to the platform by pointing to the generic device addition page

More Related