def parseArgsPy26(): """ Argument parser for Python 2.6 """ from gsmtermlib.posoptparse import PosOptionParser, Option parser = PosOptionParser( description= 'User-friendly terminal for interacting with a connected GSM modem.') parser.add_positional_argument( Option( '--port', metavar='PORT', help= 'port to which the GSM modem is connected; a number or a device name.' )) parser.add_option('-b', '--baud', metavar='BAUDRATE', default=115200, help='set baud rate') parser.add_option('-r', '--raw', action='store_true', help='switch to raw terminal mode') options, args = parser.parse_args() if len(args) != 1: parser.error( 'Incorrect number of arguments - please specify a PORT to connect to, e.g. {0} /dev/ttyUSB0' .format(sys.argv[0])) else: options.port = args[0] return options
def parseArgsPy26(): """ Argument parser for Python 2.6 """ from gsmtermlib.posoptparse import PosOptionParser, Option parser = PosOptionParser( description='Simple script for sending SMS messages') parser.add_option( '-i', '--port', metavar='PORT', help= 'port to which the GSM modem is connected; a number or a device name.') parser.add_option('-b', '--baud', metavar='BAUDRATE', default=115200, help='set baud rate') parser.add_option('-p', '--pin', metavar='PIN', default=None, help='SIM card PIN') parser.add_option('-d', '--deliver', action='store_true', help='wait for SMS delivery report') parser.add_option('-w', '--wait', type=int, default=0, help='Wait for modem to start, in seconds') parser.add_option('-l', '--list', type=int, default=0, help='List the messages that are available') parser.add_option('-r', '--read', metavar='MSG', default=None, help='Message to read') parser.add_option('-d', '--delete', metavar='MSG', default=None, help='Message to delete') parser.add_option( '--CNMI', default='', help='Set the CNMI of the modem, used for message notifications') parser.add_positional_argument( Option('--destination', metavar='DESTINATION', help='destination mobile number')) options, args = parser.parse_args() options.message = None options.lock_path = None print(options) return options
def parseArgsPy26(): """ Argument parser for Python 2.6 """ from gsmtermlib.posoptparse import PosOptionParser, Option parser = PosOptionParser( description='Identify and debug attached GSM modem') parser.add_positional_argument( Option( '--port', metavar='PORT', help= 'port to which the GSM modem is connected; a number or a device name.' )) parser.add_option('-b', '--baud', metavar='BAUDRATE', default=115200, help='set baud rate') parser.add_option('-p', '--pin', metavar='PIN', default=None, help='SIM card PIN') parser.add_option( '-d', '--debug', action='store_true', help='dump modem debug information (for python-gsmmodem development)') options, args = parser.parse_args() if len(args) != 1: parser.error( 'Incorrect number of arguments - please specify a PORT to connect to, e.g. {0} /dev/ttyUSB0' .format(sys.argv[0])) else: options.port = args[0] return options
def parseArgsPy26(): """ Argument parser for Python 2.6 """ from gsmtermlib.posoptparse import PosOptionParser, Option parser = PosOptionParser( description= "User-friendly terminal for interacting with a connected GSM modem.") parser.add_positional_argument( Option( "--port", metavar="PORT", help= "port to which the GSM modem is connected; a number or a device name.", )) parser.add_option("-b", "--baud", metavar="BAUDRATE", default=115200, help="set baud rate") parser.add_option("-r", "--raw", action="store_true", help="switch to raw terminal mode") options, args = parser.parse_args() if len(args) != 1: parser.error( "Incorrect number of arguments - please specify a PORT to connect to, e.g. {0} /dev/ttyUSB0" .format(sys.argv[0])) else: options.port = args[0] return options
def parseArgsPy26(): """ Argument parser for Python 2.6 """ from gsmtermlib.posoptparse import PosOptionParser, Option parser = PosOptionParser(description='User-friendly terminal for interacting with a connected GSM modem.') parser.add_positional_argument(Option('--port', metavar='PORT', help='port to which the GSM modem is connected; a number or a device name.')) parser.add_option('-b', '--baud', metavar='BAUDRATE', default=115200, help='set baud rate') parser.add_option('-r', '--raw', action='store_true', help='switch to raw terminal mode') options, args = parser.parse_args() if len(args) != 1: parser.error('Incorrect number of arguments - please specify a PORT to connect to, e.g. {0} /dev/ttyUSB0'.format(sys.argv[0])) else: options.port = args[0] return options
def parseArgsPy26(): """ Argument parser for Python 2.6 """ from gsmtermlib.posoptparse import PosOptionParser, Option parser = PosOptionParser(description='Identify and debug attached GSM modem') parser.add_positional_argument(Option('--port', metavar='PORT', help='port to which the GSM modem is connected; a number or a device name.')) parser.add_option('-b', '--baud', metavar='BAUDRATE', default=115200, help='set baud rate') parser.add_option('-p', '--pin', metavar='PIN', default=None, help='SIM card PIN') parser.add_option('-d', '--debug', action='store_true', help='dump modem debug information (for python-gsmmodem development)') options, args = parser.parse_args() if len(args) != 1: parser.error('Incorrect number of arguments - please specify a PORT to connect to, e.g. {0} /dev/ttyUSB0'.format(sys.argv[0])) else: options.port = args[0] return options
def parseArgsPy26(): """ Argument parser for Python 2.6 """ from gsmtermlib.posoptparse import PosOptionParser, Option parser = PosOptionParser(description='Simple script for sending SMS messages') parser.add_option('-i', '--port', metavar='PORT', help='port to which the GSM modem is connected; a number or a device name.') parser.add_option('-b', '--baud', metavar='BAUDRATE', default=115200, help='set baud rate') parser.add_option('-p', '--pin', metavar='PIN', default=None, help='SIM card PIN') parser.add_option('-d', '--deliver', action='store_true', help='wait for SMS delivery report') parser.add_positional_argument(Option('--destination', metavar='DESTINATION', help='destination mobile number')) options, args = parser.parse_args() if len(args) != 1: parser.error('Incorrect number of arguments - please specify a DESTINATION to send to, e.g. {0} 012789456'.format(sys.argv[0])) else: options.destination = args[0] return options
def parseArgsPy26(): """ Argument parser for Python 2.6 """ from gsmtermlib.posoptparse import PosOptionParser, Option parser = PosOptionParser(description="Simple script for sending SMS messages") parser.add_option( "-i", "--port", metavar="PORT", help="port to which the GSM modem is connected; a number or a device name.", ) parser.add_option( "-b", "--baud", metavar="BAUDRATE", default=115200, help="set baud rate" ) parser.add_option("-p", "--pin", metavar="PIN", default=None, help="SIM card PIN") parser.add_option( "-d", "--deliver", action="store_true", help="wait for SMS delivery report" ) parser.add_option( "-w", "--wait", type=int, default=0, help="Wait for modem to start, in seconds" ) parser.add_option( "--CNMI", default="", help="Set the CNMI of the modem, used for message notifications", ) parser.add_positional_argument( Option("--destination", metavar="DESTINATION", help="destination mobile number") ) options, args = parser.parse_args() if len(args) != 1: parser.error( "Incorrect number of arguments - please specify a DESTINATION to send to, e.g. {0} 012789456".format( sys.argv[0] ) ) else: options.destination = args[0] options.message = None options.lock_path = None return options