Bit of cleanup, and some fixes in the docs
This commit is contained in:
parent
d15f225b66
commit
2fcfc6773c
2 changed files with 13 additions and 13 deletions
|
|
@ -52,7 +52,7 @@ Pixels/message: 140
|
||||||
| byte 6 | bit 7-0 | B color value. |
|
| byte 6 | bit 7-0 | B color value. |
|
||||||
| byte 7 | bit 7-0 | Alpha color value. |
|
| byte 7 | bit 7-0 | Alpha color value. |
|
||||||
|
|
||||||
## Protocol: 1 (0x01)
|
## Protocol: 1 (0x01) Only supported on the C server
|
||||||
Protocol 1 compresses the coordinates so more pixels may be send in one message. Full 24 bit colors can be used with optinal alpha.
|
Protocol 1 compresses the coordinates so more pixels may be send in one message. Full 24 bit colors can be used with optinal alpha.
|
||||||
|
|
||||||
###Header
|
###Header
|
||||||
|
|
@ -94,7 +94,7 @@ Pixels/message: 160
|
||||||
| byte 5 | bit 7-0 | B color value. |
|
| byte 5 | bit 7-0 | B color value. |
|
||||||
| byte 6 | bit 7-0 | Alpha color value. |
|
| byte 6 | bit 7-0 | Alpha color value. |
|
||||||
|
|
||||||
## Protocol: 2 (0x02)
|
## Protocol: 2 (0x02) Only supported on the C server
|
||||||
Protocol 2 compresses the coordinates and colors so more pixels may be send in one message. Only 8 bit colors can be used with optinal alpha.
|
Protocol 2 compresses the coordinates and colors so more pixels may be send in one message. Only 8 bit colors can be used with optinal alpha.
|
||||||
|
|
||||||
###Header
|
###Header
|
||||||
|
|
@ -136,7 +136,7 @@ Pixels/message: 280
|
||||||
| byte 3 | bit 3-2 | 2 bit B color value. |
|
| byte 3 | bit 3-2 | 2 bit B color value. |
|
||||||
| byte 3 | bit 1-0 | 2 bit alpha color value. |
|
| byte 3 | bit 1-0 | 2 bit alpha color value. |
|
||||||
|
|
||||||
## Protocol: 3 (0x03)
|
## Protocol: 3 (0x03) Only supported on the C server
|
||||||
Protocol 3 compresses the coordinates and colors so more pixels may be send in one message. Only 8 bit colors can be used with optinal alpha.
|
Protocol 3 compresses the coordinates and colors so more pixels may be send in one message. Only 8 bit colors can be used with optinal alpha.
|
||||||
|
|
||||||
###Header
|
###Header
|
||||||
|
|
@ -160,7 +160,7 @@ Pixels/message: 373
|
||||||
| byte 1 | bit 7-4 | Lowest 4 bits of the Y coordinate of the pixel. |
|
| byte 1 | bit 7-4 | Lowest 4 bits of the Y coordinate of the pixel. |
|
||||||
| byte 2 | bit 7-0 | Highest 8 bits of the Y coordinate of the pixel. |
|
| byte 2 | bit 7-0 | Highest 8 bits of the Y coordinate of the pixel. |
|
||||||
|
|
||||||
# The Autodetection system
|
# The Autodetection system, Only supported on the Python servers
|
||||||
|
|
||||||
A pixelvloed server should broadcast a package advertising its settings with the following string content
|
A pixelvloed server should broadcast a package advertising its settings with the following string content
|
||||||
|
|
||||||
|
|
|
||||||
14
vloed.py
14
vloed.py
|
|
@ -132,19 +132,19 @@ class Canvas(object):
|
||||||
pixelcount = min(((len(data)-1) / pixellength),
|
pixelcount = min(((len(data)-1) / pixellength),
|
||||||
self.limit)
|
self.limit)
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print '%d pixels received, protocol V %d' % (pixelcount, protocol)
|
print('%d pixels received, protocol V %d' % (pixelcount, protocol))
|
||||||
for i in xrange(0, pixelcount):
|
for i in xrange(0, pixelcount):
|
||||||
pixel = struct.unpack_from(
|
pixel = struct.unpack_from(
|
||||||
packetformat,
|
packetformat,
|
||||||
data,
|
data,
|
||||||
self.pixeloffset + (i*pixellength))
|
self.pixeloffset + (i*pixellength))
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print pixel
|
print(pixel)
|
||||||
self.Pixel(*pixel)
|
self.Pixel(*pixel)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
if self.debug:
|
if self.debug:
|
||||||
# All exceptions will be printed, but won't result in a crash.
|
# All exceptions will be printed, but won't result in a crash.
|
||||||
print error
|
print(error)
|
||||||
# indicate that we have been drawing stuff
|
# indicate that we have been drawing stuff
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
@ -158,10 +158,10 @@ class Canvas(object):
|
||||||
self.width/self.factor, self.height/self.factor),
|
self.width/self.factor, self.height/self.factor),
|
||||||
('<broadcast>', DISCOVER_PORT))
|
('<broadcast>', DISCOVER_PORT))
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print 'sending discovery packet'
|
print('sending discovery packet')
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print error
|
print(error)
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
"""Clean up any sockets we created"""
|
"""Clean up any sockets we created"""
|
||||||
|
|
@ -251,7 +251,7 @@ class PixelVloedClient(object):
|
||||||
'width': width,
|
'width': width,
|
||||||
'height': height}
|
'height': height}
|
||||||
foundhash[data] = True
|
foundhash[data] = True
|
||||||
print 'New pixelvloed screen found: %r' % newserver
|
print('New pixelvloed screen found: %r' % newserver)
|
||||||
servers.append(newserver)
|
servers.append(newserver)
|
||||||
if returnfirst:
|
if returnfirst:
|
||||||
return servers
|
return servers
|
||||||
|
|
@ -342,4 +342,4 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
RunServer(options)
|
RunServer(options)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print 'Closing server'
|
print('Closing server')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue