Search in sources :

Example 1 with CsvDriver

use of org.openmuc.framework.driver.csv.CsvDriver in project OpenMUC by isc-konstanz.

the class CsvScanDeviceTest method testDeviceScan.

@Test
public void testDeviceScan() throws ArgumentSyntaxException, UnsupportedOperationException, ScanException, ScanInterruptedException {
    CsvDriver csvDriver = new CsvDriver();
    String settings = "path=" + dir + "/src/test/resources";
    csvDriver.scanForDevices(settings, new DriverDeviceScanListener() {

        @Override
        public void scanProgressUpdate(int progress) {
            System.out.println("Scan progress: " + progress + " %");
        }

        @Override
        public void deviceFound(DeviceScanInfo scanInfo) {
            System.out.println(scanInfo.toString());
        }
    });
}
Also used : DeviceScanInfo(org.openmuc.framework.config.DeviceScanInfo) DriverDeviceScanListener(org.openmuc.framework.driver.spi.DriverDeviceScanListener) CsvDriver(org.openmuc.framework.driver.csv.CsvDriver) Test(org.junit.Test)

Example 2 with CsvDriver

use of org.openmuc.framework.driver.csv.CsvDriver in project OpenMUC by isc-konstanz.

the class CsvScanDeviceTest method testChannelScan.

@Test
public void testChannelScan() {
    CsvDriver csvDriver = new CsvDriver();
    String deviceAddress = dir + "/src/test/resources/test_data.csv";
    try {
        String settings = "SAMPLINGMODE=hhmmss";
        CsvFile csvConnection = (CsvFile) csvDriver.connect(deviceAddress, settings);
        List<ChannelScanInfo> channelsScanInfos = csvConnection.scanForChannels("");
        for (ChannelScanInfo info : channelsScanInfos) {
            System.out.println("Channel: " + info.getChannelAddress());
        }
    } catch (ArgumentSyntaxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ConnectionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (UnsupportedOperationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ScanException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : ChannelScanInfo(org.openmuc.framework.config.ChannelScanInfo) ScanException(org.openmuc.framework.config.ScanException) CsvFile(org.openmuc.framework.driver.csv.CsvFile) ConnectionException(org.openmuc.framework.driver.spi.ConnectionException) CsvDriver(org.openmuc.framework.driver.csv.CsvDriver) ArgumentSyntaxException(org.openmuc.framework.config.ArgumentSyntaxException) Test(org.junit.Test)

Example 3 with CsvDriver

use of org.openmuc.framework.driver.csv.CsvDriver in project OpenMUC by isc-konstanz.

the class DriverInfoTest method printDriverInfo.

@Test
public void printDriverInfo() {
    CsvDriver driver = new CsvDriver();
    DriverInfo info = driver.getInfo();
    System.out.println("Id: " + info.getId());
    System.out.println("Description: " + info.getDescription());
    System.out.println("DeviceAddressSyntax: " + info.getDevice().getAddressSyntax());
    System.out.println("DeviceSettingsSyntax: " + info.getDevice().getSettingsSyntax());
    System.out.println("DeviceScanSettingsSyntax: " + info.getDevice().getScanSettingsSyntax());
    System.out.println("ChannelAddressSyntax: " + info.getChannel().getAddressSyntax());
}
Also used : DriverInfo(org.openmuc.framework.config.DriverInfo) CsvDriver(org.openmuc.framework.driver.csv.CsvDriver) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 CsvDriver (org.openmuc.framework.driver.csv.CsvDriver)3 ArgumentSyntaxException (org.openmuc.framework.config.ArgumentSyntaxException)1 ChannelScanInfo (org.openmuc.framework.config.ChannelScanInfo)1 DeviceScanInfo (org.openmuc.framework.config.DeviceScanInfo)1 DriverInfo (org.openmuc.framework.config.DriverInfo)1 ScanException (org.openmuc.framework.config.ScanException)1 CsvFile (org.openmuc.framework.driver.csv.CsvFile)1 ConnectionException (org.openmuc.framework.driver.spi.ConnectionException)1 DriverDeviceScanListener (org.openmuc.framework.driver.spi.DriverDeviceScanListener)1