David Blume commited on 2020-03-07 22:37:16
Showing 8 changed files, with 51 additions and 24 deletions.
| ... | ... |
@@ -24,11 +24,17 @@ If you're me, and you want to contribute to the repo, then you can clone it like |
| 24 | 24 |
|
| 25 | 25 |
git clone ssh://USERNAME@dlma.com/~/git/dxb_channel.git |
| 26 | 26 |
|
| 27 |
-# Building it |
|
| 27 |
+## Building it |
|
| 28 | 28 |
|
| 29 | 29 |
[Ensure you can sideload a dev channel](https://sdkdocs.roku.com/display/sdkdoc/Loading+and+Running+Your+Application). |
| 30 | 30 |
Then see the "build\_systems" command in dxb\_channel.sublime-project to see how the channel is zipped and deployed. |
| 31 | 31 |
|
| 32 |
+## Experimenting |
|
| 33 |
+ |
|
| 34 |
+The code in [`components/testtask.brs`](http://git.dlma.com/dxb_channel.git/blob/master/components/testtask.brs) |
|
| 35 |
+is run every time the OK button is pressed (while the "Test Output" pane has focus). |
|
| 36 |
+That's a good place to experiment with new code. |
|
| 37 |
+ |
|
| 32 | 38 |
# Is it any good? |
| 33 | 39 |
|
| 34 | 40 |
[Yes](https://news.ycombinator.com/item?id=3067434). |
| ... | ... |
@@ -55,16 +55,20 @@ function init() |
| 55 | 55 |
m.myTask = CreateObject("roSGNode", "MyTask")
|
| 56 | 56 |
m.myTask.ObserveField("updateText", "onUpdateText")
|
| 57 | 57 |
m.myTask.ObserveField("updateTextLower", "onUpdateTextLower")
|
| 58 |
- m.myTask.ObserveField("updateTextRight", "onUpdateTextRight")
|
|
| 59 | 58 |
m.myTask.control = "RUN" |
| 60 | 59 |
|
| 60 |
+ m.testTask = CreateObject("roSGNode", "TestTask")
|
|
| 61 |
+ m.testTask.ObserveField("updateText", "onUpdateTextRight")
|
|
| 62 |
+ m.testTask.control = "RUN" |
|
| 63 |
+ |
|
| 61 | 64 |
texttimer = m.top.findNode("textTimer")
|
| 62 | 65 |
texttimer.observeField("fire", "timerUpdate")
|
| 63 | 66 |
texttimer.control = "start" |
| 64 | 67 |
|
| 65 | 68 |
m.updates_lower_array = CreateObject("roArray", 10, true)
|
| 69 |
+ m.updates_right_array = CreateObject("roArray", 21, true)
|
|
| 66 | 70 |
|
| 67 |
- m.focus_rect = 3 |
|
| 71 |
+ m.focus_rect = 1 |
|
| 68 | 72 |
doUpdateFocus() |
| 69 | 73 |
|
| 70 | 74 |
m.top.setFocus(true) |
| ... | ... |
@@ -93,22 +97,24 @@ function updateTextLower(s as String) as void |
| 93 | 97 |
end function |
| 94 | 98 |
|
| 95 | 99 |
function onUpdateTextRight() as void |
| 96 |
- if m.updates_right.text.Len() = 0 |
|
| 97 |
- m.updates_right.text = m.myTask.updateTextRight |
|
| 98 |
- else |
|
| 99 |
- m.updates_right.text = m.updates_right.text + chr(10) + m.myTask.updateTextRight |
|
| 100 |
- end if |
|
| 101 |
- print m.myTask.updateTextRight |
|
| 100 |
+ while m.updates_right_array.Count() > 20 |
|
| 101 |
+ m.updates_right_array.Shift() |
|
| 102 |
+ end while |
|
| 103 |
+ m.updates_right_array.Push(m.testTask.updateText) |
|
| 104 |
+ m.updates_right.text = m.updates_right_array.Join(chr(10)) |
|
| 105 |
+ print m.testTask.updateText |
|
| 102 | 106 |
end function |
| 103 | 107 |
|
| 104 | 108 |
function onKeyEvent(key as String, press as Boolean) as Boolean |
| 105 | 109 |
handled = false |
| 106 | 110 |
if press then |
| 107 |
- if (key = "back") then |
|
| 111 |
+ if key = "back" then |
|
| 108 | 112 |
handled = false |
| 109 | 113 |
else |
| 110 | 114 |
update_ui = false |
| 111 |
- if key = "up" |
|
| 115 |
+ if key = "OK" and (m.focus_rect = 1 or m.focus_rect = 2) |
|
| 116 |
+ m.testTask.control = "RUN" |
|
| 117 |
+ elseif key = "up" |
|
| 112 | 118 |
if m.focus_rect = 2: |
| 113 | 119 |
m.focus_rect = 1 |
| 114 | 120 |
elseif m.focus_rect = 3 |
| ... | ... |
@@ -46,16 +46,6 @@ function executeTask() as void |
| 46 | 46 |
success = deviceInfo.EnableCodecCapChangedEvent(true) |
| 47 | 47 |
if not success then m.top.updateTextLower = "EnableCodecCapChangedEvent failure" |
| 48 | 48 |
|
| 49 |
- ' |
|
| 50 |
- ' This is a good place to experiment. |
|
| 51 |
- ' Here, we print the GetConnectionInfo AssociativeArray. |
|
| 52 |
- ' |
|
| 53 |
- aaConnectionInfo = deviceInfo.GetConnectionInfo() |
|
| 54 |
- for each key in aaConnectionInfo |
|
| 55 |
- val = aaConnectionInfo[key] |
|
| 56 |
- m.top.updateTextRight = key + " = " + val.ToStr() |
|
| 57 |
- end for |
|
| 58 |
- |
|
| 59 | 49 |
while(true) |
| 60 | 50 |
msg = wait(0, port) |
| 61 | 51 |
msgType = type(msg) |
| ... | ... |
@@ -0,0 +1,16 @@ |
| 1 |
+sub init() |
|
| 2 |
+ m.top.functionName = "executeTest" |
|
| 3 |
+end sub |
|
| 4 |
+ |
|
| 5 |
+function executeTest() as void |
|
| 6 |
+ ' This task gets run one at the start, and then |
|
| 7 |
+ ' again every time the OK button is pressed. |
|
| 8 |
+ |
|
| 9 |
+ deviceInfo = CreateObject("roDeviceInfo")
|
|
| 10 |
+ aaConnectionInfo = deviceInfo.GetConnectionInfo() |
|
| 11 |
+ for each key in aaConnectionInfo |
|
| 12 |
+ val = aaConnectionInfo[key] |
|
| 13 |
+ m.top.updateText = key + " = " + val.ToStr() |
|
| 14 |
+ end for |
|
| 15 |
+ |
|
| 16 |
+end function |