Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parsing for streaming status command #99

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ATEM_tally_light/ATEM_tally_light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void loop() {
// Initialize a connection to the switcher:
if (firstRun) {
atemSwitcher.begin(settings.switcherIP);
//atemSwitcher.serialOutput(0xff); //Makes Atem library print debug info
//atemSwitcher.serialOutput(0x80); //Makes Atem library print debug info
Serial.println("------------------------");
Serial.println("Connecting to switcher...");
Serial.println((String)"Switcher IP: " + settings.switcherIP[0] + "." + settings.switcherIP[1] + "." + settings.switcherIP[2] + "." + settings.switcherIP[3]);
Expand Down
69 changes: 68 additions & 1 deletion libraries/ATEMmin/ATEMmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ ATEMmin::ATEMmin(){}
* Added by Aron N. Het Lam
* Functionality to parse and retrieve streaming status.
*/
else
else
if(!strcmp_P(cmdStr, PSTR("StRS"))) {
#if ATEM_debug
temp = streamingStatusFlags;
Expand All @@ -357,6 +357,18 @@ ATEMmin::ATEMmin(){}
Serial.println(streamingStatusFlags);
}
#endif
} else
if(!strcmp_P(cmdStr, PSTR("RTMS"))) {
#if ATEM_debug
temp = recordingStatusFlags;
#endif
recordingStatusFlags = word(_packetBuffer[0], _packetBuffer[1]);
#if ATEM_debug
if ((_serialOutput==0x80 && recordingStatusFlags!=temp) || (_serialOutput==0x81 && !hasInitialized())) {
Serial.print(F("recordingStatusFlags = "));
Serial.println(recordingStatusFlags);
}
#endif
}
}

Expand Down Expand Up @@ -697,3 +709,58 @@ ATEMmin::ATEMmin(){}
bool ATEMmin::getStreamUnknownError() {
return streamingStatusFlags & 1 << 15;
}

/**
* Get raw recording status flags
*/
uint16_t ATEMmin::getRecordingStatusFlags() { return recordingStatusFlags; }

/**
* Get recording status idle flag
*/
bool ATEMmin::getRecordingIdle() { return recordingStatusFlags == 0; }

/**
* Get recording status is recording flag
*/
bool ATEMmin::getRecordingRecording() { return recordingStatusFlags & 1 << 0; }

/**
* Get recording status is stopping flag
*/
bool ATEMmin::getRecordingStopping() { return recordingStatusFlags & 1 << 7; }

/**
* Get recording status error none flag
*/
bool ATEMmin::getRecordingErrorNone() { return recordingStatusFlags & 1 << 1; }

/**
* Get recording status error no media flag
*/
bool ATEMmin::getRecordingNoMedial() { return recordingStatusFlags == 0; }

/**
* Get recording status error media full flag
*/
bool ATEMmin::getRecordingMediaFull() { return recordingStatusFlags & 1 << 2; }

/**
* Get recording status media error flag
*/
bool ATEMmin::getRecordingMediaError() { return recordingStatusFlags & 1 << 3; }

/**
* Get recording status media unformatted flag
*/
bool ATEMmin::getRecordingMediaUnformatted() { return recordingStatusFlags & 1 << 4; }

/**
* Get recording status error dropping frames flag
*/
bool ATEMmin::getRecordingDroppingFrames() { return recordingStatusFlags & 1 << 5; }

/**
* Get recording status unknown error flag
*/
bool ATEMmin::getRecordingUnknownError() { return recordingStatusFlags & 1 << 15; }
12 changes: 12 additions & 0 deletions libraries/ATEMmin/ATEMmin.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class ATEMmin : public ATEMbase
uint16_t atemTallyByIndexSources;
uint8_t atemTallyByIndexTallyFlags[41];
uint16_t streamingStatusFlags; //Added by Aron N. Het Lam
uint16_t recordingStatusFlags; //Added by Aron N. Het Lam

public:
// Public Methods in ATEM.h:
Expand Down Expand Up @@ -123,6 +124,17 @@ class ATEMmin : public ATEMbase
bool getStreamInvalidState();
bool getStreamStopping();
bool getStreamUnknownError();
uint16_t getRecordingStatusFlags();
bool getRecordingIdle();
bool getRecordingRecording();
bool getRecordingStopping();
bool getRecordingErrorNone();
bool getRecordingNoMedial();
bool getRecordingMediaFull();
bool getRecordingMediaError();
bool getRecordingMediaUnformatted();
bool getRecordingDroppingFrames();
bool getRecordingUnknownError();
};

#endif
Expand Down
Loading