The basic communication with any socket. More...
Public Member Functions | |
| def | __init__ |
| Documentation for method. | |
| def | connect |
| def | disconnect |
| def | run |
| def | stop |
| def | send |
| Documentation for method. | |
| def | getinputflag |
| def | getinputdata |
| def | commandstatemachine |
| Documentation for method. | |
Public Attributes | |
| RunFlag | |
| InputFlag | |
| IPAddr | |
| IPport | |
| IdentfyText | |
| SilentMode | |
| RCVQ | |
| Comm | |
| Input | |
The basic communication with any socket.
This class deals with the main socket communication. It connects to the specified computers specified port. Using it's send method, data can be sent to the specified computer, a stand alone thread (run) deals with receiving data from a specified computer to load into the receiving queue. The getinputflag method always indicates whether there is received data in the receiving queue, which data can be read using getinputdata method. disconnect method disconnects socket connection, stop method stops receiving thread. The commandstatemachine method can check answers got for sent packages.
Short description: Communication interface class
| def cpphlib.PPDCommThread.__init__ | ( | self, | |
| IPAddr, | |||
| IPport, | |||
| IdentfyText, | |||
SilentMode = True |
|||
| ) |
Documentation for method.
| IPAddr | IP address of the machine which ppds driver is running on |
| IPPort | The port which ppds driver has opened for the granted interface |
| IdentfyText | Identifier text, what interface displays when client is connected |
| SilentMode | Switches silent mode ON/OFF. It can be True or False Short description: Constructs PPDCommThread class |
| def cpphlib.PPDCommThread.commandstatemachine | ( | self, | |
| Command, | |||
| ExpAnswer, | |||
| MaxTimeOut, | |||
PrintParsableAnswer = False |
|||
| ) |
Documentation for method.
Sends Command to the interface, then checks expected answer for the command based on ExpAnswer. The answer must arrive within MaxTimeOut milliseconds. Ppds gives answer to every commands and there is a prompt ('>') at the end of the answer. Prompt can always be found after having an answer. At the same time you can also digest every details of the whole answer to make sure if driver has done the required things, or the required parameter is set on the card. If PrintParsableAnswer is set to True, method displays parsable interface answer. If expected answer is not equals to interface answer and PrintParsableAnswer is set to False, then method displays only 'ANSWER WRONG'.
| Command | Command to interface |
| ExpAnswer | Expected answer or a part of expected answer for the command |
| MaxTimeOut | Maximum timeout of the answer |
| PrintParsableAnswer | If it is set to True, it prints the anwer, if it is set to False, it does not print the answer. Short description: Checks answer for the sent command |
| def cpphlib.PPDCommThread.connect | ( | self | ) |
Short description: Connects to ppds interface
| def cpphlib.PPDCommThread.disconnect | ( | self | ) |
Short description: Disconnects from ppds interface
| def cpphlib.PPDCommThread.getinputdata | ( | self | ) |
Short description: Gets data from the interface
| def cpphlib.PPDCommThread.getinputflag | ( | self | ) |
Short description: Flagging when incoming data is coming from the interface
| def cpphlib.PPDCommThread.run | ( | self | ) |
Short description: Class working loop, receives data from the interface
| def cpphlib.PPDCommThread.send | ( | self, | |
| Text | |||
| ) |
Documentation for method.
Sends Text to interface.
| Text | text to be sent to the interface Short description: Sends data to the interface |
| def cpphlib.PPDCommThread.stop | ( | self | ) |
Short description: Stops working loop
1.7.6.1