Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
agent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
7
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
dda1b05b
authored
Nov 07, 2018
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
freebsd: made SerialLineReceiverBase's delimiter platform specific
parent
a108236a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
+10
-1
utils.py
+10
-1
No files found.
utils.py
View file @
dda1b05b
from
twisted.protocols.basic
import
LineReceiver
from
twisted.protocols.basic
import
LineReceiver
import
json
import
json
import
logging
import
logging
import
platform
logger
=
logging
.
getLogger
()
logger
=
logging
.
getLogger
()
system
=
platform
.
system
()
class
SerialLineReceiverBase
(
LineReceiver
,
object
):
class
SerialLineReceiverBase
(
LineReceiver
,
object
):
delimiter
=
'
\n
'
MAX_LENGTH
=
1024
*
1024
*
128
MAX_LENGTH
=
1024
*
1024
*
128
def
__init__
(
self
,
*
args
,
**
kwargs
):
if
system
==
"FreeBSD"
:
self
.
delimiter
=
'
\n
'
else
:
self
.
delimiter
=
'
\r
'
super
(
SerialLineReceiverBase
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
def
send_response
(
self
,
response
,
args
):
def
send_response
(
self
,
response
,
args
):
self
.
transport
.
write
(
json
.
dumps
({
'response'
:
response
,
self
.
transport
.
write
(
json
.
dumps
({
'response'
:
response
,
'args'
:
args
})
+
'
\r\n
'
)
'args'
:
args
})
+
'
\r\n
'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment