Exemple #1
0
bool MmapFile::PeekI24(int32_t *pValue, bool networkOrder) {
	*pValue = 0;
	if (!PeekBuffer((uint8_t *) pValue, 3))
		return false;
	if (networkOrder)
		*pValue = ENTOHL(*pValue) >> 8; //----MARKED-LONG---
	else
Exemple #2
0
bool MmapFile::PeekI16(int16_t *pValue, bool networkOrder) {
	if (!PeekBuffer((uint8_t *) pValue, 2))
		return false;
	if (networkOrder)
		*pValue = ENTOHS(*pValue); //----MARKED-SHORT----
	return true;
}
// This is a example OnRun() and can be used in common-simple case.
// If the pin shall response to other commands besides CMD_STOP,
// it should override OnCmd().
void CPacketActiveInputPin::OnRun()
{
  CmdAck(ME_OK);

  CQueue::WaitResult result;
  CPacket *pPacket;
  CMD cmd;

  while (true) {
    CQueue::QType type = mpWorkQ->WaitDataMsg(&cmd, sizeof(cmd), &result);

    if (type == CQueue::Q_MSG) {
      // running state, received a cmd
      if (cmd.code == AO::CMD_STOP) {
        CmdAck(ME_OK);
        INFO("%s pin received stop command!", GetName());
        break;
      }
    } else {
      // a buffer
      if (PeekBuffer(pPacket)) {
        AM_ERR err = ProcessBuffer(pPacket);
        if (err != ME_OK) {
          if (err != ME_CLOSED)
            PostEngineErrorMsg(err);
          break;
        }
      }
    }
  }
}
Exemple #4
0
bool MmapFile::PeekI8(int8_t *pValue) {
	return PeekBuffer((uint8_t *) pValue, 1);
}
Exemple #5
0
bool MmapFile::ReadBuffer(uint8_t *pBuffer, uint64_t count) {
	if (!PeekBuffer(pBuffer, count))
		return false;
	return SeekAhead(count);
}