summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-11-02 17:08:49 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-11-02 17:08:49 +0100
commitd78b37bc98dab30939397ba59e2b1fdcb374caf2 (patch)
tree3ca5b15f171000b4808a627c61f63dec5a1eee63
parent26427226fa701d90a8aa107ef0709ee19d6f2c54 (diff)
Add button (not working) see m.b. KmeFcoKeyList
-rw-r--r--include/opcodes.hrl1
-rw-r--r--src/button.erl15
-rw-r--r--src/rose.erl5
-rw-r--r--src/tda.erl5
4 files changed, 25 insertions, 1 deletions
diff --git a/include/opcodes.hrl b/include/opcodes.hrl
index 54f3771..dfddbfe 100644
--- a/include/opcodes.hrl
+++ b/include/opcodes.hrl
@@ -3,3 +3,4 @@
-define(MONITOR, {local, 71}).
-define(SNAPSHOT, {local, 74}).
-define(STATUS, {local, 211}).
+-define(BUTTON, {local, 262}).
diff --git a/src/button.erl b/src/button.erl
new file mode 100644
index 0000000..006fd45
--- /dev/null
+++ b/src/button.erl
@@ -0,0 +1,15 @@
+-module(button).
+
+-export([decode/1, encode/1]).
+
+-include("CSTA-get-button-information.hrl").
+-include("CSTA-device-identifiers.hrl").
+
+decode(Data) ->
+ 'CSTA-get-button-information':decode('GetButtonInformationResult', Data).
+
+encode(Device) ->
+ 'CSTA-get-button-information':encode('GetButtonInformationArgument',
+ #'GetButtonInformationArgument'{
+ device = #'DeviceID'{
+ deviceIdentifier = {deviceNumber, Device}}}).
diff --git a/src/rose.erl b/src/rose.erl
index 18b661a..0870e72 100644
--- a/src/rose.erl
+++ b/src/rose.erl
@@ -21,6 +21,8 @@ invoke(Op, {ok, Data}) ->
dispatch({invoke, #'Invoke'{invokeId = Id, opcode = Op, argument = Data}}) ->
counter:set(Id),
case Op of
+ ?BUTTON ->
+ ok;
?EVENT ->
{ok, Event} = event:decode(Data),
io:format("Event: ~p~n", [Event]),
@@ -54,6 +56,9 @@ dispatch({reject, #'Reject'{invokeId = Id, problem = Problem}}) ->
dispatch(#'ReturnResult_result'{opcode = Op, result = Data}) ->
case Op of
+ ?BUTTON ->
+ {ok, List} = button:decode(Data),
+ io:format("List: ~p~n", [List]);
?MONITOR ->
{ok, Status} = monitor:decode(Data),
io:format("Result: ~p~n", [Status]);
diff --git a/src/tda.erl b/src/tda.erl
index b724e15..e99fb93 100644
--- a/src/tda.erl
+++ b/src/tda.erl
@@ -1,7 +1,7 @@
-module(tda).
-export([start/0, client/1, stop/0, decode/1]).
--export([send/1, ext/0, co/0, snapshot/1, monitor/1]).
+-export([send/1, ext/0, co/0, snapshot/1, monitor/1, button/1]).
-include("config.hrl").
-include("opcodes.hrl").
@@ -25,6 +25,9 @@ send(Reply) ->
snapshot(Device) ->
?MODULE ! rose:invoke(?SNAPSHOT, snapshot:encode(Device)).
+button(Device) ->
+ ?MODULE ! rose:invoke(?BUTTON, button:encode(Device)).
+
monitor(Device) ->
?MODULE ! rose:invoke(?MONITOR, monitor:encode(Device)).