@@ -103,31 +103,51 @@ void* ClariusStreamer::getFunc(std::string name) {
103103void ClariusStreamer::execute () {
104104 if (!mStreamIsStarted ) {
105105 reportInfo () << " Trying to set up Clarius streaming..." << reportEnd ();
106+ int argc = 0 ;
106107 std::string keydir = Config::getKernelBinaryPath ();
107108 // TODO A hack here to get this to work. Fix later
108109 // Lambdas converted to C style pointers can't have captures
109110 static ClariusStreamer::pointer self = std::dynamic_pointer_cast<ClariusStreamer>(mPtr .lock ());
110111
111- CusInitParams params;
112- params.args .argc = 0 ;
113- params.storeDir = keydir.c_str ();
114- params.newProcessedImageFn = [](const void * img, const CusProcessedImageInfo* nfo, int npos, const CusPosInfo* pos) {
115- self->newImageFn (img, nfo, npos, pos);
116- };
117- params.width = 512 ;
118- params.height = 512 ;
119- params.errorFn = [](const char * msg) {
120- self->getReporter ().error () << msg << self->getReporter ().end ();
121- };
122-
123- auto init = (int (*)(const CusInitParams* params))getFunc (" cusCastInit" );
124- int success = init (¶ms);
112+ auto init = (int (*)(int argc,
113+ char ** argv,
114+ const char * dir,
115+ CusNewProcessedImageFn newProcessedImage,
116+ CusNewRawImageFn newRawImage,
117+ CusNewSpectralImageFn newSpectralImage,
118+ CusNewImuDataFn newImuData,
119+ CusFreezeFn freeze,
120+ CusButtonFn btn,
121+ CusProgressFn progress,
122+ CusErrorFn err,
123+ int width,
124+ int height
125+ ))getFunc (" cusCastInit" );
126+ int success = init (argc, nullptr , keydir.c_str (),
127+ // new image callback
128+ [](const void * img, const CusProcessedImageInfo* nfo, int npos, const CusPosInfo* pos)
129+ {
130+ self->newImageFn (img, nfo, npos, pos);
131+ },
132+ nullptr /* pre-scanconverted image*/ ,
133+ nullptr /* spectral image*/ ,
134+ nullptr /* imu*/ ,
135+ nullptr /* freeze*/ ,
136+ nullptr /* button*/ ,
137+ nullptr /* progress*/ ,
138+ /* error call back*/
139+ [](const char * msg) {
140+ self->getReporter ().error () << msg << self->getReporter ().end ();
141+ },
142+ 512 ,
143+ 512
144+ );
125145 if (success != 0 )
126146 throw Exception (" Unable to initialize clarius cast" );
127147 reportInfo () << " Clarius streamer initialized" << reportEnd ();
128148
129149 auto connect = (int (*)(const char * ipAddress, unsigned int port, const char * cert, CusConnectFn fn))getFunc (" cusCastConnect" );
130- success = connect (mIPAddress .c_str (), mPort , " research" , [](int port, int imuPort, int swMatch) {
150+ success = connect (mIPAddress .c_str (), mPort , " research" , [](int port, int swMatch) {
131151 if (port > 0 ) {
132152 self->getReporter ().info () << " Clarius connect on UDP port " << port << self->getReporter ().end ();
133153 if (swMatch == CUS_FAILURE) {
0 commit comments