-
Notifications
You must be signed in to change notification settings - Fork 0
[SWT-188] Establish Reliance Connection #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ltn-PTI
wants to merge
21
commits into
main
Choose a base branch
from
feature/SWT-188-Establish-Reliance-Connection
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
5422dc2
Update reliance connection setup
ltn-PTI 54d4fd7
Add printer identifier
ltn-PTI 9e6cd02
Add a switch on send command for specific printer
ltn-PTI a0ee01a
Add Initial Reliance samples
ltn-PTI 02fd971
Add image sample
ltn-PTI 8948d6f
Add copilot suggestion
ltn-PTI f8add82
Update Sample_Codes/reliance/2_sample_print_command.py
ltn-PTI d4db7c0
Update Sample_Codes/Phoenix/4_sample_positioning.py
ltn-PTI 897e009
Update Sample_Codes/Phoenix/2_sample_print_command.py
ltn-PTI 3b1e9b8
Update Sample_Codes/Phoenix/1_sample_connection.py
ltn-PTI 440c717
Update Sample_Codes/reliance/2_sample_print_command.py
ltn-PTI 8a3efcd
Update Sample_Codes/reliance/1_sample_connection.py
ltn-PTI 14df8a3
Update Sample_Codes/reliance/3_sample_font_control.py
ltn-PTI c6151ee
Update Sample_Codes/reliance/4_sample_layout_control.py
ltn-PTI 9c08be9
Remove Extra text
ltn-PTI f99c15a
Merge remote-tracking branch 'origin/feature/SWT-188-Establish-Relian…
ltn-PTI e2a1f72
Update Sample_Codes/reliance/5_sample_image_barcode.py
ltn-PTI 91b6fd7
Setup project as package
ltn-PTI f29806a
Add Sample and QR sample code
ltn-PTI a1899ba
Add sample code for Reliance logo
ltn-PTI 14597e7
Fix syntax error
ltn-PTI File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
11 changes: 6 additions & 5 deletions
11
Printer/phoenix_printer.py → py_esc_pos/printer/phoenix_printer.py
This file contains hidden or 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 hidden or 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,25 @@ | ||
| from py_esc_pos.printer import base_printer | ||
| from py_esc_pos.commands import RelianceCommands | ||
| import time | ||
|
|
||
| class ReliancePrinter(base_printer.BasePrinter): | ||
| def __init__(self, port): | ||
| super().__init__(port, 9600) | ||
| self.printer_type = "ReliancePrinter" | ||
|
|
||
| time.sleep(1) | ||
| self.ser.reset_input_buffer() | ||
|
|
||
| def verify_logic_link(self): | ||
| self.ser.reset_input_buffer() | ||
| self.ser.write(RelianceCommands.REAL_TIME_STATUS + RelianceCommands.RT_OFFLINE) | ||
| time.sleep(0.25) | ||
|
|
||
| if self.ser.in_waiting > 0: | ||
| res = self.ser.read(1)[0] | ||
| if res == 0xAC: | ||
| return "CONNECTED_BUT_MANGLED (Check Parity/Stop Bits)" | ||
|
|
||
| is_online = (res & 0x08) == 0x08 | ||
| return "ONLINE" if is_online else "OFFLINE" | ||
| return "NO_RESPONSE" |
This file contains hidden or 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
20 changes: 9 additions & 11 deletions
20
...e_Codes/Phoenix/2_sample_print_command.py → ...e_codes/phoenix/2_sample_print_command.py
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method itself is fine, however when you call it you're just grabbing the first COM port listed. Since these could be any serial device (and the order depends on what OS and what devices are plugged in).
For the samples, I would just use the list to let the user select which COM port to use.
You could auto-detect the printer by sending a status command to each port, but that ends up sending junk data to every other device connected.