Add parrot masking feature in remote manager connector. Add some protocol documentation.
This commit is contained in:
rodzic
b8414dc391
commit
bd3197dc56
|
@ -123,11 +123,11 @@ acknowledged by the client.
|
|||
|
||||
Server to client:
|
||||
|
||||
* chr(0): keepalive message identifier
|
||||
* `chr(0)`: keepalive message identifier
|
||||
|
||||
Client to server:
|
||||
|
||||
* P\r\n
|
||||
* `P\r\n`
|
||||
|
||||
|
||||
### Sending audio signal ###
|
||||
|
@ -138,31 +138,77 @@ server acknowledges, client can start transmitting audio data.
|
|||
|
||||
Client to server:
|
||||
|
||||
* TX0\r\n
|
||||
* `TX0\r\n`
|
||||
|
||||
Server to client:
|
||||
|
||||
* chr(1)+chr(hh)+chr(ll): transmission acknowledged (hh*256+ll is the
|
||||
* `chr(1)chr(hh)chr(ll)`: transmission acknowledged (hh*256+ll is the
|
||||
client index in client list)
|
||||
|
||||
Client to server:
|
||||
|
||||
* TX1\r\n followed by 325 bytes: data following the first line
|
||||
* `TX1\r\n` followed by 325 bytes: data following the first line
|
||||
contains 10 GSM 6.10 frames (representing 20mS of audio signal each one)
|
||||
encoded with WAV#49 variant.
|
||||
|
||||
Client to server:
|
||||
|
||||
* RX0\r\n: clients stops transmitting audio.
|
||||
* `RX0\r\n`: client stops transmitting audio.
|
||||
|
||||
|
||||
### Receiving audio signal ###
|
||||
|
||||
Server to client:
|
||||
|
||||
* chr(2)+chr(hh)+chr(ll) followed by 325 bytes: data following the first
|
||||
* `chr(2)chr(hh)chr(ll)` followed by 325 bytes: data following the first
|
||||
3 bytes contains 10 GSM 6.10 frames (representing 20mS of audio signal
|
||||
each one) encoded with WAV#49 variant. hh*256+ll represents the index in
|
||||
the client list of the client sending audio.
|
||||
|
||||
|
||||
### Sending text messages ###
|
||||
|
||||
Client to server:
|
||||
|
||||
* `TM:<ID>clientId</ID><MS>Message body</MS>\r\n`: Sends "Message body"
|
||||
to client having id "clientId". If clientId is an empty string,
|
||||
message is sent to all clients on the same network, including the
|
||||
message sender.
|
||||
|
||||
|
||||
### Receiving text messages ###
|
||||
|
||||
Server to client:
|
||||
|
||||
* `chr(4)` followed by 3-lines message: incoming message first line
|
||||
contains the sender ID, second line the message body, third line the
|
||||
message type: "A" for network messages or "P" for messages directed to a
|
||||
single client.
|
||||
|
||||
|
||||
### Receiving client list ###
|
||||
|
||||
Server to client:
|
||||
|
||||
* `chr(3)` followed by a multiline message: each line contains a client
|
||||
description in an XML-like format containing the following fields:
|
||||
|
||||
* **S**: Client status: 0=Available, 1=Not available, 2=Absent
|
||||
* **M**: Client mute status: 0=Not muted, 1=Muted
|
||||
* **NN**: Same as in authetication procedure
|
||||
* **CT**: Same as in authetication procedure
|
||||
* **BC**: Same as in authetication procedure
|
||||
* **ON**: Same as in authetication procedure
|
||||
* **ID**: Client ID (assigned to the client by the system manager
|
||||
through the server during the authentication phase)
|
||||
* **DS**: Same as in authetication procedure
|
||||
|
||||
|
||||
### Receiving network list ###
|
||||
|
||||
Server to client:
|
||||
|
||||
* `chr(5)` followed by a multiline message: each line contains the name
|
||||
of a network.
|
||||
|
||||
|
||||
|
|
|
@ -40,10 +40,11 @@ class RemoteManager(object):
|
|||
|
||||
implements(IManager)
|
||||
|
||||
def __init__(self, reactor, server='frn.no-ip.info', port=10025):
|
||||
def __init__(self, reactor, server='frn.no-ip.info', port=10025, maskParrot=True):
|
||||
self.reactor = reactor
|
||||
self.server = server
|
||||
self.port = port
|
||||
self.maskParrot = maskParrot
|
||||
self.factory = None
|
||||
|
||||
def doConnect(self):
|
||||
|
@ -59,10 +60,18 @@ class RemoteManager(object):
|
|||
return self.factory.client.sendServerLogout(user)
|
||||
|
||||
def clientLogin(self, user):
|
||||
return self.factory.client.sendClientLogin(user)
|
||||
if self.maskParrot and user.BC == 'Parrot':
|
||||
u = user.copy(BC='PC Only')
|
||||
else:
|
||||
u = user.copy()
|
||||
return self.factory.client.sendClientLogin(u)
|
||||
|
||||
def clientLogout(self, user):
|
||||
return self.factory.client.sendClientLogout(user)
|
||||
if self.maskParrot and user.BC == 'Parrot':
|
||||
u = user.copy(BC='PC Only')
|
||||
else:
|
||||
u = user.copy()
|
||||
return self.factory.client.sendClientLogout(u)
|
||||
|
||||
def getClientList(self):
|
||||
return self.factory.client.getClientList()
|
||||
|
|
Ładowanie…
Reference in New Issue