|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--its.backbone.frame.ItsFrameReceiver | +--its.backbone.sdd.SddReceiver | +--hw6.TrafficReceiver
This class reads a network socket to get updates indicating where the buses in the King County Metro bus system are. Any object that wants to hear about changes in the state of the various transit buses must implement TransitBusListener and register as a listener with the TrafficSource object.
Field Summary |
Fields inherited from class its.backbone.frame.ItsFrameReceiver |
ignoreStreamTimeout |
Constructor Summary | |
TrafficReceiver(java.lang.String hostname,
int port)
Create a TrafficReceiver object to read data from the specified source. |
Method Summary | |
void |
addTransitBusListener(hw6.TransitBusListener ear)
Add an object that wants to be notified of TransitBusEvents. |
void |
extractedDataReceived(java.util.Hashtable ht,
java.lang.String serialNum)
This method is called when a data frame arrives from the transmitter and has been pre-processed into a hashtable with one ContentsData object for each table in the data frame. |
protected void |
fireTransitBusEvent(java.lang.String tv,
int vin,
double lat,
double lon,
int route)
Notify all listeners that have registered interest for notification on TransitBusEvents that a new data record has arrived. |
void |
removeTransitBusListener(hw6.TransitBusListener ear)
Remove an object that no longer wants to be notified of TransitBusEvents. |
Methods inherited from class its.backbone.sdd.SddReceiver |
contentsReceived, dataReceived, extractorReceived, frameReceived, schemaReceived |
Methods inherited from class its.backbone.frame.ItsFrameReceiver |
getFrameQueue, getInputBuffer, run, start, stop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TrafficReceiver(java.lang.String hostname, int port) throws java.io.IOException
hostname
- the network host that is supplying the dataport
- the port that the data is being read fromMethod Detail |
public void extractedDataReceived(java.util.Hashtable ht, java.lang.String serialNum)
extractedDataReceived
in class its.backbone.sdd.SddReceiver
ht
- the hash table containing the tablesserialNum
- the serial number for this data framepublic void addTransitBusListener(hw6.TransitBusListener ear)
ear
- the object that wants to listen for TransitBusEventspublic void removeTransitBusListener(hw6.TransitBusListener ear)
ear
- the object that no longer wants to listen for TransitBusEventsprotected void fireTransitBusEvent(java.lang.String tv, int vin, double lat, double lon, int route)
tv
- the time value String associated with this updatevin
- the Vehicle ID number for this buslat
- the latitude for this buslon
- the longitude for this busroute
- the route number for this bus
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |