Browse Source

Checkpoint of work on Remote interface.

Douglas William Thrift 12 years ago
parent
commit
c3cdc1836f
2 changed files with 45 additions and 4 deletions
  1. 35 0
      remote/__init__.py
  2. 10 4
      remote/vornado.py

+ 35 - 0
remote/__init__.py

@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# DT Home
+#  Remote
+#
+# Douglas Thrift
+#
+# __init__.py
+
+#  Copyright 2012 Douglas Thrift
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+class Remote(object):
+    def __init__(self, *args, **kwargs):
+        pass
+
+def ir_command(method):
+    def command(self, *args, **kwargs):
+        code = method(self, *args, **kwargs)
+
+        print code
+
+    return command
+
+from remote.vornado import VornadoRemote

+ 10 - 4
vornado.py → remote/vornado.py

@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 # DT Home
-#  Vornado
+#  Vornado Remote
 #
 # Douglas Thrift
 #
@@ -18,11 +18,12 @@
 #  distributed under the License is distributed on an "AS IS" BASIS,
 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #  See the License for the specific language governing permissions and
+#  limitations under the License.
 
-class Vornado(object):
-    def __init__(self):
-        pass
+import remote
 
+class VornadoRemote(remote.Remote):
+    @remote.ir_command
     def mode(self):
         return '''
             0000 006D 0000 0054 002F 0010 002F 0010 0010 0031 002F 0011 002F
@@ -41,6 +42,7 @@ class Vornado(object):
             0031 002F 0F8F
         '''
 
+    @remote.ir_command
     def power(self):
         return '''
             0000 006C 0000 006C 002F 0010 002F 0010 0010 0031 002F 0011 002F
@@ -62,6 +64,7 @@ class Vornado(object):
             0010 0031 0010 0031 002F 0010 0010 0031 0010 0031 0010 0F93
         '''
 
+    @remote.ir_command
     def timer_up(self):
         return '''
             0000 006D 0000 0090 002F 0010 002F 0010 0010 0031 002F 0011 002F
@@ -89,6 +92,7 @@ class Vornado(object):
             0010 0031 002F 0010 002F 0F8F
         '''
 
+    @remote.ir_command
     def timer_down(self):
         return '''
             0000 006D 0000 0078 002F 0010 002F 0010 0010 0031 002F 0011 002F
@@ -112,6 +116,7 @@ class Vornado(object):
             0010 0031 0010 0031 0010 0031 0010 0031 0010 0F91
         '''
 
+    @remote.ir_command
     def temp_up(self):
         return '''
             0000 006C 001E 0007 002F 0011 002F 0011 0010 0031 002F 0011 002F
@@ -122,6 +127,7 @@ class Vornado(object):
             0091 002F 0091 0010 0031 0010 0031 0010 0031 0010 0031 002F 15D7
         '''
 
+    @remote.ir_command
     def temp_down(self):
         return '''
             0000 006D 0000 006C 002F 0010 002F 0010 0010 0031 002F 0011 002F