def setXON(self, level=True):
     """Platform specific - set flow state."""
     if not self.hComPort: raise portNotOpenError
     if level:
         win32.EscapeCommFunction(self.hComPort, win32.SETXON)
     else:
         win32.EscapeCommFunction(self.hComPort, win32.SETXOFF)
 def setDTR(self, level=1):
     """Set terminal status line: Data Terminal Ready"""
     if not self.hComPort: raise portNotOpenError
     if level:
         self._dtrState = win32.DTR_CONTROL_ENABLE
         win32.EscapeCommFunction(self.hComPort, win32.SETDTR)
     else:
         self._dtrState = win32.DTR_CONTROL_DISABLE
         win32.EscapeCommFunction(self.hComPort, win32.CLRDTR)
 def setRTS(self, level=1):
     """Set terminal status line: Request To Send"""
     if not self.hComPort: raise portNotOpenError
     if level:
         self._rtsState = win32.RTS_CONTROL_ENABLE
         win32.EscapeCommFunction(self.hComPort, win32.SETRTS)
     else:
         self._rtsState = win32.RTS_CONTROL_DISABLE
         win32.EscapeCommFunction(self.hComPort, win32.CLRRTS)
Exemple #4
0
 def setXON(self, level=True):
     """\
     Manually control flow - when software flow control is enabled.
     This will send XON (true) and XOFF (false) to the other device.
     WARNING: this function is not portable to different platforms!
     """
     if not self.hComPort: raise portNotOpenError
     if level:
         win32.EscapeCommFunction(self.hComPort, win32.SETXON)
     else:
         win32.EscapeCommFunction(self.hComPort, win32.SETXOFF)
Exemple #5
0
 def set_output_flow_control(self, enable=True):
     """\
     Manually control flow - when software flow control is enabled.
     This will do the same as if XON (true) or XOFF (false) are received
     from the other device and control the transmission accordingly.
     WARNING: this function is not portable to different platforms!
     """
     if not self.is_open:
         raise portNotOpenError
     if enable:
         win32.EscapeCommFunction(self._port_handle, win32.SETXON)
     else:
         win32.EscapeCommFunction(self._port_handle, win32.SETXOFF)
Exemple #6
0
 def setDTR(self, level=1):
     """Set terminal status line: Data Terminal Ready"""
     # remember level for reconfigure
     if level:
         self._dtrState = win32.DTR_CONTROL_ENABLE
     else:
         self._dtrState = win32.DTR_CONTROL_DISABLE
     # also apply now if port is open
     if self.hComPort:
         if level:
             win32.EscapeCommFunction(self.hComPort, win32.SETDTR)
         else:
             win32.EscapeCommFunction(self.hComPort, win32.CLRDTR)
Exemple #7
0
 def setRTS(self, level=1):
     """Set terminal status line: Request To Send"""
     # remember level for reconfigure
     if level:
         self._rtsState = win32.RTS_CONTROL_ENABLE
     else:
         self._rtsState = win32.RTS_CONTROL_DISABLE
     # also apply now if port is open
     if self.hComPort:
         if level:
             win32.EscapeCommFunction(self.hComPort, win32.SETRTS)
         else:
             win32.EscapeCommFunction(self.hComPort, win32.CLRRTS)
Exemple #8
0
 def _update_dtr_state(self):
     """Set terminal status line: Data Terminal Ready"""
     if self._dtr_state:
         win32.EscapeCommFunction(self._port_handle, win32.SETDTR)
     else:
         win32.EscapeCommFunction(self._port_handle, win32.CLRDTR)
Exemple #9
0
 def _update_rts_state(self):
     """Set terminal status line: Request To Send"""
     if self._rts_state:
         win32.EscapeCommFunction(self._port_handle, win32.SETRTS)
     else:
         win32.EscapeCommFunction(self._port_handle, win32.CLRRTS)
Exemple #10
0
def dtr_low(dev=None):
    if not dev: dev = g
    if isWin:
        r = win32.EscapeCommFunction(dev._port_handle, win32.SETDTR)  #r=1
Exemple #11
0
def dtr_high(dev=None):
    '''s.setDTR(False) '''
    if not dev: dev = g
    if isWin: r = win32.EscapeCommFunction(dev._port_handle, win32.CLRDTR)