Beispiel #1
0
std::shared_ptr<PlanOperation> PosUpdateScan::parse(const Json::Value& data) {
  auto result = std::make_shared<PosUpdateScan>();

  if (data.isMember("data")) {
    result->setRawData(data["data"]);
  }
  return result;
}
IccColorProfile::IccColorProfile(const QByteArray& rawData)
    : KoColorProfile(""), d(new Private)
{
    d->shared = QSharedPointer<Private::Shared>( new Private::Shared() );
    d->shared->data.reset( new Data() );

    setRawData(rawData);
    init();
}
bool IccColorProfile::load()
{
    QFile file(fileName());
    file.open(QIODevice::ReadOnly);
    QByteArray rawData = file.readAll();
    setRawData(rawData);
    file.close();
    if (init()) {
        return true;
    }
    qWarning() << "Failed to load profile from " << fileName();
    return false;
}
Beispiel #4
0
///////////////////////////////////////////////////////////////////////////////
//
// Arguments
//
///////////////////////////////////////////////////////////////////////////////
void Arguments::init()
{
   if (initialized_)
      return;

   if (argStr_.size() != 0)
   {
      setRawData();
   }
   else if (argData_.size() != 0)
   {
      serialize();
   }
   else
   {
      throw runtime_error("empty Arguments object");
   }

   initialized_ = true;
}
/**
 *  Process the next data byte.
 *
 *  This method processes the next byte that was received on the serial
 *  port.
 *
 *  \param byte   The byte to be processed.
 */
void T_TX_InterfaceSerPIC::processDataByte (unsigned char ucByte)
{
  static int chancount;

  switch (iSyncState)
  {
    default:
    case WAIT_SYNC:
      // detect some sync bytes to make sure the interface
      // sends a valid stream of bytes, not any startup trash
      if (ucByte >= ucSyncByte)
      {
        iSyncCounter++;
      }
      if (iSyncCounter > 4)
      {
        iSyncState = COUNT_CHANNELS;
        iSPIC_NumChannels = 0;
        chancount = 0;
        #if DEBUG_TX_INTERFACE > 0
        printf("T_TX_InterfaceSerPIC: detected sync bytes: 0x%02X\n", ucByte);
        printf("T_TX_InterfaceSerPIC state machine set to COUNT_CHANNELS\n");
        #endif
      }
      break;
      

    case COUNT_CHANNELS:
      iSyncCounter = 0;
      if (ucByte < ucSyncByte)
      {
        chancount++;
      }
      else
      {
        // received next sync byte, end of sync
        iSyncState = IN_SYNC;
        int tmp = (chancount - iSPIC_ButtonChannel);
        #if DEBUG_TX_INTERFACE > 0
        printf("T_TX_InterfaceSerPIC: detected %d channels\n", tmp);
        printf("T_TX_InterfaceSerPIC state machine set to IN_SYNC\n");
        #endif
        if (tmp > TX_MAXAXIS)
        {
          fprintf(stdout, 
                  "T_TX_InterfaceSerPIC: This version of T_TX_InterfaceSerPIC only \n            supports %d channels, will only use 0-7!\n",
                  TX_MAXAXIS);
          tmp = TX_MAXAXIS;
          //~ iSyncState = TRANSMITTER_ERROR;
        }
        iSPIC_NumChannels = tmp;
      }
      break;
      
    case IN_SYNC:
      if (ucByte >= ucSyncByte)
      {
        /* received SYNC byte */
        iSPIC_ChanCount = 0;
      }
      else
      {
        int current_channel = (iSPIC_ChanCount - iSPIC_ButtonChannel);
        if ((current_channel >= 0) && (current_channel < TX_MAXAXIS))
        {
          setRawData(current_channel, (float)((float)ucByte/175.0 - 0.5));
        }
        iSPIC_ChanCount++;
      }
      break;

    case TRANSMITTER_ERROR:
      break;
  }
}
Beispiel #6
0
RawPacket::RawPacket(const uint8_t* pRawData, int rawDataLen, timeval timestamp, bool deleteRawDataAtDestructor)
{
	Init();
	m_DeleteRawDataAtDestructor = deleteRawDataAtDestructor;
	setRawData(pRawData, rawDataLen, timestamp);
}
Beispiel #7
0
// Copy Constructor
ExifRawAppSeg::ExifRawAppSeg( const ExifRawAppSeg& theSrc )
  : ExifAppSegment(theSrc), mRawData(NULL)
{
    setRawData(theSrc.mRawData, theSrc.mLength) ;
}
 void RawFormat::unSerialize(boost::property_tree::ptree& node)
 {
     std::vector<unsigned char> rawbuf = BufferHelper::fromHexString(node.get_child("RawData").get_value<std::string>());
     setRawData(rawbuf);
 }
 void RawFormat::setLinearData(const void* data, size_t dataLengthBytes)
 {
     std::vector<unsigned char> sbdata = std::vector<unsigned char>(static_cast<const unsigned char*>(data), static_cast<const unsigned char*>(data)+dataLengthBytes);
     setRawData(sbdata);
 }