Beispiel #1
0
int ONVIF::Stop::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 4)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 4;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 4)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 4;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = profileToken(); break;
        case 1: *reinterpret_cast< bool*>(_v) = panTilt(); break;
        case 2: *reinterpret_cast< bool*>(_v) = zoom(); break;
        case 3: *reinterpret_cast< bool*>(_v) = result(); break;
        default: break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setProfileToken(*reinterpret_cast< QString*>(_v)); break;
        case 1: setPanTilt(*reinterpret_cast< bool*>(_v)); break;
        case 2: setZoom(*reinterpret_cast< bool*>(_v)); break;
        case 3: setResult(*reinterpret_cast< bool*>(_v)); break;
        default: break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 4;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 4)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 4;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
AREXPORT bool ArAMPTU::init(void)
{
  if (!myPacket.setUnitNumber(myUnitNumber))
  {
    ArLog::log(ArLog::Terse, "ArAMPTU::init: the unit number is invalid.");
    return false;
  }
  myPacket.empty();
  myPacket.byteToBuf(ArAMPTUCommands::INIT);
  if (!sendPacket(&myPacket))
    return false;
  
  myPacket.empty();
  myPacket.byteToBuf(ArAMPTUCommands::RESP);
  myPacket.byteToBuf(0);
  if (!sendPacket(&myPacket))
    return false;
  
  if (!panTilt(0, 0))
    return false;

  return true;
}
AREXPORT bool ArDPPTU::init(void)
{
  preparePacket();
  myPacket.byteToBuf(ArDPPTUCommands::INIT);
  if (!sendPacket(&myPacket))
  {
    ArLog::log(ArLog::Terse, "ArDPPTU: Error sending INIT to PTU! (Write error?)");
    return false;
  }

  myPan = -1;  //myPan and myTilt set to -1 for initial positioning
  myTilt = -1;

  setMovePower(PAN, LOW);
  setMovePower(TILT, LOW);
  setHoldPower(PAN, OFF);
  setHoldPower(PAN, OFF);


  switch(myDeviceType) {
    case PANTILT_PTUD47:
      //Assuming default accel and slew rates
      myPanSlew = 40;
      myBasePanSlew = 40;
      myTiltSlew = 40;
      myBaseTiltSlew = 40;
      myPanAccel = 80;
      myTiltAccel = 80;
      break;
    case PANTILT_PTUD46:
    case PANTILT_DEFAULT:
    default:
      //Assuming default accel and slew rates
      myPanSlew = 40; // 1000 positions/sec
      myBasePanSlew = 40; // 1000 positions/sec
      myTiltSlew = 40; // 1000 positions/sec
      myBaseTiltSlew = 40; // 1000 positions/sec
      myPanAccel = 80; // 2000 positions/sec^2
      myTiltAccel = 80; // 2000 positions/sec^2
      break;
  }

  if(myDeviceType == PANTILT_DEFAULT)
  {
    // query resolution, conversion factors will be 
    // set again based on responses (replacing default value set 
    // in constructor)
    preparePacket();
    myPacket.byteToBuf('P');
    myPacket.byteToBuf('R');
    if(!sendPacket(&myPacket))
      ArLog::log(ArLog::Terse, "ArDPPTU: Warning: write error sending pan resolution query");
    // We can't distinguish PR and TR responses based on their content alone, so
    // we have to query pan resolution (PR), then after receiving resolution
    // response, query TR. (see readPacket() for TR).
	///@todo query the device for pan and tilt limits, and when response is received, call ArPTZ::setLimits() to change.
  }

  query();   // do first position query

  if (!panTilt(0,0))
    return false;

  myInit = true;

  return true;
}