您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ APDU类代码示例

51自学网 2021-06-03 12:03:48
  C++
这篇教程C++ APDU类代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中APDU的典型用法代码示例。如果您正苦于以下问题:C++ APDU类的具体用法?C++ APDU怎么用?C++ APDU使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

在下文中一共展示了APDU类的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ConfigureRequest

void ConfigureUnsol::ConfigureRequest(APDU& arAPDU){	arAPDU.Set(mIsEnable ? FC_ENABLE_UNSOLICITED : FC_DISABLE_UNSOLICITED);	if(mClassMask & PC_CLASS_1) arAPDU.DoPlaceholderWrite(Group60Var2::Inst());	if(mClassMask & PC_CLASS_2) arAPDU.DoPlaceholderWrite(Group60Var3::Inst());	if(mClassMask & PC_CLASS_3) arAPDU.DoPlaceholderWrite(Group60Var4::Inst());}
开发者ID:diverger,项目名称:dnp3,代码行数:7,


示例2: if

OneByteFrame::OneByteFrame(const APDU& apdu){	m_frame_len = 1;	m_frame_mem = new UCHAR[1];		if ( apdu.IsAck() )	{		m_frame_mem[0] = 0xCC;		m_type = ACK_FRAME;	}	else if ( apdu.IsNack() )	{		m_frame_mem[0] = 0x0C;		m_type = NACK_FRAME;	}	else if ( apdu.IsBusy() )	{		m_frame_mem[0] = 0xC0;		m_type = BUSY_FRAME;	}	else if ( apdu.IsNackbusy() )	{		m_frame_mem[0] = 0x00;		m_type = NACKBUSY_FRAME;	}	else	{		// ...		abort();	}}
开发者ID:lubing521,项目名称:edifice,代码行数:31,


示例3: OnFinalResponse

void Master::OnFinalResponse(const APDU& arAPDU){	this->UpdateState(MS_COMMS_UP);	mLastIIN = arAPDU.GetIIN();	this->ProcessIIN(arAPDU.GetIIN());	mpState->OnFinalResponse(this, arAPDU);	}
开发者ID:diverger,项目名称:dnp3,代码行数:7,


示例4: pth_event

Array < eibaddr_t >  Layer7_Broadcast::A_IndividualAddress_Read (unsigned timeout){  Array < eibaddr_t > addrs;  A_IndividualAddress_Read_PDU r;  APDU *a;  l4->Send (r.ToPacket ());  pth_event_t t = pth_event (PTH_EVENT_RTIME, pth_time (timeout, 0));  while (pth_event_status (t) != PTH_STATUS_OCCURRED)    {      BroadcastComm *c = l4->Get (t);      if (c)	{	  a = APDU::fromPacket (c->data);	  if (a->isResponse (&r))	    {	      addrs.resize (addrs () + 1);	      addrs[addrs () - 1] = c->src;	    }	  delete a;	  delete c;	}    }  pth_event_free (t, PTH_FREE_THIS);  return addrs;}
开发者ID:AdrienCourtois,项目名称:Domoleaf,代码行数:26,


示例5: SendUp

void AppLayerTest::SendUp(FunctionCodes aCode, bool aFIR, bool aFIN, bool aCON, bool aUNS, int aSEQ){	APDU f;	f.SetFunction(aCode);	f.SetControl(aFIR, aFIN, aCON, aUNS, aSEQ);	lower.SendUp(f.GetBuffer(), f.Size());}
开发者ID:cmavr8,项目名称:dnp3,代码行数:7,


示例6: Response

int Frame::Response(Frame*& resp)const  // 旧代码.以后要废弃!!!!{	int retcode = 0;	APDU *apdu = NULL, *apdu2 = NULL;	std::vector<APDU*> apdus;	apdu = APDU::BuildAPDUFromFrame(*this);	if ( NULL == apdu )	{		retcode = -11;		goto _out;	}	retcode = apdu->Response(apdu2, apdus);	if ( 0 != retcode || NULL == apdu2 )	{		retcode = -12;		goto _out;	}	resp = Frame::BuildFrameFromAPDU(*apdu2);_out:	delete apdu2;	delete apdu;	for ( int i = 0; i < apdus.size(); i++ )	{		delete apdus[i];	}	return retcode;}
开发者ID:lubing521,项目名称:edifice,代码行数:32,


示例7: LOG_BLOCK

void MockAppLayer::SendUnsolicited(APDU& arAPDU){	LOG_BLOCK(LEV_COMM, "=> " << toHex(arAPDU.GetBuffer(), arAPDU.Size(), true));	LOG_BLOCK(LEV_INTERPRET, "=> " << arAPDU.ToString());	mFragments.push_back(arAPDU);	this->DoSendUnsol();}
开发者ID:diverger,项目名称:dnp3,代码行数:7,


示例8: pth_event

APDU *Layer7_Individual::Request_Response (APDU * r){  APDU *a;  CArray *c;  l4->Send (r->ToPacket ());  pth_event_t t = pth_event (PTH_EVENT_RTIME, pth_time (6, 100));  while (pth_event_status (t) != PTH_STATUS_OCCURRED)    {      c = l4->Get (t);      if (c)	{	  if (c->len () == 0)	    {	      delete c;	      pth_event_free (t, PTH_FREE_THIS);	      return 0;	    }	  a = APDU::fromPacket (*c, this->t);	  delete c;	  if (a->isResponse (r))	    {	      pth_event_free (t, PTH_FREE_THIS);	      return a;	    }	  delete a;	  pth_event_free (t, PTH_FREE_THIS);	  return 0;	}    }  pth_event_free (t, PTH_FREE_THIS);  return 0;}
开发者ID:1stsetup,项目名称:knxd,代码行数:33,


示例9: SendUnsolicited

void Slave::SendUnsolicited(APDU& arAPDU){	mRspIIN.BitwiseOR(mIIN);	arAPDU.SetIIN(mRspIIN);	mpAppLayer->SendUnsolicited(arAPDU);	mUnsolExpectCON = (arAPDU.GetControl()).CON;}
开发者ID:sentient-energy,项目名称:emsw-opendnp3-mirror,代码行数:7,


示例10: LOG_BLOCK

void VtoTransmitTask::ConfigureRequest(APDU& arAPDU){	/*	 *  Masters never request confirmed data. The response from the	 *  slave is all that's required for reliable delivery.	 */	arAPDU.Set(mUseNonStandardCode ? FC_PROPRIETARY_VTO_TRANSFER : FC_WRITE);	const size_t MAX_VTO_EVENTS = 7;	/* Get all of the data objects in the buffer. */	size_t numObjects = this->mBuffer.Select(PC_ALL_EVENTS, MAX_VTO_EVENTS);	LOG_BLOCK(LEV_INTERPRET, "VtoTransmitTask Sending: " << numObjects << " of " << this->mBuffer.Size());	/* If there are no objects to write, skip the remainder. */	if (numObjects == 0) {		return;	}	/*	 * Loop through the selected data and add corresponding objects to	 * the arAPDU instance.	 */	VtoDataEventIter vto = this->mBuffer.Begin();	for (size_t i = 0; i < numObjects; ++i) {		/* Insert a new object into the APDU message. */		IndexedWriteIterator itr = arAPDU.WriteIndexed(		                               Group112Var0::Inst(),		                               vto->mValue.GetSize(),		                               vto->mIndex		                           );		/*		 * Check to see if the APDU fragment has enough room for the		 * data segment.  If the fragment is full, return out of this		 * function and let the fragment send.		 */		if (itr.IsEnd()) {			return;		}		/* Set the object index */		itr.SetIndex(vto->mIndex);		/* Write the data to the APDU message */		Group112Var0::Inst()->Write(		    *itr,		    vto->mValue.GetSize(),		    vto->mValue.mpData		);		/* Mark the data segment as being written */		vto->mWritten = true;		/* Move to the next data segment in the buffer */		++vto;	}}
开发者ID:SandC,项目名称:dnp3,代码行数:59,


示例11: Read

APDU MockAppLayer::Read(){	if(mFragments.size() == 0) throw InvalidStateException(LOCATION, "no more fragments");	APDU frag = mFragments.front();	frag.Interpret();	mFragments.pop_front();	return frag;}
开发者ID:diverger,项目名称:dnp3,代码行数:8,


示例12: ArgumentException

void AppLayer::SendResponse(APDU& arAPDU){	this->Validate(arAPDU.GetControl(), false, false, true, false);			if(arAPDU.GetFunction() != FC_RESPONSE)		throw ArgumentException(LOCATION, "Non-response function code");		mSolicited.Send(arAPDU, this->GetRetries(FC_RESPONSE));	}
开发者ID:diverger,项目名称:dnp3,代码行数:9,


示例13: Send

void ACS_Idle::Send(AppLayerChannel* c, APDU& arAPDU, size_t aNumRetry){	AppControlField acf = arAPDU.GetControl();	FunctionCodes func = arAPDU.GetFunction();	acf.SEQ = (acf.FIR && func == FC_RESPONSE) ? c->Sequence() : c->IncrSequence();	arAPDU.SetControl(acf);	c->ChangeState(NextState(c, arAPDU.GetFunction(), acf.CON));	c->SetRetry(aNumRetry);	c->QueueSend(arAPDU);}
开发者ID:AlanMarshall,项目名称:dnp3,代码行数:10,


示例14: main

int main() {	SCard card;		try {		card.setContext(SCARD_SCOPE_SYSTEM);		card.connect();		cout << card.getReader() << endl;				char input[256];		for (;;) {					cout << "apdu> ";					cin.getline(input, sizeof(input));			String in(input);			in = in.trim().toLower();			if (in == "quit") {								cout << "Bye" << endl;				break;			}			APDU cmd(in,APDU::Separator::SPACE);						APDU resp;			try {				card.transmit(cmd,resp);				cout << resp.toString() << endl;								} catch (SCardException& e) {				cerr << e.what() << endl;			}					}			} catch (SCardException& e) {		cerr << e.what() << endl;	}			return 0;}
开发者ID:atmarangga,项目名称:scard,代码行数:55,


示例15: InvalidStateException

void ClassPoll::ConfigureRequest(APDU& arAPDU){	if (mClassMask == PC_INVALID) {		throw InvalidStateException(LOCATION, "Class mask has not been set");	}	arAPDU.Set(FC_READ);	if (mClassMask & PC_CLASS_0) arAPDU.DoPlaceholderWrite(Group60Var1::Inst());	if (mClassMask & PC_CLASS_1) arAPDU.DoPlaceholderWrite(Group60Var2::Inst());	if (mClassMask & PC_CLASS_2) arAPDU.DoPlaceholderWrite(Group60Var3::Inst());	if (mClassMask & PC_CLASS_3) arAPDU.DoPlaceholderWrite(Group60Var4::Inst());}
开发者ID:sentient-energy,项目名称:emsw-opendnp3-mirror,代码行数:12,


示例16: GetAPDUType

APDUType Frame::GetAPDUType(){	APDU* apdu = APDU::BuildAPDUFromFrame(*this);	if ( NULL != apdu )	{		APDUType apdu_type = apdu->GetAPDUType();		delete apdu;		return apdu_type;	}	else	{		return AT_UNAVAILABLE;	}}
开发者ID:lubing521,项目名称:edifice,代码行数:14,


示例17: hs

void ResponseLoaderTestObject::Load(const std::string& arAPDU){	fdo.Clear();	HexSequence hs(arAPDU);	APDU f;	f.Write(hs, hs.Size());	f.Interpret();	ResponseLoader rl(mpLogger, &fdo);	for(HeaderReadIterator hdr = f.BeginRead(); !hdr.IsEnd(); ++hdr)	{		rl.Process(hdr);	}}
开发者ID:diverger,项目名称:dnp3,代码行数:14,


示例18: ProcessResponse

void ACS_Base::ProcessResponse(AppLayerChannel* c, APDU& arAPDU, bool aExpectFIR){	AppControlField acf = arAPDU.GetControl();	if(acf.SEQ == c->Sequence()) {		if(acf.FIR == aExpectFIR) {			c->CancelTimer();			if(acf.FIN) {				c->ChangeState(ACS_Idle::Inst());				c->DoFinalResponse(arAPDU);			}			else {				c->IncrSequence();				c->ChangeState(ACS_WaitForFinalResponse::Inst());				c->StartTimer();				c->DoPartialResponse(arAPDU);			}		}		else {			ERROR_LOGGER_BLOCK(c->GetLogger(), LEV_WARNING, "Unexpected fir bit " << acf.FIR, ALERR_BAD_FIR_FIN);		}	}	else {		ERROR_LOGGER_BLOCK(c->GetLogger(), LEV_WARNING, "Bad sequence number " << acf.SEQ, ALERR_BAD_SEQUENCE);	}}
开发者ID:AlanMarshall,项目名称:dnp3,代码行数:27,


示例19: Send

void Slave::Send(APDU& arAPDU, const IINField& arIIN){	mRspIIN.BitwiseOR(mIIN);	mRspIIN.BitwiseOR(arIIN);	arAPDU.SetIIN(mRspIIN);	mpAppLayer->SendResponse(arAPDU);}
开发者ID:sentient-energy,项目名称:emsw-opendnp3-mirror,代码行数:7,


示例20: HandleEnableUnsolicited

void Slave::HandleEnableUnsolicited(const APDU& arRequest, bool aIsEnable){	mResponse.Set(FC_RESPONSE);	if (mConfig.mDisableUnsol) {		mRspIIN.SetFuncNotSupported(true);	}	else {		if (aIsEnable) {			this->mDeferredUnsol = true;		}		for (HeaderReadIterator hdr = arRequest.BeginRead(); !hdr.IsEnd(); ++hdr) {			switch (MACRO_DNP_RADIX(hdr->GetGroup(), hdr->GetVariation())) {			case (MACRO_DNP_RADIX(60, 2)):				mConfig.mUnsolMask.class1 = aIsEnable;				break;			case (MACRO_DNP_RADIX(60, 3)):				mConfig.mUnsolMask.class2 = aIsEnable;				break;			case (MACRO_DNP_RADIX(60, 4)):				mConfig.mUnsolMask.class3 = aIsEnable;				break;			default:				mRspIIN.SetFuncNotSupported(true);				LOG_BLOCK(LEV_WARNING, "Cannot enable/disable unsol for " << hdr->GetBaseObject()->Name());				break;			}		}	}}
开发者ID:sentient-energy,项目名称:emsw-opendnp3-mirror,代码行数:35,


示例21: ReadData

void DataPoll::ReadData(const APDU& f){	ResponseLoader loader(mpLogger, mpObs, mpVtoReader);	HeaderReadIterator hdr = f.BeginRead();	for ( ; !hdr.IsEnd(); ++hdr) {		loader.Process(hdr);	}}
开发者ID:sentient-energy,项目名称:emsw-opendnp3-mirror,代码行数:8,


示例22: _OnFinalResponse

TaskResult SimpleRspBase::_OnFinalResponse(const APDU& arAPDU){	if(arAPDU.BeginRead().Count() > 0) {		LOG_BLOCK(LEV_WARNING, "Unexpected object headers in response: " << this->Name());	}	return TR_SUCCESS;}
开发者ID:prakashnsm,项目名称:dnp3-1,代码行数:8,


示例23: SwitchOnFunction

void AS_Base::SwitchOnFunction(Slave* c, AS_Base* apNext, const APDU& arRequest, SequenceInfo aSeqInfo){	switch (arRequest.GetFunction()) {	case (FC_READ): {			ChangeState(c, apNext);			c->mRspContext.Reset();			IINField iin = c->mRspContext.Configure(arRequest);			c->mRspContext.LoadResponse(c->mResponse);			c->Send(c->mResponse, iin);			break;		}	case (FC_WRITE):		ChangeState(c, apNext);		if(aSeqInfo != SI_PREV) c->HandleWrite(arRequest);		c->ConfigureAndSendSimpleResponse();		break;	case (FC_PROPRIETARY_VTO_TRANSFER):		ChangeState(c, apNext);		if(aSeqInfo != SI_PREV) c->HandleVtoTransfer(arRequest);		c->ConfigureAndSendSimpleResponse();		break;	case (FC_SELECT):		ChangeState(c, apNext);		c->HandleSelect(arRequest, aSeqInfo);		c->Send(c->mResponse);		break;	case (FC_OPERATE):		ChangeState(c, apNext);		c->HandleOperate(arRequest, aSeqInfo);		c->Send(c->mResponse);		break;	case (FC_DIRECT_OPERATE):		ChangeState(c, apNext);		c->HandleDirectOperate(arRequest, aSeqInfo);		c->Send(c->mResponse);		break;	case (FC_DIRECT_OPERATE_NO_ACK):		c->HandleDirectOperate(arRequest, aSeqInfo);		break;	case (FC_ENABLE_UNSOLICITED):		ChangeState(c, apNext);		c->HandleEnableUnsolicited(arRequest, true);		c->Send(c->mResponse);		break;	case (FC_DISABLE_UNSOLICITED):		ChangeState(c, apNext);		c->HandleEnableUnsolicited(arRequest, false);		c->Send(c->mResponse);		break;	case (FC_DELAY_MEASURE):		ChangeState(c, apNext);		c->ConfigureDelayMeasurement(arRequest);		c->Send(c->mResponse);		break;	default: 		MACRO_THROW_EXCEPTION_COMPLEX_WITH_CODE(NotSupportedException, "Function not supported: " << arRequest.GetFunction() , SERR_FUNC_NOT_SUPPORTED);	}}
开发者ID:prakashnsm,项目名称:dnp3-1,代码行数:58,


示例24: GetBalance

void GetBalance(Smartcard& pSmartcard){ pSmartcard.Connect(10000);  BYTE       aid[]     = {(BYTE)0xA0,(BYTE)0x00,(BYTE)0x00,(BYTE)0x00,(BYTE)0x99,(BYTE)0x01};  APDU       selectAID = APDU(0x00,0xA4,0x04,0x00);    selectAID.AddData( ByteBuffer(aid,sizeof(aid)) );  pSmartcard.Transmit(selectAID);    LOGGER_INFO<<_T("GetBalance select AID")<<endl<<selectAID;    APDU       send = APDU(0xB0,0x50,0x00,0x00);  send.SetLe(2);    pSmartcard.Transmit(send);  LOGGER_INFO<<_T("GetBalance")<<endl<<send;}
开发者ID:BackupTheBerlios,项目名称:bvr20983-svn,代码行数:19,



注:本文中的APDU类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ APICCommonClass类代码示例
C++ AP4_Sample类代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。