Skip to content

Commit 85c4a0b

Browse files
committedDec 12, 2024·
feat: ⚡ add ability to manually poll from simpl bridge or devjson examples.
Out of the box polling is 15 seconds. If faster polling is required an option to manually poll via simpl bridge or devjson has been added.
1 parent 9241fc9 commit 85c4a0b

File tree

3 files changed

+55
-5
lines changed

3 files changed

+55
-5
lines changed
 

‎README.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
# Megapixel Helios (c) 2024
66

7+
Minimum Helios firmware version = `24.11.0.23030`
8+
79
## License
810

911
Provided under MIT license
@@ -83,6 +85,7 @@ The `port` object is only needed when overriding the default HTTP `80` or HTTPS
8385
| ----------- | --------- | -------------------- | ------- | ------------ |
8486
| 1 | 1 | Power Off (blackout) | Digital | ToFromSIMPL |
8587
| 2 | 1 | Power On (blackout) | Digital | ToFromSIMPL |
88+
| 3 | 1 | Poll (public API) | Digital | FromSIMPL |
8689
| 4 | 1 | Redundancy Role Main | Digital | ToFromSIMPL |
8790
| 5 | 1 | Redundancy Role Backup | Digital | ToFromSIMPL |
8891
| 6 | 1 | Redundancy Role Offline | Digital | ToFromSIMPL |
@@ -136,6 +139,7 @@ Public Methods that can be used with `devjson` to test controls.
136139
```json
137140
devjson:1 {"deviceKey":"display-1","methodName":"PowerOn" ,"params":[ ]}
138141
devjson:1 {"deviceKey":"display-1","methodName":"PowerOff" ,"params":[ ]}
142+
devjson:1 {"deviceKey":"display-1","methodName":"Poll" ,"params":[ ]}
139143
devjson:1 {"deviceKey":"display-1","methodName":"GetRedundancyState" ,"params":[ ]}
140144
devjson:1 {"deviceKey":"display-1","methodName":"SetRedundancyRoleToMain" ,"params":[ ]}
141145
devjson:1 {"deviceKey":"display-1","methodName":"SetRedundancyRoleToBackup" ,"params":[ ]}

‎src/MegapixelHelioBridgeJoinMap.cs

+14
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ public class MegapixelHeliosBridgeJoinMap : JoinMapBaseAdvanced
3737
JoinType = eJoinType.Digital
3838
});
3939

40+
[JoinName("Poll")]
41+
public JoinDataComplete Poll = new JoinDataComplete(
42+
new JoinData
43+
{
44+
JoinNumber = 3,
45+
JoinSpan = 1
46+
},
47+
new JoinMetadata
48+
{
49+
Description = "Poll device public API",
50+
JoinCapabilities = eJoinCapabilities.FromSIMPL,
51+
JoinType = eJoinType.Digital
52+
});
53+
4054
[JoinName("SetRedundancyRoleToMain")]
4155
public JoinDataComplete SetRedundancyRoleToMain = new JoinDataComplete(
4256
new JoinData

‎src/MegapixelHeliosController.cs

+37-5
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,8 @@ public override void LinkToApi(BasicTriList trilist, uint joinStart, string join
505505
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, PowerOn);
506506
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, PowerOff);
507507

508+
trilist.SetSigTrueAction(joinMap.Poll.JoinNumber, () => Poll());
509+
508510
trilist.SetSigTrueAction(joinMap.TestPatternOn.JoinNumber, TestPatternOn);
509511
trilist.SetSigTrueAction(joinMap.TestPatternOff.JoinNumber, TestPatternOff);
510512

@@ -1051,7 +1053,13 @@ public void PowerOn()
10511053
}
10521054

10531055
Debug.Console(MegapixelHeliosDebug.Notice, this, "PowerOn: content-'{0}'", content);
1054-
_client.SendRequest("PATCH", "/api/v1/public", content);
1056+
1057+
CrestronInvoke.BeginInvoke((o) =>
1058+
{
1059+
_client.SendRequest("PATCH", "/api/v1/public", content);
1060+
Thread.Sleep(2000);
1061+
Poll();
1062+
});
10551063
}
10561064

10571065
/// <summary>
@@ -1083,7 +1091,13 @@ public void PowerOff()
10831091
}
10841092

10851093
Debug.Console(MegapixelHeliosDebug.Notice, this, "PowerOff: content-'{0}'", content);
1086-
_client.SendRequest("PATCH", "/api/v1/public", content);
1094+
1095+
CrestronInvoke.BeginInvoke((o) =>
1096+
{
1097+
_client.SendRequest("PATCH", "/api/v1/public", content);
1098+
Thread.Sleep(2000);
1099+
Poll();
1100+
});
10871101
}
10881102

10891103
/// <summary>
@@ -1156,7 +1170,13 @@ public void TestPatternOn()
11561170
}
11571171

11581172
Debug.Console(MegapixelHeliosDebug.Notice, this, "TestPatternEnable: content-'{0}'", content);
1159-
_client.SendRequest("PATCH", "/api/v1/public", content);
1173+
1174+
CrestronInvoke.BeginInvoke((o) =>
1175+
{
1176+
_client.SendRequest("PATCH", "/api/v1/public", content);
1177+
Thread.Sleep(2000);
1178+
Poll();
1179+
});
11601180
}
11611181

11621182
/// <summary>
@@ -1191,7 +1211,13 @@ public void TestPatternOff()
11911211
}
11921212

11931213
Debug.Console(MegapixelHeliosDebug.Notice, this, "TestPatternEnable: content-'{0}'", content);
1194-
_client.SendRequest("PATCH", "/api/v1/public", content);
1214+
1215+
CrestronInvoke.BeginInvoke((o) =>
1216+
{
1217+
_client.SendRequest("PATCH", "/api/v1/public", content);
1218+
Thread.Sleep(2000);
1219+
Poll();
1220+
});
11951221
}
11961222

11971223
/// <summary>
@@ -1279,7 +1305,13 @@ public void RecallInputByName(string name)
12791305
}
12801306

12811307
Debug.Console(MegapixelHeliosDebug.Notice, this, "RecallInputByName: content-'{0}'", content);
1282-
_client.SendRequest("PATCH", "/api/v1/public", content);
1308+
1309+
CrestronInvoke.BeginInvoke((o) =>
1310+
{
1311+
_client.SendRequest("PATCH", "/api/v1/public", content);
1312+
Thread.Sleep(3000);
1313+
Poll();
1314+
});
12831315
}
12841316
}
12851317
}

0 commit comments

Comments
 (0)
Please sign in to comment.