-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize internal event, add restart service, and update statistic da…
…tas (#36) Optimize internal event, add restart service, and update statistic datas
- Loading branch information
Showing
7 changed files
with
116 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# | ||
|
||
socat -d -d -v pty,raw,echo=0,link=./reader pty,raw,echo=0,link=./writer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Example services.yaml entry | ||
|
||
# Service ID | ||
restart: | ||
# Service name as shown in UI | ||
name: Restart serial reading | ||
# Description of the service | ||
description: Restart the serial reader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import logging | ||
import time | ||
|
||
import serial | ||
|
||
ser = serial.Serial( | ||
port="/workspaces/integration_teleinformation/writer", | ||
baudrate=1200, | ||
# bytesize=7, | ||
# parity=serial.PARITY_EVEN, | ||
# stopbits=serial.STOPBITS_ONE | ||
) | ||
count = 0 | ||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
def getFrameWithCheckSum(frame): | ||
"""Check if a frame is valid.""" | ||
datas = frame.encode("ascii") | ||
computed_checksum = (sum(datas) & 0x3F) + 0x20 | ||
|
||
return (frame + " " + chr(computed_checksum) + "\n").encode("ascii") | ||
|
||
|
||
while 1: | ||
ser.write(b"\x02\n") | ||
ser.write(b"ADCO 700801422425 :\n") | ||
ser.write(b"OPTARIF BASE 0\n") | ||
ser.write(b"ISOUSC 30 9\n") | ||
# ser.write(b'BASE 008528238 /\n') | ||
|
||
ser.write(getFrameWithCheckSum("BASE " + str(count))) | ||
|
||
ser.write(b"PTEC TH.. $\n") | ||
ser.write(b"IINST 002 Y\n") | ||
ser.write(b"IMAX 090 H\n") | ||
ser.write(b"PAPP 00360 *\n") | ||
ser.write(b"\x03\n") | ||
|
||
_LOGGER.log(0, "Frame") | ||
|
||
time.sleep(5) | ||
count += 1 |