Rev 1997 | Rev 2114 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1997 | Rev 2072 | ||
|---|---|---|---|
| Line 4... | Line 4... | ||
| 4 | IROut_Statuses = function() { return [ "Pressed", "Released", "Burst" ]; }; |
4 | IROut_Statuses = function() { return [ "Pressed", "Released", "Burst" ]; }; |
| 5 | IROut_Protocols = function() { return [ "RC5", "RC6", "RCMM", "SIRC", "Sharp", "NEC", "Samsung", "Marantz", "Panasonic", "Sky", "Nexa2" ]; }; |
5 | IROut_Protocols = function() { return [ "RC5", "RC6", "RCMM", "SIRC", "Sharp", "NEC", "Samsung", "Marantz", "Panasonic", "Sky", "Nexa2", "Nexa" ]; }; |
| 6 | IROut_Aliases = function() { return Module_GetAliasNames(IROut_ModuleNames); }; |
6 | IROut_Aliases = function() { return Module_GetAliasNames(IROut_ModuleNames); }; |
| 7 | IROut_AvailableIds = function() { return Module_GetAvailableIds(IROut_ModuleNames); }; |
7 | IROut_AvailableIds = function() { return Module_GetAvailableIds(IROut_ModuleNames); }; |
| 8 | 8 | ||
| 9 | function IROut_StopSend(alias_name) |
9 | function IROut_StopSend(alias_name) |
| 10 | { |
10 | { |
| Line 62... | Line 62... | ||
| 62 | return get_keys(Storage_GetParameters(remote_storage_name)); |
62 | return get_keys(Storage_GetParameters(remote_storage_name)); |
| 63 | } |
63 | } |
| 64 | 64 | ||
| 65 | return []; |
65 | return []; |
| 66 | } |
66 | } |
| - | 67 | ||
| - | 68 | function IROut_Send_Raw(alias_name, protocol, data, status) |
|
| - | 69 | { |
|
| - | 70 | if (arguments.length < 4) |
|
| - | 71 | { |
|
| - | 72 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
|
| - | 73 | return false; |
|
| - | 74 | } |
|
| - | 75 | ||
| - | 76 | var aliases_data = Module_ResolveAlias(alias_name, IROut_ModuleNames); |
|
| - | 77 | ||
| - | 78 | for (var name in aliases_data) |
|
| - | 79 | { |
|
| - | 80 | var variables = { |
|
| - | 81 | "Channel" : aliases_data[name]["specific"]["Channel"], |
|
| - | 82 | "Protocol" : protocol, |
|
| - | 83 | "IRdata" : data, |
|
| - | 84 | "Status" : status }; |
|
| - | 85 | ||
| - | 86 | if (Module_SendMessage(aliases_data[name]["module_name"], aliases_data[name]["module_id"], "IR", variables)) |
|
| - | 87 | { |
|
| - | 88 | Log("\033[32mCommand sent successfully to " + name + ".\033[0m\n"); |
|
| - | 89 | } |
|
| - | 90 | else |
|
| - | 91 | { |
|
| - | 92 | Log("\033[31mFailed to send command to " + name + ".\033[0m\n"); |
|
| - | 93 | } |
|
| - | 94 | ||
| - | 95 | found = true; |
|
| - | 96 | } |
|
| - | 97 | ||
| - | 98 | if (!found) |
|
| - | 99 | { |
|
| - | 100 | Log("\033[31mNo aliases by the name " + alias_name + " were applicable for this command.\033[0m\n"); |
|
| - | 101 | return false; |
|
| - | 102 | } |
|
| - | 103 | ||
| - | 104 | return true; |
|
| - | 105 | } |
|
| - | 106 | ||
| 67 | 107 | ||
| 68 | function IROut_Send(alias_name, remote_name, button_name, status) |
108 | function IROut_Send(alias_name, remote_name, button_name, status) |
| 69 | { |
109 | { |
| 70 | if (arguments.length < 4) |
110 | if (arguments.length < 4) |
| 71 | { |
111 | { |
| 72 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
112 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
| 73 | return false; |
113 | return false; |
| 74 | } |
114 | } |
| 75 | - | ||
| 76 | var result_text = ""; |
- | |
| 77 | var aliases_data = Module_ResolveAlias(alias_name, IROut_ModuleNames); |
- | |
| 78 | 115 | ||
| 79 | var remote_storage_name = Storage_GetParameter("RemoteList", remote_name); |
116 | var remote_storage_name = Storage_GetParameter("RemoteList", remote_name); |
| 80 | 117 | ||
| 81 | if (!remote_storage_name) |
118 | if (!remote_storage_name) |
| 82 | { |
119 | { |
| Line 98... | Line 135... | ||
| 98 | { |
135 | { |
| 99 | Log("\033[31mButton data is corrupt.\033[0m\n"); |
136 | Log("\033[31mButton data is corrupt.\033[0m\n"); |
| 100 | return false; |
137 | return false; |
| 101 | } |
138 | } |
| 102 | 139 | ||
| 103 | for (var name in aliases_data) |
- | |
| 104 | { |
- | |
| 105 | var variables = { |
- | |
| 106 | "Channel" : aliases_data[name]["specific"]["Channel"], |
- | |
| 107 | "Protocol" : button_data["protocol"], |
- | |
| 108 | "IRdata" : button_data["data"], |
- | |
| 109 | "Status" : status }; |
- | |
| 110 | - | ||
| 111 |
|
140 | return IROut_Send_Raw(alias_name, button_data["protocol"], button_data["data"], status); |
| 112 | { |
- | |
| 113 | Log("\033[32mCommand sent successfully to " + name + ".\033[0m\n"); |
- | |
| 114 | } |
- | |
| 115 | else |
- | |
| 116 | { |
- | |
| 117 | Log("\033[31mFailed to send command to " + name + ".\033[0m\n"); |
- | |
| 118 | } |
- | |
| 119 | - | ||
| 120 | found = true; |
- | |
| 121 | } |
- | |
| 122 | - | ||
| 123 | if (!found) |
- | |
| 124 | { |
- | |
| 125 | Log("\033[31mNo aliases by the name " + alias_name + " were applicable for this command.\033[0m\n"); |
- | |
| 126 | return false; |
- | |
| 127 | } |
- | |
| 128 | - | ||
| 129 | return true; |
- | |
| 130 | } |
141 | } |
| 131 | 142 | ||
| 132 | function IROut_StartSend(alias_name, remote_name, button_name) |
143 | function IROut_StartSend(alias_name, remote_name, button_name) |
| 133 | { |
144 | { |
| 134 | return IROut_Send(alias_name, remote_name, button_name, "Pressed"); |
145 | return IROut_Send(alias_name, remote_name, button_name, "Pressed"); |