The code sample was coded to run a socket connection out to some url on a port number. Having that work in a thread is a fairly good idea. Provides good overall JAVA experience with treads. So for my needs, the socket code was hacked out and replaced with a call to run an AntennaThread and ReceiverThread. A util class was coded to support the normal set / get methods, specifically a set method to set a polling interval [util.setPolling()] (within the endless loop), funny I had forgot to instantiate the method so my util.getPolling() always returned 0. It polled really quick!
A util.getTime() was added which returns the date / time as 12-Oct-12 12:30:00. Pretty helpful when logging Antenna or Receiver events. The recent work with Calendar c = new Calendar() and Date d = new Date() along with the SimpleDateFormat was very helpful. Every JAVA programmer needs to be familiar with that.
Driving factor behind this interest comes from a typical satellite ground control system. There are antennas the need to be pointed, receivers that need to have frequencies set and a multitude of other devices that require various setting and configurations. It is best to have this automated. The existing system I work on uses complex multi-thread driven device handlers to do this work. Interest is, can this be done with JAVA in a similar high level design.
This file is called t1.java and is a Netbeans project so it can be called up and worked on as needed. Additional work is to bring the socket code back in and have it read some url out there and simply stream in the url text. Even better is to extend the thread into a jPanel / jInternalFrame with a jTextField as the display. Oh, it will need a button or two in order to stop the thread. That would be pretty cool.
This file is called t1.java and is a Netbeans project so it can be called up and worked on as needed. Additional work is to bring the socket code back in and have it read some url out there and simply stream in the url text. Even better is to extend the thread into a jPanel / jInternalFrame with a jTextField as the display. Oh, it will need a button or two in order to stop the thread. That would be pretty cool.
No comments:
Post a Comment