Rev 2114 | Rev 2117 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 2114 | Rev 2116 | ||
|---|---|---|---|
| Line 80... | Line 80... | ||
| 80 | var variables = { |
80 | var variables = { |
| 81 | "Channel" : aliases_data[name]["specific"]["Channel"], |
81 | "Channel" : aliases_data[name]["specific"]["Channel"], |
| 82 | "Protocol" : protocol, |
82 | "Protocol" : protocol, |
| 83 | "IRdata" : data, |
83 | "IRdata" : data, |
| 84 | "Status" : status }; |
84 | "Status" : status }; |
| 85 | - | ||
| - | 85 | Log("will send data to: "+aliases_data[name]["module_name"]+":"+aliases_data[name]["module_id"]+" Data: "+ data + " Prot: "+protocol+" Sts: "+status+"\n"); |
|
| 86 | if (Module_SendMessage(aliases_data[name]["module_name"], aliases_data[name]["module_id"], "IR", variables)) |
86 | if (Module_SendMessage(aliases_data[name]["module_name"], aliases_data[name]["module_id"], "IR", variables)) |
| 87 | { |
87 | { |
| 88 | Log("\033[32mCommand sent successfully to " + name + ".\033[0m\n"); |
88 | Log("\033[32mCommand sent successfully to " + name + ".\033[0m\n"); |
| 89 | } |
89 | } |
| 90 | else |
90 | else |
| 91 | { |
91 | { |
| 92 | Log("\033[31mFailed to send command to " + name + ".\033[0m\n"); |
92 | Log("\033[31mFailed to send command to " + name + ".\033[0m\n"); |
| 93 | } |
93 | } |
| 94 | 94 | ||
| 95 | found = true; |
95 | found = true; |
| 96 | } |
96 | } |
| 97 | 97 | ||
| 98 | if (!found) |
98 | if (!found) |
| 99 | { |
99 | { |
| 100 | Log("\033[31mNo aliases by the name " + alias_name + " were applicable for this command.\033[0m\n"); |
100 | Log("\033[31mNo aliases by the name " + alias_name + " were applicable for this command.\033[0m\n"); |
| 101 | return false; |
101 | return false; |
| 102 | } |
102 | } |
| 103 | 103 | ||
| 104 | return true; |
104 | return true; |
| 105 | } |
105 | } |
| 106 | - | ||
| - | 106 | Console_RegisterCommand(IROut_SendBurst, IROut_StartSendAutoComplete); |
|
| 107 | 107 | ||
| 108 | function IROut_Send(alias_name, remote_name, button_name, status) |
108 | function IROut_Send(alias_name, remote_name, button_name, status) |
| 109 | { |
109 | { |
| 110 | if (arguments.length < 4) |
110 | if (arguments.length < 4) |
| 111 | { |
111 | { |
| 112 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
112 | Log("\033[31mNot enough parameters given.\033[0m\n"); |
| 113 | return false; |
113 | return false; |
| 114 | } |
114 | } |
| 115 | 115 | ||
| 116 | var remote_storage_name = Storage_GetParameter("RemoteList", remote_name); |
116 | var remote_storage_name = Storage_GetParameter("RemoteList", remote_name); |
| 117 | 117 | ||
| 118 | if (!remote_storage_name) |
118 | if (!remote_storage_name) |
| 119 | { |
119 | { |
| 120 | Log("\033[31mNo such remote name in list, " + remote_name + ".\033[0m\n"); |
120 | Log("\033[31mNo such remote name in list, " + remote_name + ".\033[0m\n"); |
| 121 | return false; |
121 | return false; |
| 122 | } |
122 | } |
| 123 | 123 | ||
| 124 | var button_string = Storage_GetParameter(remote_storage_name, button_name); |
124 | var button_string = Storage_GetParameter(remote_storage_name, button_name); |
| Line 149... | Line 149... | ||
| 149 | function IROut_SendBurst(alias_name, remote_name, button_name) |
149 | function IROut_SendBurst(alias_name, remote_name, button_name) |
| 150 | { |
150 | { |
| 151 | return IROut_Send(alias_name, remote_name, button_name, "Burst"); |
151 | return IROut_Send(alias_name, remote_name, button_name, "Burst"); |
| 152 | } |
152 | } |
| 153 | Console_RegisterCommand(IROut_SendBurst, IROut_StartSendAutoComplete); |
153 | Console_RegisterCommand(IROut_SendBurst, IROut_StartSendAutoComplete); |
| - | 154 | ||
| - | 155 | function IROut_SendBurst_Raw(alias_name, data) |
|
| - | 156 | { |
|
| - | 157 | return IROut_Send_Raw(alias_name, "Nexa2", data, "Burst"); |
|
| - | 158 | } |
|
| - | 159 | Console_RegisterCommand(IROut_SendBurst_Raw, function(arg_index, args) { return Console_StandardAutocomplete(arg_index, args, IROut_Aliases()); }); |
|
| 154 | 160 | ||
| 155 | function IROut_SendDuration(alias_name, remote_name, button_name, duration_ms) |
161 | function IROut_SendDuration(alias_name, remote_name, button_name, duration_ms) |
| 156 | { |
162 | { |
| 157 | IROut_Send(alias_name, remote_name, button_name, "Pressed"); |
163 | IROut_Send(alias_name, remote_name, button_name, "Pressed"); |
| 158 | Timer_SetTimer(function(timer) {IROut_StopSend(alias_name);}, duration_ms, false); |
164 | Timer_SetTimer(function(timer) {IROut_StopSend(alias_name);}, duration_ms, false); |