1. develop and edit HAR project

The architecture of HomeCenter Server is as following:
  • the yellow area is HAR Project.
  • smart device jar lib is provided by device vender, it is NOT included in HomeCenter Server.
  • Menu and Menu Item in HAR project will be displayed on mobile when mobile successful connect to server.
  • Event script will be executed by JRuby engine when the event occurs whether or not mobile connecting.
  • more than one active HAR projects is allowed and effective.

  1. right click tray icon of HomeCenter server, system display like following :

  2. click "Designer"

  3. System will display following window(for example : Demo project, there are thirteen items in mobile menu) :

    Demo :
    Demo project is the best way to know more about HomeCenter smart device develop platform, there are many user cases and API in it. You may customize new project rapidly based on it.

    New :
    create an empty project

    Add :
    add a menu item to the current mobile menu, such as controller, UI panel(Mlet) for smart device, batch script, etc.

    Save :
    save project

    Activate :
    activate current project. If current project is the only active project, the menu is the primary menu for mobile. If no HAR project is active, the mobile access PC desktop only.

    Deactivate :
    deactivate current project. It is inverse operation of Activate.

    Save as :
    save current project as har file to some disk directory.
    • If there is a upgrade URL in project, had file is also created, please upload both har and had files to the host of vender of smart device for upgrading.
    • If you want to share the project to friends, just load the har file on server of your friends.

    Load :
    load har file for editing and deploying.

    Shift Project :
    shift to other project for editing. Click it , enter Project Manage dialog, select one project, and click "Designer" to return here for editing it.

    Help :
    introduce the main functions of this designer.

  4. Menu Tree : it is on the left side, there are following types of node in it :
    • project node : the [Sample Project, ver:1.0] in tree
      • Name : the name of project
      • ID : the ID of project, it is used for install and upgrading
      • ver : version number
      • URL : the upgrade URL. please keep blank if no need upgrade. For example, "http://example.com/dir_or_virtual/tv.had", Note : it is tv.had(the description of project), not tv.har(the archive file of project). Please upload the two files to directory dir_or_virtual on host of vender. these two files will be created after clicking Save as button.
    • menu node : the [Sample Menu] in tree
      • Name : title of the menu
      • Column Number : the column number for arrangement. System will calculate the optimal number of columns if it is zero.
      • up : move up the selected menu item
      • down : move down the selected menu item
    • event node : the [SYS_PROJ_STARTUP] in tree
      • Event : the event tag
      • Test Script : test and run the script in (JRuby script) area. If there is syntax error in it, it will be highlighted.
      • JRuby script : System will execute the script when the event is occur

      list of events :
      • SYS_PROJ_STARTUP : it will be executed when system startup or reload project
      • SYS_MOBILE_LOGIN : it will be executed when mobile is successful connecting
      • SYS_MOBILE_LOGOUT : it will be executed when mobile logout or mobile is off-line
      • SYS_PROJ_SHUTDOWN : it will be executed when system shutdown or stop service of HAR project. If mobile is online, the SYS_MOBILE_LOGOUT is triggered first
    • menu item node : the [Air Ctrler [controller://myctrl1]] in tree
      • Display Name : the name of menu item
      • Change Icon [64 X 64] : change the icon of the menu item, 64X64 is recommended
      • target locator : the service ID of current item. some target locators are special and fixed, you can't edit it, such as exit and jump to desktop
      • other : there is some difference between types of node

      The node is a air controller, Air Ctrler [controller://myctrl1], in the left Menu Tree. Air Ctrler is Display Name, controller is the type of the node, myctrl1 is the service ID and is target Locator

      Steps of deleting menu item :
      1. right click on menu item node,
      2. click del menu item
    • Share JRuby Files node : the [sharefunc.rb] in tree
      • Script File Name : name of share JRuby script file
      • Test Script : test and run the script in (JRuby script) area. If there is syntax error in it, it will be highlighted.
      • JRuby script : the content of script file

      Share JRuby Files node provides shared and common functions/methods/instances.

      Steps of adding new Share JRuby Files node :
      1. right click Share JRuby Files, it display like following :
      2. click add JRuby share file

      Steps of deleting Share JRuby Files node :
      1. right click on the node which you want to delete, for example sharefunc.rb,
      2. click del JRuby file
    • Share Jar Files node : the [testlib.jar, version:1.0] in tree
      • Name : the name of jar library
      • ver : version of jar library

      Share Jar Files node provides shared and common class/methods/driver(for smart device)

      Steps of adding new Share Jar Files :
      1. right click Share Jar Files node, it display like following :
      2. click add jar file, choose jar file

      Steps of deleting Share Jar Files node :
      1. right click the node which you want to delete, for example testlib.jar, version:1.0,
      2. click del jar file

      Steps of exporting Share Jar Files node :
      1. right click the node you want to save as, for example testlib.jar, version:1.0,
      2. click save as ..., input the new file name in file dialog, click "OK"

  5. Steps of adding menu item :
    1. click add button in toolbar, a dialog like following is displayed :

      there are three node types :
      • CONTROLLER : you can customize the layout of button for controller, and program the response for clicking button on controller
      • CMD : execute an action or script. For example : exit, configure, or running JRuby script on PC server
        1. click CMD icon, the dialog display like following :

          OK is changed to Next
        2. click Next icon, the sub dialog is popped out :

          There are three sub types in CMD :
          • my-command : If the menu item is clicked on mobile phone, the JRuby script will be executed on your HomeCenter server
          • exit : exit mobile or return to parent menu(if current menu is not primary menu in mobile)
          • config : If the menu item is clicked on mobile phone, the configuration dialog of mobile phone will be opened
      • SCREEN : display desktop of PC or a GUI panel for controlling(Mlet)
        1. click SCREEN icon, it displays like following :

          OK is changed to Next
        2. click Next button, a sub dialog is popped out :

          There are two sub types of SCREEN :
          • desktop : If the menu item is clicked on mobile phone, remote desktop of your HomeCenter server will be displayed on your mobile phone, you can control server now
          • mlet : If the menu item is clicked on mobile phone, a GUI instance of (Mlet) is generated in your HomeCenter server, and the GUI panel of Mlet is presented on mobile phone, you can click or operate the snapshot of these components on mobile, your server will receive these events, drive smart device or change status.
            (Mlet) is based on JRuby and Java GUI programming model

  • return to tutorials of HomeCenter server