-
Notifications
You must be signed in to change notification settings - Fork 4
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
Error message #10
Draft
Kottanidisan
wants to merge
8
commits into
ifm:master
Choose a base branch
from
Kottanidisan:error-message
base: master
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.
Draft
Error message #10
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
62d45d8
Added error message for when the device is already in a session
Kottanidisan dc26aaf
Changed wrong ip-address
Kottanidisan 378ea9e
Remove unused code
Kottanidisan 7844ece
Changed import
Kottanidisan 8af7869
Added more RuntimeErrors for diffrent OperatingModes
Kottanidisan f19052c
Fixed datatyp error
Kottanidisan 0b4759f
Query of the sessionstatus moved to __init__ method
Kottanidisan 013306c
Merge branch 'ifm:master' into error-message
Kottanidisan 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 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 |
---|---|---|
@@ -1,21 +1,29 @@ | ||
from ..static.formats import error_codes, serialization_format | ||
from o2x5xx import json, re, io | ||
import matplotlib.image as mpimg | ||
import binascii | ||
import socket | ||
import struct | ||
import json | ||
import re | ||
import io | ||
import o2x5xx | ||
|
||
|
||
class Client(object): | ||
def __init__(self, address, port): | ||
# open raw socket | ||
self.pcicSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
self.pcicSocket.connect((address, port)) | ||
self.recv_counter = 0 | ||
self.debug = False | ||
self.debugFull = False | ||
sessionstatus = self.rpcdevice.getParameter("OperatingMode") | ||
if sessionstatus == "0": | ||
self.pcicSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
self.pcicSocket.connect((address, port)) | ||
self.recv_counter = 0 | ||
self.debug = False | ||
self.debugFull = False | ||
self.rpcdevice = o2x5xx.O2x5xxRPCDevice() | ||
|
||
elif sessionstatus == "1": | ||
raise RuntimeError("Sensor is in Parametrization Mode. Please close the ifmVisionAssistant and retry.") | ||
|
||
else: | ||
raise RuntimeError("Sensor is in simulation mode at the moment.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good to me. Maybe @Galoshi can confirm whether this is in fact the desired check and whether this is sufficient. |
||
|
||
def __del__(self): | ||
self.close() | ||
|
@@ -35,7 +43,7 @@ def recv(self, number_bytes): | |
data = data + data_part | ||
self.recv_counter += number_bytes | ||
return data | ||
|
||
def close(self): | ||
""" | ||
Close the socket session with the device. | ||
|
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.
import from source instead of an installed library.
A customer cloning the repo for the first time does not own the o2x5xx lib
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.
@Kottanidisan see comment
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.
Just to confirm, the
import
statements need to be left as they are.For testing changes like these I suggest to create a virtual environment where you install the o2x5xx-python packages and try a simple
import o2x5xx
afterwards. With the current state of the branch to be merged you will get the errorThere 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.
@Kottanidisan Maybe a check like this can be done automatically by github for a branch?