• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Serial Communication using JNI?

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchos,(I hope you dont mind me calling this)
So here is the thing.....
I am developing a webservices project for controlling a Meade ETX125 telescope, for that I have the protocol file written in C, which I converted to JAVA platform using JNI. The C code is mainly the serial port communication. Along side I have written another JAVA program which calls the JNI functions.
The thing is I am not able to open the ports, even though I have tried everything. One doubt that came to my mind is whether the C files can be handled using JNI like this from an outside calling JAVA program?
I made pure C Code for serial port and it worked. For everyones reference here is the JAVA code which calls the JNI library code. During the test.ConnectLX200() call I get an error no such process: no such directory, which are clearly the error nos 3 and 4 returned by a call to open().
public class TestLx200{
public static final int TELESCOPE_SLEW = 1;
public static final int NORTH = 1;
public static float startRA,startDec;
public static void main(String[] args) {
Lx200 test = new Lx200();
int i=1;
String[] port= new String[]{"/dev/ttyS0"};
i=test.InitiatePortLX200(port);
System.out.println(i);
if (test.ConnectLX200() != 1)
System.out.println("Error connecting to LX200");
if(i==1)
{
System.out.println("Connected");
test.SetFormat(1);
System.out.println("Format set");
test.SetRate(TELESCOPE_SLEW);
System.out.println("Rate set");
startRA=test.GetRA();
System.out.println("GetRA()");
startDec=test.GetDec();
System.out.println("GetDec()");
System.out.println(startRA + " " + startDec);
j=test.SlewToCoords(startRA+1,startDec+24);
}
else
System.out.println("Not Connected");
}

}
Pls pls pls drop in your wise words and suggestions.
Regards,
Aryan.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
send ur c code also.....
 
What are you doing in my house? Get 'em tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic