0,0 → 1,96 |
package dongfang.mkt.frames; |
|
public abstract class Frame { |
public static final byte FC_ADDRESS = 1; |
public static final byte NC_ADDRESS = 2; |
public static final byte MK3MAG_ADDRESS = 3; |
|
/* General / several targets */ |
|
public enum REQUEST_IDS { |
ANALOG_DEBUG_LABEL('a'), |
EXTERNAL_CONTROL('b'), |
DISPLAY1('h'), |
DISPLAY2('l'), |
VERSION('v'), |
ANALOG_DEBUG('d'), |
RESET('R'), |
COMPASSHEADING('K'), |
MOTORTEST('t'), |
READPARAMETERSET('q'), |
WRITEPARAMETERSET('s'), |
RCCHANNELS('p'), |
DDATAINTERVAL('c'), |
READMIXERTABLE('n'), |
WRITEMIXERTABLE('m'), |
CHANGEPARAMETERSET('f'), |
NC_TESTLINK('z'), |
NC_ERRORTEXT('e'), |
NC_SET_WAYPOINT('w'), |
NC_GET_WAYPOINT('x'), |
GET_OSDDATA('o'), |
REDIRECT_UART('u'), |
SET3DDATA_INTERVAL('c'), |
MK3MAGHEADING ('w'); |
|
private final char id; |
REQUEST_IDS(char id) { this.id = id; } |
public char getId() {return id;} |
} |
|
public static enum RESPONSE_IDS { |
ANALOG_DEBUG_LABEL('A'), |
EXTERNAL_CONTROL('B'), |
DISPLAY1('H'), |
DISPLAY2('L'), |
VERSION('V'), |
ANALOG_DEBUG('D'), |
/* FC specific */ |
COMPASSHEADING('w'), |
MOTORTEST('T'), |
READPARAMETERSET('Q'), |
WRITEPARAMETERSET('S'), |
RCCHANNELS('P'), |
THREEDDATAINTERVAL('C'), |
READMIXERTABLE('N'), |
WRITEMIXERTABLE('M'), |
CHANGEPARAMETERSET('F'), |
REQUEST_SETVARIABLE('y'), |
/* NC specific */ |
NC_TESTLINK('Z'), |
NC_ERRORTEXT('E'), |
REQUEST_NC_SET_TARGETPOSITION('s'), |
NC_SET_WAYPOINT('W'), |
NC_GET_WAYPOINT('X'), |
GET_OSDDATA('O'), |
SET3DDATA_INTERVAL('C'), |
/* Mk3Mag specific */ |
MK3MAGHEADING('K'); |
|
private final char id; |
RESPONSE_IDS(char id) { this.id = id; } |
public char getId() { return id; } |
} |
|
/* |
public ResponseFrame getResponseFrameInstance(RESPONSE_IDS id) { |
switch (id) { |
case ANALOG_DEBUG_LABEL: return new AnalogDebugLabelResponseFrame(); |
case EXTERNAL_CONTROL: return new ExternalControlResponseFrame(); |
case DISPLAY1: return new Display1ResponseFrame(); |
case DISPLAY2: return new Display2ResponseFrame(); |
case VERSION: return new VersionResponseFrame(); |
} |
} |
*/ |
|
protected final int address; |
|
protected Frame(int address) { |
this.address = address; |
} |
|
public int getAddress() { |
return address; |
} |
} |