Jat replied to the topic 'INDI4Java' in the forum. 8 years ago

My code is:

import java.io.IOException;
import java.util.Date;
import java.util.HashMap;

import org.indilib.i4j.client.INDIDevice;
import org.indilib.i4j.client.INDIProperty;
import org.indilib.i4j.client.INDIServerConnection;
import org.indilib.i4j.client.INDIServerConnectionListener;
import org.indilib.i4j.client.INDIDeviceListener;
import org.indilib.i4j.client.INDIPropertyListener;


public class IndiClient implements INDIServerConnectionListener, INDIDeviceListener, INDIPropertyListener
{
private INDIServerConnection connection;

public IndiClient()
{
String host = "localhost";
int port = 7264;

connection = new INDIServerConnection(host, port);
/*
connection.addINDIServerConnectionListener(this);

try {
connection.connect();
connection.askForDevices(); // Ask for all the devices.
} catch (IOException e) {
System.out.println("Nem lehet kapcsoldni a szerverhez.");
System.exit(-1);

}

*/
}


@Override
public void connectionLost(INDIServerConnection arg0) {
// TODO Auto-generated method stub

}

@Override
public void newDevice(INDIServerConnection arg0, INDIDevice arg1) {
// TODO Auto-generated method stub

}

@Override
public void newMessage(INDIServerConnection arg0, Date arg1, String arg2) {
// TODO Auto-generated method stub

}

@Override
public void removeDevice(INDIServerConnection arg0, INDIDevice arg1) {
// TODO Auto-generated method stub

}


@Override
public void propertyChanged(INDIProperty<?> arg0) {
// TODO Auto-generated method stub

}


@Override
public void messageChanged(INDIDevice arg0) {
// TODO Auto-generated method stub

}


@Override
public void newProperty(INDIDevice arg0, INDIProperty<?> arg1) {
// TODO Auto-generated method stub

}


@Override
public void removeProperty(INDIDevice arg0, INDIProperty<?> arg1) {
// TODO Auto-generated method stub

}




}


The exception:

Exception in thread "main" java.lang.IllegalArgumentException: illegal indi url
at org.indilib.i4j.client.INDIServerConnection.<init>(INDIServerConnection.java:119)
at IndiClient.<init>(IndiClient.java:22)
at Main.main(Main.java:6)
Caused by: java.net.MalformedURLException: unknown protocol: indi
at java.net.URL.<init>(URL.java:414)
at java.net.URL.<init>(URL.java:303)
at org.indilib.i4j.client.INDIServerConnection.<init>(INDIServerConnection.java:117)
... 2 more


Thank you very much!

Read More...