1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #include "stdafx.h"
- #include "SpBase.h"
- #include <winpr/synch.h>
- #include "guitask.h"
- class rpcClientEntity : public CEntityBase, public ITimerListener, public ISysVarListener
- {
- public:
- rpcClientEntity()
- {}
- virtual ~rpcClientEntity() {}
- virtual const char *GetEntityName() const { return "rpcClient"; }
- virtual void OnTimeout(DWORD dwTimerID){
- LOG_FUNCTION();
- }
- virtual void OnSysVarEvent(const char *pszKey, const char *pszValue,const char *pszOldValue,const char *pszEntityName){
- LOG_TRACE("entity:%s key:%s value:%s", pszEntityName, pszKey, pszValue);
- }
- virtual void OnStarted(){
- LOG_FUNCTION();
- g_task.Kickoff(this);
- //open server
- g_task.openrpcServer(9000);
- //entity Init
- auto rc = g_task.SubscribeLog();
- }
- virtual void OnPreClose(EntityCloseCauseEnum eCloseCause,CSmartPointer<ITransactionContext> pTransactionContext)
- {
- LOG_FUNCTION();
- pTransactionContext->SendAnswer(Error_Succeed);
- }
- private:
- };
- SP_BEGIN_ENTITY_MAP()
- SP_ENTITY(rpcClientEntity)
- SP_END_ENTITY_MAP()
|