Skip to content

Control Gateway Model Objects

The document details standard response objects returned by the Control Gateway.

Referenced Entities

The Control Gateway uses Pydantic to marshal JSON payloads to native Python objects. Pydantic model objects have been included for reference, or use in your own Python based application.

ControlRequestPayload

All request objects extend from ControlRequestPayload which in-turn implements Pydantic's BaseModel. This model does not currently implement any additional logic, but it is provided for convenience for operations like isinstance(message, ControlRequestPayload).

python
class ControlRequestPayload(BaseModel):
    pass

ControlResponseType

Request Objects use a string literal for the response object type. The provided model objects reference the following literals:

python
class ControlRequestType(str, Enum):
    CONTROL_GET = 'ControlGet'
    CONTROL_SET = 'ControlSet'
    VALUE_SET = 'ValueSet'
    VALUSE_SET_BOOLEAN = 'ValueSetBoolean'

ControlResponsePayload

All response objects extend from ControlResponsePayload which in-turn implements Pydantic's BaseModel. The model does not currently implement any additional logic, but it is provided for convienience for operations like isinstance(message, ControlResponsePayload).

python
class ControlResponsePayload(BaseModel):
    pass

ControlResponseType

Response Objects use a string literal for the response object type. The provided model objects reference the following literals:

python
class ControlResponseType(str, Enum):
    ACK = 'Ack'
    CONTROL_STATE = 'ControlState'
    CONTROL_STATES = 'ControlStates'
    MEDIA_STATE = 'MediaState'
    POWER_STATE = 'PowerState'
    VERSION = 'Version'

Request Objects

ControlGet

Get the value of a generic control pre-assigned, or a named constant within a control system.

FieldTypeDefaultDescription
typestrControlGetMessage type constant
idstrThe pre-define ID or constant of the control to get

Model object:

python
class ControlGet(ControlRequestPayload):
    id: Union[str]

Example Request:

json
{
    "msg": "io.upswell.xagent.ControlRequest",
    "device": "<device alias>",
    "method": "control",
    "data": {
        "type": "ControlGet",
        "id": "2060"
    },
    "mid": "123abc"
}

ControlSet

Set the value of a generic control pre-assigned, or a named constant within a control system.

FieldTypeDefaultDescription
typestrControlGetMessage type constant
idstrThe pre-define ID or constant of the control to get
intintstr

Model object:

python
class ControlSet(ControlRequestPayload):
    id: Union[str]
    value: Union[int, str]

Example Request:

json
{
    "msg": "io.upswell.xagent.ControlRequest",
    "device": "<device alias>",
    "method": "control",
    "data": {
        "type": "ControlSet",
        "id": "2060",
        "value": 256
    },
    "mid": "123abc"
}

ValueSetBoolean

Set the value of a boolean control such as on/off, low/high or true/false. This is used for control such a power.

FieldTypeDefaultDescription
typestrValueSetBooleanMessage type constant
valueboolBoolean value true or false to set the control to

Model Object:

python
class ValueSetBoolean(ControlRequestPayload):
    value: bool

Example Request:

json
{
    "msg": "io.upswell.xagent.ControlRequest",
    "device": "<device alias>",
    "method": "power",
    "data": {
        "type": "ValueSetBoolean",
        "value": true
    },
    "mid": "123abc"
}

ValueSet

Set the value of a named control within an interface such as volume where the control ID is implied by the method name, such a volume.

FieldTypeDefaultDescription
typestrValueSetMessage type constant
valueintstr

Model Object

python
class ValueSet(ControlRequestPayload):
    value: Union[int, str]

Example Request:

json
{
    "msg": "io.upswell.xagent.ControlRequest",
    "device": "<device alias>",
    "method": "volume",
    "data": {
        "type": "ValueSet",
        "value": 0.5
    },
    "mid": "123abc"
}

Response Objects

Ack

Object representing an acknowlegdement that a command was acknowledged (or not).

FieldTypeDefaultDescription
typestrAckMessage type constant
ackboolFalseWhether the player is in fullscreen mode
rawstrNone(optional) Raw (unparsed) value provide back from the device

Model Object:

python
class AckState(ControlResponsePayload):
    type: Literal[ControlResponseType.ACK] = ControlResponseType.ACK
    ack: bool
    raw: Optional[str] = None

Example Response:

json
{
    "msg": "io.upswell.xagent.ControlResponse",
    "device": "<device alias>",
    "method": "status",
    "data": {
        "type": "Ack",
        "ack": true
    },
    "status_code": 200,
    "mid": "123abc"
}

ControlState

A pre-assigned controls state within a Control System such as a DSP or Show Controller.

FieldTypeDefaultDescription
typestrControlStateMessage type constant
idstrThe ID of the control being returned
valueintThe current value of the control normalized to 0 (low, off, false), 1 (high, on, true)
rawstrNone(optional) Raw (unparsed) value provide back from the device

Model object:

python
class ControlState(ControlResponsePayload):
    type: Literal[ControlResponseType.CONTROL_STATE] = ControlResponseType.CONTROL_STATE
    id: str
    value: int
    raw: Optional[str] = None

Example Response:

json
{
    "msg": "io.upswell.xagent.ControlResponse",
    "device": "<device alias>",
    "method": "control",
    "data": {
        "type": "ControlState",
        "id": "2060",
        "value": 0.5,
        "raw": "2056"
    },
    "status_code": 200,
    "mid": "123abc"
}

ControlStates

A pre-assigned controls states (multiple) within a Control System such as a DSP or Show Controller.

FieldTypeDefaultDescription
typestrControlStatesMessage type constant
valuesList[ControlState]

Model object:

python
class ControlStates(ControlResponsePayload):
    type: Literal[ControlResponseType.CONTROL_STATES] = ControlResponseType.CONTROL_STATES
    values: List[ControlState] = []

Example Response:

json
{
    "msg": "io.upswell.xagent.ControlResponse",
    "device": "<device alias>",
    "method": "controls",
    "data": {
        "type": "ControlStates",
        "values" [
            {
                "type": "ControlState",
                "id": "2060",
                "value": 0.5,
                "raw": "2056"
            },
            {
                "type": "ControlState",
                "id": "2061",
                "value": 0,
                "raw": "0"
            }
        ]
    },
    "status_code": 200,
    "mid": "123abc"
}

PowerState

FieldTypeDefaultDescription
onboolCurrent power state of the device (true = on, false = off)
was_onbool?NoneOptional previous power state before the last change

Example Response:

json
{
    "msg": "io.upswell.xagent.ControlResponse",
    "device": "<device alias>",
    "method": "get",
    "data": {
        "type": "PowerState",
        "on": true,
        "was_on": true
    },
    "status_code": 200,
    "mid": "123abc"
}

RequestError

FieldTypeDefaultDescription
errorstrThe error generated by the request

Example Response:

json
{
    "msg": "io.upswell.xagent.ControlResponse",
    "device": "<device alias>",
    "method": "get",
    "data": {
        "type": "RequestError",
        "error": "Error string ..."
    },
    "status_code": 400,
    "mid": "123abc"
}

Version

FieldTypeDefaultDescription
typestrAckMessage type constant
versionstrThe device version

Example Response:

json
{
    "msg": "io.upswell.xagent.ControlResponse",
    "device": "<device alias>",
    "method": "status",
    "data": {
        "type": "Version",
        "version": "1.0.0"
    },
    "status_code": 200,
    "mid": "123abc"
}

Atlas, Hybrid cloud, on-premesis platform for large scale media program development, delivery and operation.