FIX: comment is now @doc compatible
This commit is contained in:
parent
0b8c2c574c
commit
d1f0fe3c47
@ -19,13 +19,13 @@ import ithakimodem.*;
|
||||
* a convenient and common API for all the session functionalities
|
||||
*/
|
||||
class Com {
|
||||
static final int SPEED_DEFAULT = 48000; /**< default communication speed [bps] */
|
||||
static final int TIMEOUT_DEFAULT = 2000; /**< default timeout values [sec] */
|
||||
static final String URL_DEFAULT = "ithaki"; /**< Default destination. Ithaki of-course */
|
||||
static final int SPEED_DEFAULT = 48000; /** default communication speed [bps] */
|
||||
static final int TIMEOUT_DEFAULT = 2000; /** default timeout values [sec] */
|
||||
static final String URL_DEFAULT = "ithaki"; /** Default destination. Ithaki of-course */
|
||||
|
||||
private Modem modem_; /**< Ref to Modem */
|
||||
private int speed_; /**< Communication speed [bps] */
|
||||
private int timeout_; /**< communication timeout [sec] */
|
||||
private Modem modem_; /** Ref to Modem */
|
||||
private int speed_; /** Communication speed [bps] */
|
||||
private int timeout_; /** communication timeout [sec] */
|
||||
|
||||
/**
|
||||
* Basic constructor
|
||||
@ -146,9 +146,10 @@ class Com {
|
||||
data.size = _copy (data.response, begin);
|
||||
have_begin = true;
|
||||
}
|
||||
} while (ch != -1 &&
|
||||
(!have_begin ||
|
||||
( (bin || (detect (data.response, "\r\n\n\n".getBytes(), data.size) == -1))
|
||||
} while (
|
||||
ch != -1 && (
|
||||
!have_begin || (
|
||||
(bin || (detect (data.response, "\r\n\n\n".getBytes(), data.size) == -1))
|
||||
&& (bin || (detect (data.response, "NO CARRIER".getBytes(), data.size) == -1))
|
||||
&& (detect (data.response, end, data.size) == -1)
|
||||
)
|
||||
@ -229,11 +230,11 @@ class Com {
|
||||
* Class to represent client-server transaction data
|
||||
*/
|
||||
class Transaction {
|
||||
byte[] code; /**< request code from client */
|
||||
byte[] response; /**< response data from server */
|
||||
long departure; /**< request time */
|
||||
long arrival; /**< response time */
|
||||
int size; /**< size of response data in bytes */
|
||||
byte[] code; /** request code from client */
|
||||
byte[] response; /** response data from server */
|
||||
long departure; /** request time */
|
||||
long arrival; /** response time */
|
||||
int size; /** size of response data in bytes */
|
||||
|
||||
/**
|
||||
* Basic constructor
|
||||
|
@ -12,16 +12,16 @@ package net.hoo2.auth.vmodem;
|
||||
* Class to used for the echo sequence
|
||||
*/
|
||||
class Echo {
|
||||
static final int ECHO_DURATION_DEFAULT = 240; /**< Default duration for the sequence */
|
||||
static final int ECHO_BUFFER_SIZE = 256; /**< Echo buffer size */
|
||||
static final String ECHO_BEGIN = "PSTART"; /**< Begin pattern of the response */
|
||||
static final String ECHO_END = "PSTOP"; /**< End pattern of the response */
|
||||
static final int ECHO_DURATION_DEFAULT = 240; /** Default duration for the sequence */
|
||||
static final int ECHO_BUFFER_SIZE = 256; /** Echo buffer size */
|
||||
static final String ECHO_BEGIN = "PSTART"; /** Begin pattern of the response */
|
||||
static final String ECHO_END = "PSTOP"; /** End pattern of the response */
|
||||
|
||||
private Com com_; /**< Reference to communication module */
|
||||
private Log log_; /**< Reference to logging module */
|
||||
private Transaction transaction_; /**< A transaction object to used as a buffer for all requests */
|
||||
private int duration_; /**< The desired duration for the session */
|
||||
private byte[] code_; /**< The desired code for the session */
|
||||
private Com com_; /** Reference to communication module */
|
||||
private Log log_; /** Reference to logging module */
|
||||
private Transaction transaction_; /** A transaction object to used as a buffer for all requests */
|
||||
private int duration_; /** The desired duration for the session */
|
||||
private byte[] code_; /** The desired code for the session */
|
||||
|
||||
/**
|
||||
* Basic constructor
|
||||
|
@ -17,28 +17,28 @@ import java.util.Arrays;
|
||||
* Class to used for the GPS session
|
||||
*/
|
||||
class GPS {
|
||||
static final int GPS_BUFFER_SIZE = 256; /**< GPS trace buffer size */
|
||||
static final String GPS_BEGIN = "START ITHAKI GPS TRACKING"; /**< starting pattern */
|
||||
static final String GPS_END = "STOP ITHAKI GPS TRACKING"; /**< ending pattern */
|
||||
static final int GPS_USE_TRACK = 1; /**< Which track to use (given) */
|
||||
static final String GPS_TRACK_PREFIX = "R="; /**< GPS command track request prefix */
|
||||
static final String GPS_IMAGE_PREFIX = "T="; /**< GPS command image request prefix */
|
||||
static final int GPS_MAX_POINTS = 9; /**< Maximum points (given) */
|
||||
static final int GPS_COORDINATES_SIZE = 6; /**< Coordinates size */
|
||||
static final int GPS_BUFFER_SIZE = 256; /** GPS trace buffer size */
|
||||
static final String GPS_BEGIN = "START ITHAKI GPS TRACKING"; /** starting pattern */
|
||||
static final String GPS_END = "STOP ITHAKI GPS TRACKING"; /** ending pattern */
|
||||
static final int GPS_USE_TRACK = 1; /** Which track to use (given) */
|
||||
static final String GPS_TRACK_PREFIX = "R="; /** GPS command track request prefix */
|
||||
static final String GPS_IMAGE_PREFIX = "T="; /** GPS command image request prefix */
|
||||
static final int GPS_MAX_POINTS = 9; /** Maximum points (given) */
|
||||
static final int GPS_COORDINATES_SIZE = 6; /** Coordinates size */
|
||||
|
||||
static final int GPS_LATITUDE_BEGIN = 17; /**< The latitude sequence string position */
|
||||
static final int GPS_LATITUDE_END = 28; /**< The end of latitude sequence string position */
|
||||
static final int GPS_LONGITUDE_BEGIN= 29; /**< The longitude sequence string position */
|
||||
static final int GPS_LONGITUDE_END = 41; /**< The end of longitude sequence string position */
|
||||
static final int GPS_LATITUDE_BEGIN = 17; /** The latitude sequence string position */
|
||||
static final int GPS_LATITUDE_END = 28; /** The end of latitude sequence string position */
|
||||
static final int GPS_LONGITUDE_BEGIN= 29; /** The longitude sequence string position */
|
||||
static final int GPS_LONGITUDE_END = 41; /** The end of longitude sequence string position */
|
||||
|
||||
private Com com_; /**< Reference to communication module */
|
||||
private Log log_; /**< Reference to logging module */
|
||||
private Transaction transaction_; /**< A transaction object to used as a buffer for all requests */
|
||||
private byte[] code_; /**< The desired code for the session */
|
||||
private int start_; /**< Starting point [sec] */
|
||||
private int duration_; /**< Duration of requested trace */
|
||||
private int points_; /**< Number of points to fetch from the above trace */
|
||||
private byte[] coordinates_; /**< Coordinates buffer */
|
||||
private Com com_; /** Reference to communication module */
|
||||
private Log log_; /** Reference to logging module */
|
||||
private Transaction transaction_; /** A transaction object to used as a buffer for all requests */
|
||||
private byte[] code_; /** The desired code for the session */
|
||||
private int start_; /** Starting point [sec] */
|
||||
private int duration_; /** Duration of requested trace */
|
||||
private int points_; /** Number of points to fetch from the above trace */
|
||||
private byte[] coordinates_; /** Coordinates buffer */
|
||||
|
||||
/**
|
||||
* Basic constructor
|
||||
|
@ -17,16 +17,16 @@ import java.io.*;
|
||||
* Class to used for the error free and non error free image requests
|
||||
*/
|
||||
class Image {
|
||||
static final int IMAGE_BUFFER_SIZE = 256*1024; /**< image buffer size */
|
||||
static final byte[] IMAGE_BEGIN = {(byte)0xFF, (byte)0xD8}; /**< jpeg image begin pattern */
|
||||
static final byte[] IMAGE_END = {(byte)0xFF, (byte)0xD9}; /**< jpeg image end pattern */
|
||||
static final int IMAGE_BUFFER_SIZE = 256*1024; /** image buffer size */
|
||||
static final byte[] IMAGE_BEGIN = {(byte)0xFF, (byte)0xD8}; /** jpeg image begin pattern */
|
||||
static final byte[] IMAGE_END = {(byte)0xFF, (byte)0xD9}; /** jpeg image end pattern */
|
||||
|
||||
private Com com_; /**< Reference to communication module */
|
||||
private Log log_; /**< Reference to logging module */
|
||||
private Transaction transaction_; /**< A transaction object to used as a buffer for all requests */
|
||||
private String filename_; /**< The filename to store */
|
||||
private int items_; /**< how many images to fetch */
|
||||
private byte[] code_; /**< The image request code for the virtual lab */
|
||||
private Com com_; /** Reference to communication module */
|
||||
private Log log_; /** Reference to logging module */
|
||||
private Transaction transaction_; /** A transaction object to used as a buffer for all requests */
|
||||
private String filename_; /** The filename to store */
|
||||
private int items_; /** how many images to fetch */
|
||||
private byte[] code_; /** The image request code for the virtual lab */
|
||||
|
||||
/**
|
||||
* Basic constructor
|
||||
|
@ -19,9 +19,9 @@ import java.io.PrintWriter;
|
||||
*/
|
||||
class Log {
|
||||
|
||||
private String logfile_; /**< The log file name */
|
||||
private boolean verbose_; /**< The desired verbosity (for the console)*/
|
||||
private PrintWriter writer_; /**< A buffered writer to use for streaming */
|
||||
private String logfile_; /** The log file name */
|
||||
private boolean verbose_; /** The desired verbosity (for the console)*/
|
||||
private PrintWriter writer_; /** A buffered writer to use for streaming */
|
||||
|
||||
/**
|
||||
* Basic constructor
|
||||
|
@ -3,6 +3,14 @@
|
||||
* @brief
|
||||
* Contain the Main class for the project VirtualModem
|
||||
*
|
||||
* Usage examples:
|
||||
* ==========================
|
||||
* java -jar ./VirtualModem.jar -v -l Exxxx-$(date +%F-%T).log -e Exxxx 600
|
||||
* java -jar ./VirtualModem.jar -v -l Qxxx-Rxxxx-$(date +%F-%T).log -a Qxxxx Rxxxx 600
|
||||
* java -jar ./VirtualModem.jar -v -l Pxxxx_600_80_8p-$(date +%F-%T).log -p Pxxxx 600 80 8 P1124-$(date +%F-%T)
|
||||
* java -jar ./VirtualModem.jar -v -l Mxxxx-$(date +%F-%T).log -g Mxxxx Mxxxx-$(date +%F-%T) 2
|
||||
* java -jar ./VirtualModem.jar -v -l Gxxxx-$(date +%F-%T).log -g Gxxxx Gxxxx-$(date +%F-%T) 2
|
||||
*
|
||||
* @author Christos Choutouridis AEM:8997
|
||||
* @email cchoutou@ece.auth.gr
|
||||
*/
|
||||
@ -10,7 +18,7 @@ package net.hoo2.auth.vmodem;
|
||||
|
||||
/** @name imports */
|
||||
/** @{ */
|
||||
import org.apache.commons.cli.*; /**< command line utility */
|
||||
import org.apache.commons.cli.*; /** command line utility */
|
||||
/** @} */
|
||||
|
||||
|
||||
@ -20,19 +28,19 @@ import org.apache.commons.cli.*; /**< command line utility */
|
||||
* @brief This is the main control class of the program.
|
||||
*
|
||||
* This class includes the main function which read the user input
|
||||
* and create the apropriate object for the requested sequence to
|
||||
* and create the appropriate object for the requested sequence to
|
||||
* retrieve data.
|
||||
*/
|
||||
public class VirtualModem {
|
||||
|
||||
/** @name Data */
|
||||
/** @{ */
|
||||
CommandLine line; /**< Command line for the argument list */
|
||||
CommandLineParser parser; /**< Parser for the argument list */
|
||||
Options options; /**< Option configuration container */
|
||||
HelpFormatter formatter; /**< An extra helper for -h */
|
||||
Com com; /**< Reference to basic configuration module */
|
||||
Log log; /**< Reference to basig logging module */
|
||||
CommandLine line; /** Command line for the argument list */
|
||||
CommandLineParser parser; /** Parser for the argument list */
|
||||
Options options; /** Option configuration container */
|
||||
HelpFormatter formatter; /** An extra helper for -h */
|
||||
Com com; /** Reference to basic configuration module */
|
||||
Log log; /** Reference to basic logging module */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
@ -198,12 +206,16 @@ public class VirtualModem {
|
||||
}
|
||||
else if (line.hasOption("gps")) {
|
||||
byte[] code = line.getOptionValues("gps")[0].getBytes();
|
||||
GPS g = new GPS (com, log, code,
|
||||
GPS g = new GPS (
|
||||
com, log, code,
|
||||
Integer.valueOf(line.getOptionValues("gps")[1]),
|
||||
Integer.valueOf(line.getOptionValues("gps")[2]),
|
||||
Integer.valueOf(line.getOptionValues("gps")[3]));
|
||||
Image im = new Image (com, log, null,
|
||||
line.getOptionValues("gps")[4], 1);
|
||||
Integer.valueOf(line.getOptionValues("gps")[3])
|
||||
);
|
||||
Image im = new Image (
|
||||
com, log, null,
|
||||
line.getOptionValues("gps")[4], 1
|
||||
);
|
||||
if (com.open()) {
|
||||
g.caption();
|
||||
im.code(g.run().getBytes());
|
||||
|
Loading…
x
Reference in New Issue
Block a user