Interfaces telnet - thica/ORCA-Remote GitHub Wiki
The telnet interface is a simple interface. It opens a telnet connection to a given device and sends a set of commands to the interface. The telnet interface is bi-directional, so you can set triggers to catch responses..
The following settings are supported by the interface
Setting | Description |
---|---|
Host | Host-Name or IP-Address of your telnet device/server. Could be "discover" as well. (upnp discover) |
Port | Port Address of your telnet device. Default is 23 |
User | Username , if logon is requiered |
Password | Password , if logon is requiered |
Terminaltype | defaults to "linux" |
FNCodeset | Filename of your codeset. Without path |
parseresult | The way, responses should be parsed |
tokenizestring | If the responses should be tokenized, this token should be used. Defaults to ":" |
resultendstring | How to detect the end of a respond. Defaults to [LF] |
DiscoverTimeOut | For Autodiscover: Timeout to discover a device in seconds. Defaults to 5 |
SaveDiscoveredIP | For Autodiscover: Flag if the discovered IP should be saved. Prevents to discover every app start. |
OldDiscoveredIP | For Autodiscover: The last discoverd IP-Address. Delete, if you want the force a new discover |
TimeToClose |
Timeout in seconds, until the connection from the interface to the device will be close.
|
DisableInterFaceOnError | Disables the interface, if an error occurs. Prevents the interface to continue to send commands to a broken connection. |
DisconnectInterFaceOnSleep | Disconnects the interface, when your remote control device goes to sleep |
Some word to discover: The interface reduces matches / results from the discover results using the ...
- discoverprettyname
- discovermodels
- discovermanufacturer
You need to define the codeset filename, which contains the command set for your device
A codeset file could look like that (shortened version):
<?xml version="1.0" encoding="UTF-8"?>
<codeset>
<code action='getdeviceinfo' type="string" waitforresponse='1' requesttype='GET' cmd='' headers='{"Connection":"Keep-Alive","Accept-Encoding":"gzip"}' parseoption='xml' ldestvar='"MANUFACTURER","MODELNAME"' getvar='ORCAMULTI"{urn:schemas-upnp-org:device-1-0}device,{urn:schemas-upnp-org:device-1-0}manufacturer","{urn:schemas-upnp-org:device-1-0}device,{urn:schemas-upnp-org:device-1-0}modelName"' />
<code action="setparamsvars" waitforresponse='0' type="action" string="setvar" par1="loeweparams" par2='<?xml version="1.0" encoding="utf-8"?> <v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/" xmlns:n0="urn:loewe.de:RemoteTV:Tablet"> <v:Header /> <v:Body> ' />
<code action="setloeweheaders" waitforresponse='0' type="action" string="setvar" par1="loeweheader" par2='"Content-length":"$cvar(datalenght)","Content-type":"text/xml;charset=utf-8","Connection":"close", "Accept-Encoding":"gzip"' preaction='setparamsvars' />
<code action='logon' type="soap" waitforresponse='1' requesttype='POST' cmd='/loewe_tablet_0001' headers='{$var(loeweheader),"SOAPAction": "RequestAccess"}' params='$var(loeweparams) <n0:RequestAccess> <fcid>91827364</fcid> <ClientId>?</ClientId> <DeviceType>ORCA Remote Device</DeviceType> <DeviceName>ORCA</DeviceName> <DeviceUUID>$var(MAC_ADDRESS_COLON)</DeviceUUID> <RequesterName>SoapUI</RequesterName></n0:RequestAccess></v:Body></v:Envelope>' parseoption='xml' ldestvar='"FCID","CLIENTID"' getvar='ORCAMULTI"{http://schemas.xmlsoap.org/soap/envelope/}Body,{urn:loewe.de:RemoteTV:Tablet}RequestAccessResponse,{urn:loewe.de:RemoteTV:Tablet}fcid","{http://schemas.xmlsoap.org/soap/envelope/}Body,{urn:loewe.de:RemoteTV:Tablet}RequestAccessResponse,{urn:loewe.de:RemoteTV:Tablet}ClientId"' preaction='setloeweheaders' />
<code action='info' type="soap" waitforresponse='0' requesttype='POST' cmd='/loewe_tablet_0001' headers='{$var(loeweheader),"SOAPAction": "InjectRCKey"}' params='$var(loeweparams)<n0:InjectRCKey> <fcid>$cvar(FCID)</fcid> <ClientId>$cvar(CLIENTID)</ClientId> <n0:InputEventSequence i:type="n0:InputEventSequence"> <n0:RCKeyEvent i:type="n0:RCKeyEvent" alphabet="l2700" mode="press" value="79" />><n0:RCKeyEvent i:type="n0:RCKeyEvent" alphabet="l2700" mode="release" value="79" />></n0:InputEventSequence></n0:InjectRCKey></v:Body></v:Envelope>' />
<code action="key_1" type="soap" waitforresponse='0' requesttype='POST' cmd='/loewe_tablet_0001' headers='{$var(loeweheader),"SOAPAction": "InjectRCKey"}' params='$var(loeweparams)<n0:InjectRCKey> <fcid>$cvar(FCID)</fcid> <ClientId>$cvar(CLIENTID)</ClientId> <n0:InputEventSequence i:type="n0:InputEventSequence"> <n0:RCKeyEvent i:type="n0:RCKeyEvent" alphabet="l2700" mode="press" value="1" />> <n0:RCKeyEvent i:type="n0:RCKeyEvent" alphabet="l2700" mode="release" value="1" />> </n0:InputEventSequence></n0:InjectRCKey></v:Body></v:Envelope>' />
<code action="key_2" type="soap" waitforresponse='0' requesttype='POST' cmd='/loewe_tablet_0001' headers='{$var(loeweheader),"SOAPAction": "InjectRCKey"}' params='$var(loeweparams)<n0:InjectRCKey> <fcid>$cvar(FCID)</fcid> <ClientId>$cvar(CLIENTID)</ClientId> <n0:InputEventSequence i:type="n0:InputEventSequence"> <n0:RCKeyEvent i:type="n0:RCKeyEvent" alphabet="l2700" mode="press" value="2" />> <n0:RCKeyEvent i:type="n0:RCKeyEvent" alphabet="l2700" mode="release" value="2" />> </n0:InputEventSequence></n0:InjectRCKey></v:Body></v:Envelope>' />
<code action="key_3" type="soap" waitforresponse='0' requesttype='POST' cmd='/loewe_tablet_0001' headers='{$var(loeweheader),"SOAPAction": "InjectRCKey"}' params='$var(loeweparams)<n0:InjectRCKey> <fcid>$cvar(FCID)</fcid> <ClientId>$cvar(CLIENTID)</ClientId> <n0:InputEventSequence i:type="n0:InputEventSequence"> <n0:RCKeyEvent i:type="n0:RCKeyEvent" alphabet="l2700" mode="press" value="3" />> <n0:RCKeyEvent i:type="n0:RCKeyEvent" alphabet="l2700" mode="release" value="3" />> </n0:InputEventSequence></n0:InjectRCKey></v:Body></v:Envelope>' />
</codeset>
Attribute | Description |
---|---|
action | Defines, to which ORCA action the command should be send |
preaction | This defines an action from this codeset to be executed, before this action will be send to to your device. This gives you the option, to gather required information using json, before you can send this action |
getvar | This defines, which information will be collected from the json respons., Only the last attribute will be used. If an attribute belongs to a list, only the first list entry is parsed. |
ldestvar | This defines, which variable should be set by the information parsed by getvar. This variable is local to the interface and local to the configuration |
gdestvar | This defines, which variable should be set by the information parsed by getvar. This variable is global to all ORCA functions |
cmd | This is the command to transmit using json. Do not forget the trailing newline \n. You can chain up several commands separated by a newline tag. |
Variable replacement: You can use variable placeholder to use variables in your json command string
var | Description |
---|---|
var() | Uses a global variable name to be replaced |
lvar() | Uses a language variable name to be replaced |
cvar() | Uses a local variable to be replaced |
Example: The following line requests the current playerid from KODI/XBMC , and places the result as a local variable "playerid"
```
The following line request to get the playerid first, and then uses the result in the command to control the play of KODI/XBMC
```
You can have as much actions as you like in your codeset file. You can use the same assignment file for several configurations.WikiDoc:End