@@ -44,7 +44,7 @@ DeviceGate::DeviceGate(const DeviceInfo& deviceInfo) : deviceInfo(deviceInfo) {
4444 if (deviceInfo.platform != X_LINK_RVC3 && deviceInfo.platform != X_LINK_RVC4) {
4545 throw std::invalid_argument (" Gate only supports RVC3 and RVC4 platforms" );
4646 }
47- this ->platform = deviceInfo.platform ;
47+ this ->platform =deviceInfo.platform ;
4848 if (deviceInfo.platform == X_LINK_RVC3) {
4949 version = DEPTHAI_DEVICE_RVC3_VERSION;
5050 } else if (deviceInfo.platform == X_LINK_RVC4) {
@@ -56,12 +56,27 @@ DeviceGate::DeviceGate(const DeviceInfo& deviceInfo) : deviceInfo(deviceInfo) {
5656 pimpl->cli = std::make_unique<httplib::Client>(deviceInfo.name , DEFAULT_PORT);
5757 pimpl->cli ->set_read_timeout (60 ); // 60 seconds timeout to allow for compressing the crash dumps without async
5858 // pimpl->cli->set_connection_timeout(2);
59+
60+ gateConnection = std::make_shared<XLinkConnection>(deviceInfo, X_LINK_GATE);
61+ gateStream = std::make_shared<XLinkStream>(gateConnection, " XLink Gate Stream" , 32 * 1024 * 1024 );
62+
5963}
6064
6165bool DeviceGate::isOkay () {
6266 if (auto res = pimpl->cli ->Get (" /api/v1/status" )) {
6367 return nlohmann::json::parse (res->body )[" status" ].get <bool >();
6468 }
69+
70+ struct request_t {
71+ uint16_t RequestNum;
72+ }__attribute__ ((packed));
73+ request_t request;
74+ request.RequestNum = 1 ;
75+
76+ span<const uint8_t > data;
77+ memcpy ((char *)data.data (), &request, sizeof (request));
78+ gateStream->writeGate (data);
79+
6580 return false ;
6681}
6782
0 commit comments