3 * Copyright © 2025 František Kučera (Frantovo.cz, GlobalCode.info)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 enum class MessageType : uint8_t {
26 /** device sends: greeting message */
29 /** host sends: seed1 */
32 /** device sends: hash1 and seed2 */
33 D13_HASH1_SEED2 = 0x13,
35 /** host sends: hash2 */
38 /** device sends: confirmation of successful handshake */
39 D15_CONFIRMATION = 0x15,
42 enum class FieldType : uint8_t {
43 /** manufacturer name */
47 /** seed1 from host | seed2 from device */
49 /** hash2 from host | hash1 from device */
51 /** seed3 from device */
58 std::vector<uint8_t> data;
60 Field(FieldType type, std::vector<uint8_t> data) : type(type), data(data) {
63 virtual ~Field() = default;
67 * Object representation of a raw MIDI message.
68 * Is either a result of parsing a raw message by MessageCodec, or constructed
69 * in the application to be serialized in MessageCodec to a raw message.
74 /** 0x17 for DJM-250MK2 and 0x34 for V10 */
76 std::vector<Field> fields;
78 Message(MessageType type, uint8_t model, std::vector<Field> fields) :
79 type(type), model(model), fields(fields) {
82 virtual ~Message() = default;
84 std::string toString() const;
86 std::vector<Field> findFields(FieldType type);