Index: /tags/release-1.0/D_eZ430Chronos.xml
===================================================================
--- /tags/release-1.0/D_eZ430Chronos.xml	(revision 3)
+++ /tags/release-1.0/D_eZ430Chronos.xml	(revision 3)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<root xmlns="urn:schemas-upnp-org:device-1-0">
+  <specVersion>
+    <major>1</major>
+    <minor>0</minor>
+  </specVersion>
+  <device>
+    <deviceType>urn:schemas-ti-com:device:RFWatch:1</deviceType>
+    <staticJson>D_eZ430Chronos.json</staticJson>
+    <friendlyName>TI eZ430-Chronos RF Watch</friendlyName>
+    <manufacturer>Texas Instruments</manufacturer>
+    <manufacturerURL>http://www.ti.com</manufacturerURL>
+    <modelDescription>Wearable Wireless Development System</modelDescription>
+    <modelName>eZ430-Chronos</modelName>
+    <modelNumber>1.0</modelNumber>
+    <protocol>raw</protocol>
+
+    <implementationList>
+        <implementationFile>I_eZ430Chronos.xml</implementationFile>
+    </implementationList>
+
+    <serviceList>
+      <service>
+        <serviceType>urn:schemas-micasaverde-com:service:HaDevice:1</serviceType>
+        <serviceId>urn:micasaverde-com:serviceId:HaDevice1</serviceId>
+        <SCPDURL>S_HaDevice1.xml</SCPDURL>
+      </service>
+    </serviceList>
+  </device>
+</root>
Index: /tags/release-1.0/I_eZ430Chronos.xml
===================================================================
--- /tags/release-1.0/I_eZ430Chronos.xml	(revision 3)
+++ /tags/release-1.0/I_eZ430Chronos.xml	(revision 3)
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+<implementation>
+    <functions>
+      --- Constants ---
+
+      local MODULE_NAME = "eZ430-Chronos"
+      local HADEVICE_SID = "urn:micasaverde-com:serviceId:HaDevice1"
+      local POLL_INTERVAL = "1"
+
+      local NUM_BUTTONS = 3
+      local BUTTON_CODE_ASTERISK = 18
+      local BUTTON_CODE_POUND = 34
+      local BUTTON_CODE_UP = 50
+      local BUTTON_CODES = {BUTTON_CODE_ASTERISK, BUTTON_CODE_POUND, BUTTON_CODE_UP}
+      local BUTTON_NAMES = {"*_Button", "#_Button", "UP_Button"}
+      local BUTTON_VALS = {"Off", "On"}
+
+      local PROT_INIT = "\255\007\003" 
+      local PROT_REQ  = "\255\008\007\000\000\000\000"
+      local PROT_ACK  = "\255\006\003"
+
+      -- Variables ---
+
+      local data_count = 0
+      local old_button = 0xFF
+      local buttons = {0, 0, 0}
+
+      --- Functions ---
+
+      function requestData()
+        luup.io.write(PROT_REQ)
+
+        -- schedule next call
+        luup.call_timer("requestData", 1, POLL_INTERVAL, "", "") 
+      end
+
+
+      function chronosStartup(lul_device)
+        local desc = luup.devices[lul_device].description .. "[" .. lul_device .. "]"
+
+        luup.log("starting " .. MODULE_NAME .. " device: " .. desc)
+      
+        -- check IO connection
+        if (not luup.io.is_connected(lul_device)) then
+          luup.log("IO port not open", 1)
+          return false, "IO port not open", desc
+        end
+
+        -- initialize device and start access point
+        luup.io.write(PROT_INIT)
+
+        -- read initialization ACK
+        for i = 1,PROT_ACK:len() do
+          luup.io.intercept()
+          local data = luup.io.read()
+          if (data == nil or data:byte(1) ~= PROT_ACK:byte(i)) then
+            luup.log("cannot initialize device", 1)
+            return false, "Cannot initialize device", desc
+          end
+        end
+
+        -- initialize variables
+        for i = 1,NUM_BUTTONS do
+          local value = luup.variable_get(HADEVICE_SID, BUTTON_NAMES[i], lul_device)
+          if (value ~= nil) then
+            -- copy value from variable to buttons
+            if (value == "On") then
+              buttons[i] = 1;
+            else
+              buttons[i] = 0;
+            end
+          else
+            -- copy value from buttons to variable
+            luup.variable_set(HADEVICE_SID, BUTTON_NAMES[i], BUTTON_VALS[buttons[i]+1], lul_device, true)
+          end
+        end
+
+        -- begin requesting data from chronos
+        requestData()
+
+        luup.log("finished initializing device: " .. desc)
+        return true, 'OK', desc
+      end
+    </functions>
+
+    <incoming>
+      <lua>
+        data_count = data_count + 1
+        if (data_count == 4) then
+          local button = lul_data:byte(1)
+
+	  if (button ~= old_button) then
+	    old_button = button
+
+            for i = 1,NUM_BUTTONS do
+	      if (button == BUTTON_CODES[i]) then
+	        buttons[i] = 1 - buttons[i]
+                luup.variable_set(HADEVICE_SID, BUTTON_NAMES[i], BUTTON_VALS[buttons[i]+1], lul_device)
+              end
+            end
+          end
+        elseif (data_count == 7) then
+	  data_count = 0
+	end
+      </lua>
+    </incoming>
+
+    <startup>chronosStartup</startup>
+</implementation>
Index: /tags/release-1.0/D_eZ430Chronos.json
===================================================================
--- /tags/release-1.0/D_eZ430Chronos.json	(revision 3)
+++ /tags/release-1.0/D_eZ430Chronos.json	(revision 3)
@@ -0,0 +1,195 @@
+{
+    "flashicon": "icons\/generic_sensor.swf",
+    "imgIconBody": "",
+    "imgIconDimmable": "",
+    "imgIconTurnable": "",
+    "imgIconMin": "",
+    "imgIconMax": "",
+    "halloIconsDir": "pics\/hallo",
+    "DisplayStatus": {
+    },
+    "doc_url": {
+        "doc_language": 1,
+        "doc_manual": 1,
+        "doc_version": 1,
+        "doc_platform": 0,
+        "doc_page": "devices" 
+    },
+    "Tabs": [
+        {
+            "Label": {
+                "lang_tag": "tabname_status",
+                "text": "Status" 
+            },
+            "Position": "0",
+            "TabType": "flash",
+            "ControlGroup": [
+                {
+                    "id": "1",
+                    "type": "info"
+                },
+                {
+                    "id": "2",
+                    "type": "info"
+                },
+                {
+                    "id": "3",
+                    "type": "info"
+                }
+            ],
+            "Control": [
+                {
+                    "ControlGroup": "1",
+                    "ControlHeader": "1",
+                    "ControlType": "label",
+                    "Label": {
+                        "lang_tag": "desc",
+                        "text": "[*] Button:" 
+                    },
+                    "Display": {
+                        "Top": 20,
+                        "Left": 50,
+                        "Width": 100,
+                        "Height": 20 
+                    } 
+                },
+                {
+                    "ControlGroup": "1",
+                    "ControlHeader": "1",
+                    "ControlType": "variable",
+                    "Display": {
+                        "Service": "urn:micasaverde-com:serviceId:HaDevice1",
+                        "Variable": "*_Button",
+                        "Top": 20,
+                        "Left": 151,
+                        "Width": 50,
+                        "Height": 20
+                    }
+                },
+                {
+                    "ControlGroup": "2",
+                    "ControlHeader": "1",
+                    "ControlType": "label",
+                    "Label": {
+                        "lang_tag": "desc",
+                        "text": "[#] Button:" 
+                    },
+                    "Display": {
+                        "Top": 40,
+                        "Left": 50,
+                        "Width": 100,
+                        "Height": 20 
+                    } 
+                },
+                {
+                    "ControlGroup": "2",
+                    "ControlHeader": "1",
+                    "ControlType": "variable",
+                    "Display": {
+                        "Service": "urn:micasaverde-com:serviceId:HaDevice1",
+                        "Variable": "#_Button",
+                        "Top": 40,
+                        "Left": 151,
+                        "Width": 50,
+                        "Height": 20
+                    }
+                },
+                {
+                    "ControlGroup": "3",
+                    "ControlHeader": "1",
+                    "ControlType": "label",
+                    "Label": {
+                        "lang_tag": "desc",
+                        "text": "[U] Button:" 
+                    },
+                    "Display": {
+                        "Top": 60,
+                        "Left": 50,
+                        "Width": 100,
+                        "Height": 20 
+                    } 
+                },
+                {
+                    "ControlGroup": "3",
+                    "ControlHeader": "1",
+                    "ControlType": "variable",
+                    "Display": {
+                        "Service": "urn:micasaverde-com:serviceId:HaDevice1",
+                        "Variable": "UP_Button",
+                        "Top": 60,
+                        "Left": 151,
+                        "Width": 50,
+                        "Height": 20
+                    }
+                }
+            ] 
+        },
+        {
+            "Label": {
+                "lang_tag": "tabname_advanced",
+                "text": "Advanced" 
+            },
+            "Position": "2",
+            "TabType": "javascript",
+            "ScriptName": "shared.js",
+            "Function": "advanced_device" 
+        }
+    ],
+    "DeviceType": "urn:schemas-ti-com:device:RFWatch:1",
+    "eventList": {
+        "event_1": {
+            "label": "The * button is toggled",
+            "serviceId": "urn:micasaverde-com:serviceId:HaDevice1",
+            "argumentList": {
+                "argument_1": {
+                    "dataType": "string",
+                    "defaultValue": "On",
+                    "allowedValueList": {
+                        "Off": "Off",
+                        "On": "On"
+                    },
+                    "name": "*_Button",
+                    "comparisson": "=",
+                    "prefix": "Button state",
+                    "suffix": ""
+                }
+            }
+        },
+        "event_2": {
+            "label": "The # button is toggled",
+            "serviceId": "urn:micasaverde-com:serviceId:HaDevice1",
+            "argumentList": {
+                "argument_1": {
+                    "dataType": "string",
+                    "defaultValue": "On",
+                    "allowedValueList": {
+                        "Off": "Off",
+                        "On": "On"
+                    },
+                    "name": "#_Button",
+                    "comparisson": "=",
+                    "prefix": "Button state",
+                    "suffix": ""
+                }
+            }
+        },
+        "event_3": {
+            "label": "The up button is toggled",
+            "serviceId": "urn:micasaverde-com:serviceId:HaDevice1",
+            "argumentList": {
+                "argument_1": {
+                    "dataType": "string",
+                    "defaultValue": "On",
+                    "allowedValueList": {
+                        "Off": "Off",
+                        "On": "On"
+                    },
+                    "name": "UP_Button",
+                    "comparisson": "=",
+                    "prefix": "Button state",
+                    "suffix": ""
+                }
+            }
+        }
+    }
+}
