iCommand initializes the serial port like this:
The above Java-Code uses RXTX, which basically is a JNI-wrapper for OS-specific API calls. Is there a way to do something similiar in BlitzMax without having to go down to the system level?
... static final int SERIAL_TIMEOUT = 2000; /** Baud rate to transmit using Bluetooth. */ static final int BLUETOOTH_BAUD = 460800; // Ensures no one tries to make instance of NXTComm private NXTComm() { } /** * Connects to the COM port specified in NXTCOMM environment variable. * For more information on configuring Bluetooth, visit www.lejos.org. {link to document] */ static void open() throws Exception { String portName = System.getenv("NXTCOMM"); System.out.println("NXTCOMM = " + portName); // DELETE ME if(portName == null) throw new Exception("NXTCOMM is not defined as a system Environment Variable"); CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if(portIdentifier.isCurrentlyOwned()) { System.out.println("Error: Port is currently in use"); throw new PortInUseException(); } else { commPort = portIdentifier.open("Bluetooth " + portName,SERIAL_TIMEOUT); if (commPort instanceof SerialPort) { SerialPort serialPort = (SerialPort) commPort; -->> Here it comes: serialPort.setSerialPortParams(BLUETOOTH_BAUD,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.setRTS(true); serialPort.setDTR(true); // This allows NXT programs to be run without resetting NXT each time. in = serialPort.getInputStream(); out = serialPort.getOutputStream(); ...
The above Java-Code uses RXTX, which basically is a JNI-wrapper for OS-specific API calls. Is there a way to do something similiar in BlitzMax without having to go down to the system level?