-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from hideakitai/feature/support-art-sync
- Loading branch information
Showing
5 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#pragma once | ||
#ifndef ARTNET_ART_SYNC_H | ||
#define ARTNET_ART_SYNC_H | ||
|
||
#include "Common.h" | ||
#include <stdint.h> | ||
#include <stddef.h> | ||
|
||
namespace art_net { | ||
namespace art_sync { | ||
|
||
enum Index : uint16_t { | ||
ID = 0, | ||
OP_CODE_L = 8, | ||
OP_CODE_H = 9, | ||
PROTOCOL_VER_H = 10, | ||
PROTOCOL_VER_L = 11, | ||
AUX1 = 12, | ||
AUX2 = 13, | ||
}; | ||
|
||
inline void set_header(uint8_t *packet) | ||
{ | ||
for (size_t i = 0; i < ID_LENGTH; i++) packet[i] = static_cast<uint8_t>(ARTNET_ID[i]); | ||
packet[OP_CODE_L] = (static_cast<uint16_t>(OpCode::Sync) >> 0) & 0x00FF; | ||
packet[OP_CODE_H] = (static_cast<uint16_t>(OpCode::Sync) >> 8) & 0x00FF; | ||
packet[PROTOCOL_VER_H] = (PROTOCOL_VER >> 8) & 0x00FF; | ||
packet[PROTOCOL_VER_L] = (PROTOCOL_VER >> 0) & 0x00FF; | ||
packet[AUX1] = 0; | ||
packet[AUX2] = 0; | ||
} | ||
|
||
} // namespace art_sync | ||
} // namespace art_net | ||
|
||
#endif // ARTNET_ART_SYNC_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters