kerneltest/e32test/usbho/t_otgdi/inc/b2bwatchers.h
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
252:0a40b8675b23 253:d37db4dcc88d
   206  * OTG Messages, OTG Events, OTG States or a Watchdog timeout
   206  * OTG Messages, OTG Events, OTG States or a Watchdog timeout
   207  */
   207  */
   208 class CNotifyWatcherBase : public CActive
   208 class CNotifyWatcherBase : public CActive
   209 	{
   209 	{
   210 public:
   210 public:
   211 	virtual ~CNotifyWatcherBase() {LOG_FUNC  };
   211 	virtual ~CNotifyWatcherBase() {  };
   212 	
   212 	
   213 	virtual void StartWatching(TInt aInterval) {LOG_FUNC  TInt n(aInterval); IssueAgain(); SetActive(); };
   213 	virtual void StartWatching(TInt aInterval) {  TInt n(aInterval); IssueAgain(); SetActive(); };
   214 	// getter
   214 	// getter
   215 	TWatcherNotifyType GetType() {return(iWatchType);};		
   215 	TWatcherNotifyType GetType() {return(iWatchType);};		
   216 	
   216 	
   217 protected:
   217 protected:
   218 	CNotifyWatcherBase (MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aRoot) : 
   218 	CNotifyWatcherBase (MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aRoot) : 
   246 	public:
   246 	public:
   247 		static COtgWatchdogWatcher* NewL(MOtgNotificationHandler &wdHandler, 
   247 		static COtgWatchdogWatcher* NewL(MOtgNotificationHandler &wdHandler, 
   248 										const TWatcherNotifyType aWatchType, 
   248 										const TWatcherNotifyType aWatchType, 
   249 										COtgRoot &aOtgRoot);
   249 										COtgRoot &aOtgRoot);
   250 		void ConstructL();
   250 		void ConstructL();
   251 		virtual ~COtgWatchdogWatcher() {LOG_FUNC ;Cancel();};
   251 		virtual ~COtgWatchdogWatcher() {Cancel();};
   252 		
   252 		
   253 		void StartTimer(TInt aIntervalMs);
   253 		void StartTimer(TInt aIntervalMs);
   254 		void StartWatching(TInt aIntervalMs) {StartTimer(aIntervalMs); };
   254 		void StartWatching(TInt aIntervalMs) {StartTimer(aIntervalMs); };
   255 		
   255 		
   256  
   256  
   257 		
   257 		
   258 		TInt IssueAgain() { LOG_FUNC ASSERT(0); return(0);};
   258 		TInt IssueAgain() { ASSERT(0); return(0);};
   259 		void DoCancel() {LOG_FUNC ;iTimer.Cancel();};
   259 		void DoCancel() {iTimer.Cancel();};
   260 		void DisplayEvent() {LOG_FUNC ASSERT(0); }; // should never fire this
   260 		void DisplayEvent() {ASSERT(0); }; // should never fire this
   261 	TInt GetEventValue() {return(iIntervalMs);};
   261 	TInt GetEventValue() {return(iIntervalMs);};
   262 	void StepExpired(TInt aInterval);		
   262 	void StepExpired(TInt aInterval);		
   263 	
   263 	
   264 protected:
   264 protected:
   265 	COtgWatchdogWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) :
   265 	COtgWatchdogWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) :
   283 	{
   283 	{
   284 public:
   284 public:
   285 	static COtgStateWatcher* NewL(MOtgNotificationHandler &wdHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot);
   285 	static COtgStateWatcher* NewL(MOtgNotificationHandler &wdHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot);
   286 	void ConstructL() {};
   286 	void ConstructL() {};
   287 	
   287 	
   288 	virtual ~COtgStateWatcher() {LOG_FUNC Cancel(); };
   288 	virtual ~COtgStateWatcher() { Cancel(); };
   289 	
   289 	
   290 	TInt IssueAgain() { iOtgRoot.otgQueueOtgStateRequest(iState , iStatus); return(ETrue);};
   290 	TInt IssueAgain() { iOtgRoot.otgQueueOtgStateRequest(iState , iStatus); return(ETrue);};
   291 	void DisplayEvent(); 
   291 	void DisplayEvent(); 
   292 
   292 
   293 	TInt GetEventValue() {return(iState);};
   293 	TInt GetEventValue() {return(iState);};
   294 	
   294 	
   295 	void DoCancel() {LOG_FUNC iOtgRoot.otgCancelOtgStateRequest();};
   295 	void DoCancel() { iOtgRoot.otgCancelOtgStateRequest();};
   296 
   296 
   297 protected:
   297 protected:
   298 	COtgStateWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) :
   298 	COtgStateWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) :
   299 		CNotifyWatcherBase(aHandler, aWatchType, aOtgRoot)
   299 		CNotifyWatcherBase(aHandler, aWatchType, aOtgRoot)
   300 			{};
   300 			{};
   308 class COtgEventWatcher : public CNotifyWatcherBase
   308 class COtgEventWatcher : public CNotifyWatcherBase
   309 	{
   309 	{
   310 public:
   310 public:
   311 	static COtgEventWatcher* NewL(MOtgNotificationHandler &wdHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot);
   311 	static COtgEventWatcher* NewL(MOtgNotificationHandler &wdHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot);
   312 	void ConstructL() {};
   312 	void ConstructL() {};
   313 	virtual ~COtgEventWatcher() {LOG_FUNC Cancel(); };		
   313 	virtual ~COtgEventWatcher() { Cancel(); };		
   314 	
   314 	
   315 	TInt IssueAgain() { iOtgRoot.otgQueueOtgEventRequest(iEvent , iStatus); return(ETrue);};
   315 	TInt IssueAgain() { iOtgRoot.otgQueueOtgEventRequest(iEvent , iStatus); return(ETrue);};
   316 	void DisplayEvent(); 
   316 	void DisplayEvent(); 
   317 	TInt GetEventValue() {return(iEvent);};
   317 	TInt GetEventValue() {return(iEvent);};
   318 	void DoCancel() { LOG_FUNC iOtgRoot.otgCancelOtgEventRequest();};
   318 	void DoCancel() {  iOtgRoot.otgCancelOtgEventRequest();};
   319 
   319 
   320 protected:
   320 protected:
   321 	COtgEventWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) : 
   321 	COtgEventWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) : 
   322 		CNotifyWatcherBase(aHandler, aWatchType, aOtgRoot)
   322 		CNotifyWatcherBase(aHandler, aWatchType, aOtgRoot)
   323 			{};
   323 			{};
   331 class COtgMessageWatcher : public CNotifyWatcherBase
   331 class COtgMessageWatcher : public CNotifyWatcherBase
   332 	{
   332 	{
   333 public:
   333 public:
   334 	static COtgMessageWatcher* NewL(MOtgNotificationHandler &wdHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot);
   334 	static COtgMessageWatcher* NewL(MOtgNotificationHandler &wdHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot);
   335 	void ConstructL() {};
   335 	void ConstructL() {};
   336 	virtual ~COtgMessageWatcher() {LOG_FUNC Cancel(); };	
   336 	virtual ~COtgMessageWatcher() { Cancel(); };	
   337 	
   337 	
   338 	TInt IssueAgain() { iOtgRoot.otgQueueOtgMessageRequest(iMessage, iStatus); return(ETrue);};
   338 	TInt IssueAgain() { iOtgRoot.otgQueueOtgMessageRequest(iMessage, iStatus); return(ETrue);};
   339 	void DisplayEvent();
   339 	void DisplayEvent();
   340 	TInt GetEventValue() {return(iMessage);};
   340 	TInt GetEventValue() {return(iMessage);};
   341 	void DoCancel() {LOG_FUNC iOtgRoot.otgCancelOtgMessageRequest();};
   341 	void DoCancel() { iOtgRoot.otgCancelOtgMessageRequest();};
   342 
   342 
   343 protected:
   343 protected:
   344 	COtgMessageWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) : 
   344 	COtgMessageWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) : 
   345 		CNotifyWatcherBase(aHandler, aWatchType, aOtgRoot)
   345 		CNotifyWatcherBase(aHandler, aWatchType, aOtgRoot)
   346 			{};
   346 			{};
   352 class CPeripheralStateWatcher : public CNotifyWatcherBase
   352 class CPeripheralStateWatcher : public CNotifyWatcherBase
   353 	{
   353 	{
   354 public:
   354 public:
   355 	static CPeripheralStateWatcher* NewL(MOtgNotificationHandler &wdHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot);
   355 	static CPeripheralStateWatcher* NewL(MOtgNotificationHandler &wdHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot);
   356 	void ConstructL() {};
   356 	void ConstructL() {};
   357 	virtual ~CPeripheralStateWatcher() {LOG_FUNC Cancel(); };	
   357 	virtual ~CPeripheralStateWatcher() { Cancel(); };	
   358 	
   358 	
   359 	TInt IssueAgain() { iOtgRoot.otgQueuePeripheralStateRequest(iPeripheralState, iStatus); return(ETrue);};
   359 	TInt IssueAgain() { iOtgRoot.otgQueuePeripheralStateRequest(iPeripheralState, iStatus); return(ETrue);};
   360 	void DisplayEvent();
   360 	void DisplayEvent();
   361 	TInt GetEventValue() {return(iPeripheralState);};
   361 	TInt GetEventValue() {return(iPeripheralState);};
   362 	void DoCancel() {LOG_FUNC iOtgRoot.otgCancelPeripheralStateRequest();};
   362 	void DoCancel() { iOtgRoot.otgCancelPeripheralStateRequest();};
   363 
   363 
   364 protected:
   364 protected:
   365 	CPeripheralStateWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) : 
   365 	CPeripheralStateWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) : 
   366 		CNotifyWatcherBase(aHandler, aWatchType, aOtgRoot)
   366 		CNotifyWatcherBase(aHandler, aWatchType, aOtgRoot)
   367 			{};
   367 			{};
   373 class CAConnectionIdleWatcher : public CNotifyWatcherBase
   373 class CAConnectionIdleWatcher : public CNotifyWatcherBase
   374 	{
   374 	{
   375 public:
   375 public:
   376 	static CAConnectionIdleWatcher* NewL(MOtgNotificationHandler &wdHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot);
   376 	static CAConnectionIdleWatcher* NewL(MOtgNotificationHandler &wdHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot);
   377 	void ConstructL() {};
   377 	void ConstructL() {};
   378 	virtual ~CAConnectionIdleWatcher() {LOG_FUNC Cancel(); };	
   378 	virtual ~CAConnectionIdleWatcher() { Cancel(); };	
   379 	
   379 	
   380 	TInt IssueAgain() { iOtgRoot.otgQueueAConnectionIdleRequest(iAConnectionIdle, iStatus); return(ETrue);};
   380 	TInt IssueAgain() { iOtgRoot.otgQueueAConnectionIdleRequest(iAConnectionIdle, iStatus); return(ETrue);};
   381 	void DisplayEvent();
   381 	void DisplayEvent();
   382 	TInt GetEventValue() {return(iAConnectionIdle);};
   382 	TInt GetEventValue() {return(iAConnectionIdle);};
   383 	void DoCancel() {LOG_FUNC iOtgRoot.otgCancelAConnectionIdleRequest();};
   383 	void DoCancel() { iOtgRoot.otgCancelAConnectionIdleRequest();};
   384 
   384 
   385 protected:
   385 protected:
   386 	CAConnectionIdleWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) : 
   386 	CAConnectionIdleWatcher(MOtgNotificationHandler &aHandler, const TWatcherNotifyType aWatchType, COtgRoot &aOtgRoot) : 
   387 		CNotifyWatcherBase(aHandler, aWatchType, aOtgRoot)
   387 		CNotifyWatcherBase(aHandler, aWatchType, aOtgRoot)
   388 			{};
   388 			{};