-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from clementprevot/feat/raw-mode
feat: Add `raw` mode
- Loading branch information
Showing
9 changed files
with
145 additions
and
52 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 |
---|---|---|
|
@@ -113,6 +113,7 @@ ENV/ | |
env.bak/ | ||
venv.bak/ | ||
pythonenv* | ||
/pyduro/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
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,42 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# -------------------------------------------------------------------------------------------------- | ||
import time | ||
|
||
from pyduro.actions import CONSUMPTION_DATA, SETTINGS | ||
from pyduro.protocol import ( | ||
FUNCTIONS, | ||
FunctionNotFoundException, | ||
PayloadToLargeException, | ||
) | ||
from pyduro.protocol.frame import Frame | ||
|
||
# -------------------------------------------------------------------------------------------------- | ||
|
||
|
||
def run(burner_address, serial, pin_code, function_id, payload, verbose=False): | ||
""" | ||
Get information from the given burner. | ||
Args: | ||
burner_address (str): The IP address of the burner. | ||
serial (str): The serial number of the burner (this can often be found on a sticker somewhere on the burner). | ||
Note that this should be a 6 characters string. Any longer string will be truncated and any shorter string | ||
will be left padded with 0s. | ||
pin_code (str): The secret pincode of the burner (this can often be found on a sticker somewhere on the burner). | ||
Note that this should be a 10 characters string. Any longer string will be truncated and any shorter string | ||
will be right padded with 0s. | ||
function_id (int): The raw identifier of the function you want to run on the burner. | ||
payload (str): The payload to send to the burner. | ||
verbose (bool): Indicates if we want the frame to be printed before sending it. | ||
Default: False | ||
""" | ||
|
||
try: | ||
frame = Frame(serial, pin_code, function_id, payload, function_check=False) | ||
|
||
response = frame.send(burner_address, verbose=verbose) | ||
|
||
return response | ||
except PayloadToLargeException as e: | ||
print(e.message) |
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
Oops, something went wrong.