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

fix luxonis/depthai-core#650 missing XLinkProtocolToStr() #657

Merged
merged 1 commit into from
Dec 9, 2022
Merged
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
17 changes: 16 additions & 1 deletion examples/bootloader/flash_bootloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
#include "depthai/depthai.hpp"
#include "depthai/xlink/XLinkConnection.hpp"

static const char* ProtocolToStr(XLinkProtocol_t val) {
switch (val) {
case X_LINK_USB_VSC: return "X_LINK_USB_VSC";
case X_LINK_USB_CDC: return "X_LINK_USB_CDC";
case X_LINK_PCIE: return "X_LINK_PCIE";
case X_LINK_IPC: return "X_LINK_IPC";
case X_LINK_TCP_IP: return "X_LINK_TCP_IP";
case X_LINK_NMB_OF_PROTOCOLS: return "X_LINK_NMB_OF_PROTOCOLS";
case X_LINK_ANY_PROTOCOL: return "X_LINK_ANY_PROTOCOL";
default:
return "INVALID_ENUM_VALUE";
break;
}
}

int main(int argc, char** argv) {
using namespace std::chrono;

Expand All @@ -29,7 +44,7 @@ int main(int argc, char** argv) {
} else {
for(int i = 0; i < deviceInfos.size(); i++) {
const auto& devInfo = deviceInfos[i];
std::cout << "[" << i << "] " << devInfo.getMxId() << "[" << XLinkProtocolToStr(devInfo.protocol) << "]";
std::cout << "[" << i << "] " << devInfo.getMxId() << "[" << ProtocolToStr(devInfo.protocol) << "]";
if(devInfo.state == X_LINK_BOOTLOADER) {
dai::DeviceBootloader bl(devInfo);
std::cout << " current bootloader: " << bl.getVersion();
Expand Down
17 changes: 16 additions & 1 deletion examples/bootloader/flash_user_bootloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
#include "depthai/depthai.hpp"
#include "depthai/xlink/XLinkConnection.hpp"

static const char* ProtocolToStr(XLinkProtocol_t val) {
switch (val) {
case X_LINK_USB_VSC: return "X_LINK_USB_VSC";
case X_LINK_USB_CDC: return "X_LINK_USB_CDC";
case X_LINK_PCIE: return "X_LINK_PCIE";
case X_LINK_IPC: return "X_LINK_IPC";
case X_LINK_TCP_IP: return "X_LINK_TCP_IP";
case X_LINK_NMB_OF_PROTOCOLS: return "X_LINK_NMB_OF_PROTOCOLS";
case X_LINK_ANY_PROTOCOL: return "X_LINK_ANY_PROTOCOL";
default:
return "INVALID_ENUM_VALUE";
break;
}
}

int main(int argc, char** argv) try {
using namespace std::chrono;

Expand All @@ -16,7 +31,7 @@ int main(int argc, char** argv) try {
} else {
for(int i = 0; i < deviceInfos.size(); i++) {
const auto& devInfo = deviceInfos[i];
std::cout << "[" << i << "] " << devInfo.getMxId() << "[" << XLinkProtocolToStr(devInfo.protocol) << "]";
std::cout << "[" << i << "] " << devInfo.getMxId() << "[" << ProtocolToStr(devInfo.protocol) << "]";
if(devInfo.state == X_LINK_BOOTLOADER) {
dai::DeviceBootloader bl(devInfo);
std::cout << " current bootloader: " << bl.getVersion();
Expand Down