Skip to content

Commit 04109cc

Browse files
authored
Merge pull request #105 from PropGit/encode_64
Added base64 encoding
2 parents 5ebd3c0 + 524c8a6 commit 04109cc

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

BlocklyPropClient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# Please verify that the version number in the local about.txt and the
3737
# ./package/win-resources/blocklypropclient-installer.iss matches this.
3838
# -----------------------------------------------------------------------
39-
VERSION = "0.6.4"
39+
VERSION = "0.7.0"
4040

4141

4242
# Enable logging for functions outside of the class definition

SerialSocket.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import thread
55
import re
66
import logging
7+
import base64
78

89
__author__ = 'Michel'
910

@@ -46,20 +47,21 @@ def received_message(self, message):
4647
except SerialException as se:
4748
self.logger.error("Failed to connect to %s", port)
4849
self.logger.error("Serial exception message: %s", se.message)
49-
self.send("Failed to connect to: %s using baud rate %s\n\r(%s)\n\r" % (port, baudrate, se.message))
50+
self.send(base64.b64encode("Failed to connect to: %s using baud rate %s\n\r(%s)\n\r" % (port, baudrate, se.message)))
5051
return
5152

5253
if self.serial.isOpen():
5354
self.logger.info("Serial port %s is open.", port)
54-
self.send("Connection established with: %s using baud rate %s\n\r" % (port, baudrate))
55+
self.send(base64.b64encode("Connection established with: %s using baud rate %s\n\r" % (port, baudrate)))
5556
thread.start_new_thread(serial_poll, (self.serial, self))
5657
else:
57-
self.send("Failed to connect to: %s using baud rate %s\n\r" % (port, baudrate))
58+
self.send(base64.b64encode("Failed to connect to: %s using baud rate %s\n\r" % (port, baudrate)))
5859
else:
5960
if self.serial.isOpen():
60-
self.logger.info("Sending serial data")
61-
self.send(message.data)
62-
self.serial.write(message.data)
61+
#self.send(message.data)
62+
data = base64.b64decode(message.data)
63+
self.logger.info("Sending data to device: %s", data)
64+
self.serial.write(data)
6365

6466
# close serial connection
6567
def close(self, code=1000, reason=''):
@@ -74,9 +76,9 @@ def serial_poll(serial, socket):
7476
try:
7577
while serial.isOpen():
7678
data = serial.read(serial.inWaiting())
77-
if len(data) > 0:
79+
if data:
7880
module_logger.debug('Data received from device: %s', data)
79-
socket.send(data)
81+
socket.send(base64.b64encode(data))
8082
# Wait a half-second before listening again.
8183
sleep(0.5)
8284
except SerialException as se:

about.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version: v0.6.4
1+
Version: v0.7.0
22

33
Contributors:
44
- Michel Lampo

package/blocklypropclient-installer.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "BlocklyPropClient"
5-
#define MyAppVersion "0.6.4"
5+
#define MyAppVersion "0.7.0"
66
#define MyAppPublisher "Parallax Inc."
77
#define MyAppURL "http://blockly.parallax.com/"
88
#define MyAppExeName "BlocklyPropClient.exe"

0 commit comments

Comments
 (0)