Skip to content
Snippets Groups Projects
Commit a60fa0b3 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Use more exceptions in SDK

parent 78e73faa
No related branches found
No related tags found
No related merge requests found
Pipeline #33802 passed
...@@ -43,7 +43,7 @@ ExternalProject_Add( ...@@ -43,7 +43,7 @@ ExternalProject_Add(
BINARY_DIR ${SDK_BINARY_DIR} BINARY_DIR ${SDK_BINARY_DIR}
INSTALL_COMMAND "" INSTALL_COMMAND ""
BUILD_ALWAYS true BUILD_ALWAYS true
CMAKE_ARGS -DOpenCV_DIR=${OpenCV_DIR} CMAKE_ARGS -DOpenCV_DIR=${OpenCV_DIR} -DWITH_PYTHON=True
) )
if (BUILD_TESTS) if (BUILD_TESTS)
......
...@@ -16,7 +16,7 @@ RoomImpl::~RoomImpl() ...@@ -16,7 +16,7 @@ RoomImpl::~RoomImpl()
if (filter_) filter_->remove(); if (filter_) filter_->remove();
} }
bool RoomImpl::waitNextFrame(int64_t timeout) bool RoomImpl::waitNextFrame(int64_t timeout, bool except)
{ {
if (!filter_) if (!filter_)
{ {
...@@ -40,10 +40,15 @@ bool RoomImpl::waitNextFrame(int64_t timeout) ...@@ -40,10 +40,15 @@ bool RoomImpl::waitNextFrame(int64_t timeout)
return last_read_ < last_seen_; return last_read_ < last_seen_;
}); });
if (except && last_read_ >= last_seen_)
{
throw voltu::exceptions::Timeout();
}
return last_read_ < last_seen_; return last_read_ < last_seen_;
} }
else if (timeout == 0) else if (timeout == 0)
{ {
if (except) throw voltu::exceptions::Timeout();
return false; return false;
} }
else else
......
...@@ -16,7 +16,7 @@ public: ...@@ -16,7 +16,7 @@ public:
~RoomImpl() override; ~RoomImpl() override;
bool waitNextFrame(int64_t) override; bool waitNextFrame(int64_t, bool except) override;
voltu::FramePtr getFrame() override; voltu::FramePtr getFrame() override;
......
...@@ -87,6 +87,11 @@ std::list<voltu::RoomId> SystemImpl::listRooms() ...@@ -87,6 +87,11 @@ std::list<voltu::RoomId> SystemImpl::listRooms()
voltu::RoomPtr SystemImpl::getRoom(voltu::RoomId id) voltu::RoomPtr SystemImpl::getRoom(voltu::RoomId id)
{ {
if (feed_->getURI(id).size() == 0)
{
throw voltu::exceptions::InvalidRoomId();
}
auto s = std::make_shared<voltu::internal::RoomImpl>(feed_); auto s = std::make_shared<voltu::internal::RoomImpl>(feed_);
s->addFrameSet(id); s->addFrameSet(id);
return s; return s;
......
...@@ -70,7 +70,7 @@ public: ...@@ -70,7 +70,7 @@ public:
* @param timeout Millisecond timeout, or 0 or -1. * @param timeout Millisecond timeout, or 0 or -1.
* @return True if a new unseen frame is available. * @return True if a new unseen frame is available.
*/ */
PY_API virtual bool waitNextFrame(int64_t timeout) = 0; PY_API virtual bool waitNextFrame(int64_t timeout, bool except=false) = 0;
/** /**
* @brief Check if a new frame is available. * @brief Check if a new frame is available.
......
...@@ -47,6 +47,7 @@ VOLTU_EXCEPTION(NotImplemented, Exception, "Functionality not implemented"); ...@@ -47,6 +47,7 @@ VOLTU_EXCEPTION(NotImplemented, Exception, "Functionality not implemented");
VOLTU_EXCEPTION(ReadOnly, Exception, "Read only, write not allowed"); VOLTU_EXCEPTION(ReadOnly, Exception, "Read only, write not allowed");
VOLTU_EXCEPTION(WriteOnly, Exception, "Write only, read not allowed"); VOLTU_EXCEPTION(WriteOnly, Exception, "Write only, read not allowed");
VOLTU_EXCEPTION(IncompatibleOperation, Exception, "The input data and operator are incompatible"); VOLTU_EXCEPTION(IncompatibleOperation, Exception, "The input data and operator are incompatible");
VOLTU_EXCEPTION(Timeout, Exception, "Request timed out");
} }
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
// Bump these for each release // Bump these for each release
#define VOLTU_VERSION_MAJOR 0 // For API incompatible changes #define VOLTU_VERSION_MAJOR 0 // For API incompatible changes
#define VOLTU_VERSION_MINOR 2 // For binary compatibility and extensions #define VOLTU_VERSION_MINOR 3 // For binary compatibility and extensions
#define VOLTU_VERSION_PATCH 0 // Binary compatible internal fixes #define VOLTU_VERSION_PATCH 0 // Binary compatible internal fixes
#define VOLTU_VERSION ((VOLTU_VERSION_MAJOR*10000) + (VOLTU_VERSION_MINOR*100) + VOLTU_VERSION_PATCH) #define VOLTU_VERSION ((VOLTU_VERSION_MAJOR*10000) + (VOLTU_VERSION_MINOR*100) + VOLTU_VERSION_PATCH)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment