message: bindings/matlab/adaptor.cpp: add intermediary file to parse ip from matlab script to imaqtool
diff: #include "source_adaptor.h"
  #include <mwadaptorimaq.h>
  +#include <fstream>
  +
  // *******************************************************************
  // EXPORTED FUNCTIONS
  // *******************************************************************
  @@ -61,6 +63,12 @@ void initializeAdaptor() { m_system = new aditof::System(); }
  void uninitializeAdaptor() { delete m_system; }
  +/**
  +* readIpFromFile(): Function to parse the ip generated by aditofimaq.m
  +*/
  +
  +std::string readIpFromFile();
  +
  /**
  * getAvailHW: Exported function to enumerate all the hardware to which
  * the adaptor interfaces. The imaqkit::IEngine calls this function when the
  @@ -131,6 +139,20 @@ void getAvailHW(imaqkit::IHardwareInfo *hardwareContainer) {
  deviceInfo->setDeviceFileSupport(true);
  + imaqkit::IDeviceFormat *deviceFormat = deviceInfo->createDeviceFormat(
  + aditof::BGR_FORMAT_ID, aditof::BGR_FORMAT_STR);
  +
  + DeviceFormat *bgrFormatInfo = new DeviceFormat();
  +
  + bgrFormatInfo->setFormatWidth(aditof::BGR_FORMAT_WIDTH);
  + bgrFormatInfo->setFormatHeight(aditof::BGR_FORMAT_HEIGHT);
  + bgrFormatInfo->setFormatNumBands(aditof::BGR_FORMAT_BANDS);
  + bgrFormatInfo->setFormatFrameType(imaqkit::frametypes::BGR24_PACKED);
  +
  + deviceFormat->setAdaptorData(bgrFormatInfo);
  +
  + deviceInfo->addDeviceFormat(deviceFormat, true);
  +
  hardwareContainer->addDevice(deviceInfo);
  }
  @@ -289,11 +311,15 @@ imaqkit::IAdaptor *createInstance(imaqkit::IEngine *engine,
  camera = cameraList.at(deviceInfo->getDeviceID() - 1);
  } else if (deviceInfo->getDeviceID() - 1 == nrCameras) {
  std::vector<std::shared_ptr<aditof::Camera>> cameraListAtIp;
  - m_system->getCameraListAtIp(cameraListAtIp, formatName);
  +
  + std::string ipAddr = readIpFromFile();
  + if (ipAddr != "") {
  + m_system->getCameraListAtIp(cameraListAtIp, ipAddr);
  if (cameraListAtIp.size() > 0) {
  camera = cameraListAtIp.at(0);
  }
  }
  + }
  imaqkit::IAdaptor *adaptor =
  new SourceAdaptor(engine, deviceInfo, formatName, camera);
  @@ -306,3 +332,14 @@ imaqkit::IAdaptor *createInstance(imaqkit::IEngine *engine,
  return adaptor;
  }
  +
  +std::string readIpFromFile() {
  + std::string ipAddr = "";
  + std::ifstream ipFile("ipAddr.txt");
  +
  + if (ipFile.is_open()) {
  + std::getline(ipFile, ipAddr);
  + ipFile.close();
  + }
  + return ipAddr;
  +}
  