Package it.freedomotic.serial

Examples of it.freedomotic.serial.SerialConnectionProvider


        /**
         * A service to add environment objects using XML commands
         */
        new BehaviorManager();
        new SerialConnectionProvider();

        /**
         * ******************************************************************
         * Starting plugins
         * *****************************************************************
 
View Full Code Here


    @Override
    public void onStart() {
        //called when the user starts the plugin from UI
        if (serial == null) {
            serial = new SerialConnectionProvider();
            //UNCOMMENT IF NEEDED:
            //instead of specify a port name is also possible to search for
            //the right port using an hello message and an expected reply
            //the hello message will be broadcasted to all usb connected devices
            //serial.setAutodiscover(
View Full Code Here

    @Override
    public void onStart() {
        //called when the user starts the plugin from UI
        if (serial == null) {
            serial = new SerialConnectionProvider();
            //UNCOMMENT IF NEEDED:serial.setPortName(configuration.getStringProperty("serial.port", "dev/usb0"));
            //instead of specify a port name is also possible to search for
            //the right port using an hello message and an expected reply
            //the hello message will be broadcasted to all usb connected devices
            serial.setAutodiscover(
View Full Code Here

     * Test of read method, of class SerialConnectionProvider.
     */
    @Test
    public void testRead() {
        try {
            SerialConnectionProvider usb;
            System.out.println("Test started ");

            usb = new SerialConnectionProvider();
            usb.setPortName("/dev/ttyUSB11");
            usb.setPortBaudrate(9600);
//            usb.setPortDatabits(SerialPort.DATABITS_8);
//            usb.setPortParity(SerialPort.PARITY_NONE);
//            usb.setPortStopbits(SerialPort.STOPBITS_1);
            System.out.println("\nTesting write to serial");
            usb.connect();
            System.out.println("stx: " + STX);
            System.out.println("etx: " + ETX);
            System.out.println("pos eso");
            String msg = STX + "**PON" + ETX;
            System.out.println("pos eso 222");
            System.out.println("msg: " + msg);
            String output = usb.send(msg);
            System.out.println("Salida del puerto: " + output);
            usb.disconnect();
            //assertEquals(1, 1);
            // sudo socat pty,link=/dev/ttyUSB10,waitslave,ignoreeof tcp:192.168.1.5:54321 &
            // sudo socat tcp-l:54321,reuseaddr,fork file:/dev/ttyUSB0,nonblock,waitlock=/var/run/ttyUSB0.lock
            // sudo socat tcp-l:54321,reuseaddr,fork file:/dev/ttyUSB0,nonblock,waitlock=/var/run/ttyUSB0.lock
        } catch (Exception ex) {
View Full Code Here

    static public final int OK = 1;
    static public final int ERR = 0;

    public PioneerKuroProtocol() {
        super("Pioneer Kuro", "/pioneer-kuro/PioneerKuro-Protocol.xml");
        usb = new SerialConnectionProvider();
        usb.setPortStopbits(1);
        usb.setPortParity(0);
        usb.setPortDatabits(8);
        String port = configuration.getStringProperty("port", "/dev/ttyUSB10");
        usb.setPortName(port);
View Full Code Here

//                SerialConnectionProvider usb = PioneerKuroGateway.getInstance();

//                PioneerKuroActuator testActuator = new PioneerKuroActuator();
//                testActuator.test();
            SerialConnectionProvider usb;
            System.out.println("Test started ");

            usb = new SerialConnectionProvider();
            usb.setPortName("/dev/ttyUSB10");
            usb.setPortBaudrate(9600);
            usb.setPortDatabits(8);
            usb.setPortParity(0);
            usb.setPortStopbits(1);
            System.out.println("\nTesting write to serial");
            System.out.println("stx: " + STX);
            System.out.println("etx: " + ETX);
            System.out.println("pos eso");
            String msg = STX + "**POF" + ETX;
            System.out.println("msg: " + msg);
            String output = usb.send(msg);
            System.out.println("Salida del puerto: " + output);

            usb.disconnect();
            //assertEquals(1, 1);
            // sudo socat pty,link=/dev/ttyUSB10,waitslave,ignoreeof tcp:192.168.1.5:54321 &
            // sudo socat tcp-l:54321,reuseaddr,fork file:/dev/ttyUSB0,nonblock,waitlock=/var/run/ttyUSB0.lock
            // sudo socat tcp-l:54321,reuseaddr,fork file:/dev/ttyUSB0,nonblock,waitlock=/var/run/ttyUSB0.lock
            //testActuator.close();
View Full Code Here

            config.setProperty("hello-reply", "$<9000VP"); //expected reply to hello-message starts with this string
            config.setProperty("polling-message", "$>9000RQCE#"); //$>9000RQcs# forces read data using this string
            //The computer always take the initiative to read, the PMIX35 is a passive gateway
            config.setProperty("polling-time", "1000"); //millisecs between reads.
            config.setProperty("port", "/dev/ttyUSB0");
            usb = new SerialConnectionProvider(config); //instantiating a new serial connection with the previous parameters
            usb.addListener(this);
            usb.connect();
            if (usb.isConnected()) {
                plugin.setDescription("Connected to " + usb.getPortName());
            } else {
View Full Code Here

TOP

Related Classes of it.freedomotic.serial.SerialConnectionProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.