Skip to content

Commit

Permalink
docs fixed, write_byte fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisKuypers committed Mar 13, 2017
1 parent 4c24ffc commit a33c7c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -9,7 +9,7 @@ This project is part of the Pandoras Box SDK. It implements an interface to acce
The code is currently distributed as a single file. There might be a pip package in the future.

## Usage
The PBAuto class expects a connector in the constructor. Currently there is only the TCP connector.
The PbAuto class expects a connector in the constructor. Currently there is only the TCP connector.

```python
import pbauto
Expand Down Expand Up @@ -43,7 +43,7 @@ The python file also allows you to generate the messages required to control Pan
It is important to know that the message changes if the PB Domain changes. As long as you keep the Domain, you can use the same message code.

```
pb = PBAuto.offline_tcp(data_format='pb')
pb = PbAuto.offline_tcp(data_format='pb')
pb.reset_all()
# prints "[h50] [h42] [h41] [h55] [h01] [h00] [h00] [h00] [h00] [h00] [h02] [h00] [h00] [h00] [h00] [h00] [h03] [h00] [h09]"
Expand All @@ -57,4 +57,4 @@ If the major version changes, then these changes are incompatible with prior ver
Most of the files in this repository are generated. Please contribute to the template files instead.
https://github.com/PandorasBoxSDK/pbauto-generator

v1.2.13077, generated on 2016-11-06
v1.3.13077, generated on 2017-03-13
8 changes: 5 additions & 3 deletions pbauto.py
Expand Up @@ -5,7 +5,7 @@
import base64

# Pandoras Box Automation
# pbauto-python v1.2.13077 @2016-11-06 <support@coolux.de>
# pbauto-python v1.3.13077 @2017-03-13 <support@coolux.de>


class ErrorCode:
Expand Down Expand Up @@ -3654,10 +3654,10 @@ def set_device_media_share_layer_texture_to_param(self, site_id, device_id, sour
return PbAuto.Result(ok=True, code=0)



class Connector(object):
pass


class OfflineHttp(Connector):
MSG_TEMPLATE = ("PBAUTO / HTTP/1.0\r\nHost: %s\r\nUser-Agent: OfflineHttpGen.PBAuto/1.0\r\n"
"Content-Length: %i\r\nAccept: text/html\r\n"
Expand All @@ -3671,7 +3671,6 @@ def send(self, data, wait_for_response):
self.callback(self.MSG_TEMPLATE % (self.ip, len(b64data), b64data.decode("UTF-8")))
return None


class OfflineTcp(Connector):
FormatConfig = namedtuple('FormatConfig', 'template pre join post')
FormatConfig.__new__.__defaults__ = ('', '', '')
Expand Down Expand Up @@ -3752,6 +3751,9 @@ def __init__(self, data=None):
self.__pos = 0

def write_bool(self, val):
self.__data.extend(struct.pack('!B', 1 if val else 0))

def write_byte(self, val):
self.__data.extend(struct.pack('!B', val))

def write_short(self, val):
Expand Down

0 comments on commit a33c7c5

Please sign in to comment.