System 3 Server Software
This page will document the server software. It is written in java, and the source is at /home/tmrc/sys3/server/tmrc/railserver.
TCP Command and Status Interface
The control and status to the server software is via a TCP port. The messages sent across the port are in the form of LISP s-expressions
Status is entirely in the form of "(set ...)" s-expressions, setting the state of some object. The complete status is sent when a TCP connection is created and authenticated.
Incoming requests from SCab2 are parsed in /home/tmrc/sys3/server/tmrc/railserver/TCPControl2.java. These are the commands:
- Send a full update of system state, as is sent when first connected and authenticated.
- Send state information on all connections. Connections are the connections between blocks and blocks or switches or crossings or turntables.
- Quit the session, closing the TCP connection.
- (info arg)
- Something to do with debugging.
- (findpath (obj "train-name") (Obj "track-name"))
- Find the path (a route for local switching) for the given train-name and track-name.
- (selectPath area-number path-number)
- Select the path in the area (which is really A followed by area-number, and set the switches along the path given by path-number.
- (packet) args...)
- Sends a packet on the picnet. (Specifics needed.)
- (throwSwitch (obj "switch-name") boolean)
- Throw the switch identified by switch-name to normal if boolean is #f or to reverse (diverging, crossover) if boolean is #t.
- (rotate (obj "turntable-name") number number)
- Rotate the turntable identified by turntable-name to the track setlected by one number and the end of the turntable bridge selected by the other number. This would be used when you have a locomotive on the turntable, and want to align it with a track pointing in a specific direction. (Specfics needed.)
- (rotateToClosest (Obj "turnable-name") track-number)
- Rotate the turntable identified by turntable-name with the least movement to align with the track specified by track-number. This would be used when the turntable is empty, and you need to move a locomotive onto it.
- (setOutOfService (Obj "track-name") boolean)
- Set the track idenfied by track-name out of service if boolean is #t or in-service if it is #f. Will generate a response s-expression (set (Obj "track-name") boolean) to update the state of the block.
- (speed (Obj "train-name") number)
- Sets the speed of the train identified by train-name to a number in the range 0-100.
- (addTrain (obj "train-name") (Obj "block-name"))
- Create a "soft" train (not associated with a hardware cab) with the name train-name in the block block-name. The train name must not aready exist. There must be an occupancy in the block, which is not presently associated with an existing train. The direction of the train is always TBD.
- (delTrain (obj "train-name"))
- Delete the "soft" train with the given train-name.
- (reverseTrain (Obj "train-name"))
- Reverse the direction of the train identified by train-name.
- (setDirection (Obj "train-name" boolean)
- Set the direction of the train identified by train-name. The boolean identifies the desired direction, with some relation betwee true/false and eastbound/westbound. (Details needed.)
- (callOn (Obj "train-name"))
- For the train idenfied by train-name, do a "call-on", taking control of the occupied block in front of the train, if it is not part of another train.
- (stealAhead (Obj "train-name"))
- For the train identified by train-name, do a "steal-ahead."
- (dropBehind (obj "train-name"))
- FOr the train identified by train-name, drop all occupied block from the rear of the train. (It may only drop blocks with non-engine occupancy.)
- (assignCab (Obj "cab-name") (obj "train-name"))
- Assign the train identified by train-name to the hardware cab named cab-name. Since no block is specified, presumably the train must have been created with the (addTrain) command.
- (releaseCab (Obj "cab-name"))
- Release the hardware cab identified by cab-name.
Tech Model Railroad Club of
MIT Room N52-118
265 Massachusetts Avenue
Cambridge, MA 02139
+1 617 253-3269