The Day Part Query action allows third party scripts to determine if the player is currently in an active day part opening hour period.
Network operators will find the Day Part Query action useful for external monitoring.
Day Part Query uses the in_day_part
action.
You can call the Player API with the Day Part Query action using one of the following methods:
remote_action
: Exposes thein_day_part
action via the command-lineremote_action
tool.- XML: Exposes the
in_day_part
action through simple XML commands sent to port 2324. - JSON: Exposes the
in_day_part
action by sending JSON messages to the WebSocket server (port 2326). - Flash: Flash applications can call the Player API via ActionScript and the
in_day_part
action.
With the command-line remote_action
tool, the action name in_day_part
is to be used. The executable can be found in the Broadsign Player’s installation bin directory. To query the player:
remote_action in_day_part
The Day Part Query returns XML that indicates if any day parts are active in an opening hour period.
When a day part is active:
<in_day_part status=”1”/>
When no day part is active:
<in_day_part status=”0”/>
Your application can submit an XML query to the Player API by sending an XML message to the monitor_remote
port (2324):
<rc version="1" id="1" action="in_day_part" />\r\n\r\n
The Day Part Query returns XML that indicates if any day parts are active in an opening hour period.
When a day part is active:
<in_day_part status=”1”/>
When no day part is active:
<in_day_part status=”0”/>
Day Part Query – XML Parameters
Parameter | Description |
---|---|
version |
The version is always “1”. |
id |
Contains the identifier of the request. |
action |
The kind of action to be taken; always in_day_part . |
status |
The status is “1” when a day part is active and the Broadsign Player is currently within an opening hour period. In all other cases, inclusive of when the Broadsign Player has an active day part but is outside the opening hour periods, the status returned will be “0”. |
Your interactive application can submit JSON data to the player via the WebSocket server of monitor_remote
(port 2326). You will need to enable the WebSocket server. For more information, see Configuration Profiles – Players – The Remote Control Tab.
{
"rc": {
"version": "1",
"id": "1",
"action": "in_day_part"
}
}
The Day Part Query returns a JSON string that indicates if any day parts are active in an opening hour period.
When a day part is active:
{
"rc": {
"id": "1",
"version": "1",
"status": "1",
"action": "in_day_part",
"in_day_part": { "status": "1" }
}
}
When no day part is active:
{
"rc": {
"id": "1",
"version": "1",
"status": "1",
"action": "in_day_part",
"in_day_part": { "status": "0" }
}
}
Day Part Query – JSON Parameters
Parameter | Description |
---|---|
version |
The version is always “1”. |
id |
Contains the identifier of the request. |
action |
The kind of action to be taken; always in_day_part . |
status |
The status is “1” when a day part is active and the Broadsign Player is currently within an opening hour period. In all other cases, inclusive of when the Broadsign Player has an active day part but is outside the opening hour periods, the status returned will be “0”. |
You can use the Day Part Query action from Flash with ActionScript 2.0:
// Start ActionScript 2.0
var theSocket:XMLSocket = new XMLSocket();
theSocket.onConnect=function() {
theSocket.send(new XML(" action=\"in_day_part\" />\r\n\r\n"));
}
theSocket.onXML=function(myXML) {
// XXX: parse and use the returned XML here
trace(myXML);
theSocket.close();
}
theSocket.connect("localhost", 2324);
The Day Part Query action returns XML that indicates if any day parts are active in an opening hour period.
When a day part is active:
<in_day_part status=”1”/>
When no day part is active:
<in_day_part status=”0”/>