public class Message extends Object
Encapsulates a full dbserver message, made up of a list of Field objects,
and having a particular structure, as described in the
Packet Analysis paper.
Known message types are found in Message.KnownType. Many requests return a series of messages that
represent menu items; the known versions of these are reflected in Message.MenuItemType.
| Modifier and Type | Class and Description |
|---|---|
static class |
Message.KnownType
Defines all the message types we know about, with any information we know about their arguments.
|
static class |
Message.MenuIdentifier
For many types of query messages, the first argument of the message is a 4-byte integer which we currently
refer to as r:m:s:t, because the first byte is the player number of the player making the
request, the second byte identifies the menu or destination for which information is being
loaded, the third byte identifies the media slot (USB or SD) being asked about (as described in
CdjStatus.TrackSourceSlot), and the fourth byte identifies the type of
track being worked with (for most requests this is 1, meaning rekordbox). |
static class |
Message.MenuItemType
Defines all the known types of entries that an be returned for a menu request.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
ALNZ_FILE_TYPE_DAT
The value to pass for the file type argument of a
Message.KnownType.ANLZ_TAG_REQ request in order to obtain
an element of an ANLZnnnn.DAT file. |
static int |
ALNZ_FILE_TYPE_EXT
The value to pass for the file type argument of a
Message.KnownType.ANLZ_TAG_REQ request in order to obtain
an element of an ANLZnnnn.EXT file. |
static int |
ANLZ_FILE_TAG_COLOR_WAVEFORM_DETAIL
The value to pass for the tag type argument of a
Message.KnownType.ANLZ_TAG_REQ request in order to obtain
the scrollable color waveform data. |
static int |
ANLZ_FILE_TAG_COLOR_WAVEFORM_PREVIEW
The value to pass for the tag type argument of a
Message.KnownType.ANLZ_TAG_REQ request in order to obtain
the color waveform preview data. |
NumberField |
argumentCount
The 1-byte number field that specifies how many arguments the message has.
|
List<Field> |
arguments
The arguments being sent as part of this message.
|
List<Field> |
fields
The entire list of fields that make up the message.
|
static Map<Long,Message.KnownType> |
KNOWN_TYPE_MAP
Allows a known message type to be looked up by the message type number.
|
Message.KnownType |
knownType
The recognized type, if any, of this message.
|
static Map<Byte,Message.MenuIdentifier> |
MENU_IDENTIFIER_MAP
Allows a menu/destination to be looked up by the value seen in the second byte of the first argument of many
request messages.
|
static Map<Long,Message.MenuItemType> |
MENU_ITEM_TYPE_MAP
Allows a menu item type to be looked up by the value seen in the seventh argument of a
Message.KnownType.MENU_ITEM response. |
static NumberField |
MESSAGE_START
The special field that marks the start of a new message.
|
NumberField |
messageType
The 2-byte number field that identifies what type of message this is, immediately following the transaction
sequence number.
|
static long |
NO_MENU_RESULTS_AVAILABLE
The value returned by
getMenuResultsCount() when there is no data available for the request
that was made. |
NumberField |
transaction
The 4-byte number field that provides the sequence number tying a query to its response messages, immediately
following the message start field.
|
| Constructor and Description |
|---|
Message(long transaction,
long messageType,
Field... arguments)
Constructor for experimenting with new message types.
|
Message(long transaction,
Message.KnownType messageType,
Field... arguments)
Constructor from code using known message types.
|
Message(NumberField transaction,
NumberField messageType,
Field... arguments)
Constructor when being read from the network, so already have all the fields created.
|
| Modifier and Type | Method and Description |
|---|---|
Message.MenuItemType |
getMenuItemType()
Extracts the menu item type from a
Message.KnownType.MENU_ITEM response. |
long |
getMenuResultsCount()
Extracts the result count from a
Message.KnownType.MENU_AVAILABLE response. |
static Message |
read(DataInputStream is)
Read the next message from the stream.
|
String |
toString() |
void |
write(WritableByteChannel channel)
Writes the message to the specified channel, for example when creating metadata cache files.
|
public static final NumberField MESSAGE_START
public static final Map<Long,Message.KnownType> KNOWN_TYPE_MAP
public static final int ALNZ_FILE_TYPE_DAT
Message.KnownType.ANLZ_TAG_REQ request in order to obtain
an element of an ANLZnnnn.DAT file. (The characters "DAT" and NUL as a byte-swapped integer.)public static final int ALNZ_FILE_TYPE_EXT
Message.KnownType.ANLZ_TAG_REQ request in order to obtain
an element of an ANLZnnnn.EXT file. (The characters "EXT" and NUL as a byte-swapped integer.)public static final int ANLZ_FILE_TAG_COLOR_WAVEFORM_PREVIEW
Message.KnownType.ANLZ_TAG_REQ request in order to obtain
the color waveform preview data. (The characters "PWV4" as a byte-swapped integer.)public static final int ANLZ_FILE_TAG_COLOR_WAVEFORM_DETAIL
Message.KnownType.ANLZ_TAG_REQ request in order to obtain
the scrollable color waveform data. (The characters "PWV5" as a byte-swapped integer.)public static final Map<Long,Message.MenuItemType> MENU_ITEM_TYPE_MAP
Message.KnownType.MENU_ITEM response.public final NumberField transaction
public final NumberField messageType
public final Message.KnownType knownType
public final NumberField argumentCount
public static final Map<Byte,Message.MenuIdentifier> MENU_IDENTIFIER_MAP
public static final long NO_MENU_RESULTS_AVAILABLE
getMenuResultsCount() when there is no data available for the request
that was made.public Message(long transaction,
long messageType,
Field... arguments)
transaction - the transaction ID (sequence number) that ties a message to its responsesmessageType - identifies the purpose and structure of the messagearguments - the arguments to send with the messagepublic Message(long transaction,
Message.KnownType messageType,
Field... arguments)
transaction - the transaction ID (sequence number) that ties a message to its responsesmessageType - identifies the purpose and structure of the messagearguments - the arguments to send with the messagepublic Message(NumberField transaction, NumberField messageType, Field... arguments)
transaction - the transaction ID (sequence number) that ties a message to its responsesmessageType - identifies the purpose and structure of the messagearguments - the arguments to send with the messagepublic static Message read(DataInputStream is) throws IOException
is - a stream connected to a dbserver which is expected to be sending a message.IOException - if there is a problem reading the message.public long getMenuResultsCount()
Message.KnownType.MENU_AVAILABLE response.IllegalArgumentException - if this is not a Message.KnownType.MENU_AVAILABLE response.public Message.MenuItemType getMenuItemType()
Message.KnownType.MENU_ITEM response.IllegalArgumentException - if this is not a Message.KnownType.MENU_ITEM response.public void write(WritableByteChannel channel) throws IOException
channel - the channel to which it should be writtenIOException - if there is a problem writing to the channelCopyright © 2016–2019 Deep Symmetry, LLC. All rights reserved.