datacommsserver/esockserver/test/providers/dummy/inc/dummypr_mcprpubsubsubscriber.h
changeset 2 dee179edb159
parent 1 21d2ab05f085
child 13 0b0e9fce0b58
equal deleted inserted replaced
1:21d2ab05f085 2:dee179edb159
    29 #include <comms-infras/ss_nodemessages.h>
    29 #include <comms-infras/ss_nodemessages.h>
    30 #include <comms-infras/ss_mmcommsprov.h>
    30 #include <comms-infras/ss_mmcommsprov.h>
    31 #include <comms-infras/ss_metaconnprov.h>
    31 #include <comms-infras/ss_metaconnprov.h>
    32 
    32 
    33 
    33 
    34 class CMCPrPubSubSubscriber : public CActive, public Messages::ASimpleNodeIdBase
    34 NONSHARABLE_CLASS(CMCPrPubSubSubscriber) : public CActive, public Messages::ASimpleNodeIdBase
    35 	{
    35 	{
    36 public:
    36 public:
       
    37 	static CMCPrPubSubSubscriber* NewL(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
       
    38 	void StartAvailabilityMonitoringL(const Messages::TNodeCtxId& aAvailabilityActivity);
       
    39 	void CancelAvailabilityMonitoring();
    37 	virtual ~CMCPrPubSubSubscriber();
    40 	virtual ~CMCPrPubSubSubscriber();
    38 
    41 
    39     enum
    42     enum
    40     {
    43     {
    41 		EAvailabilityTestingPubSubUid = 0x10272F42,
    44 		KStart			= 1, // Causes a TStart message to be issued
    42 		EStopTriggeringPubSubUid = 0x10203FDD
    45 		KBlockingStop   = 2, // Causes a TStop to be issued and increments the blocking count to stop the node from being cleaned up.
       
    46 		KStop	        = 3  // Causes a TStop to be issued;
    43 	};
    47 	};
       
    48     
       
    49     enum { EAvailabilityTestingPubSubUid = 0x10272F42 };  
    44     virtual void ReceivedL(const Messages::TRuntimeCtxId& /*aSender*/, const Messages::TNodeId& /*aRecipient*/, Messages::TSignatureBase& aMessage)
    50     virtual void ReceivedL(const Messages::TRuntimeCtxId& /*aSender*/, const Messages::TNodeId& /*aRecipient*/, Messages::TSignatureBase& aMessage)
    45         {
    51         {
    46         //This object is only a node because its host needs an TCFClientType::EAvailabilityProvider, which
    52         //This object is only a node because its host needs an TCFClientType::EAvailabilityProvider, which
    47         //can't be the same as the node.
    53         //can't be the same as the node.
    48         //Unfortunatelly the CAvailabilityActivity is really persistent when it comes to sending TCancel to
    54         //Unfortunatelly the CAvailabilityActivity is really persistent when it comes to sending TCancel to
    52             ASSERT(EFalse);
    58             ASSERT(EFalse);
    53             }
    59             }
    54         }
    60         }
    55 
    61 
    56 
    62 
    57 protected:
    63 private:
    58 	CMCPrPubSubSubscriber(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
    64 	CMCPrPubSubSubscriber(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
    59 	virtual void StartL();
    65 	void StartL();
    60 
    66 	void RunL();
    61 private:
       
    62 	TInt RunError(TInt aError);
    67 	TInt RunError(TInt aError);
    63 	void DoCancel();
    68 	void DoCancel();
    64 
    69 
    65 protected:
    70 private:
    66     const ESock::CMetaConnectionProviderBase& iNode;
    71     const ESock::CMetaConnectionProviderBase& iNode;
    67 	TInt iStopCode;
    72 	TInt iStopCode;
    68 	RProperty iProperty;
    73 	RProperty iProperty;
    69 	TBool iBlocking;
    74 	TBool iBlocking;
       
    75 	
       
    76 	//the availablity activity subscribing for pubsub availablity changes.
       
    77 	Messages::TNodeCtxId iAvailabilityActivity;
    70 	};
    78 	};
    71 
    79 
    72 NONSHARABLE_CLASS(CMCPrPubSubAvailability) : public CMCPrPubSubSubscriber
       
    73     {
       
    74 public:
       
    75 	static CMCPrPubSubAvailability* NewL(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
       
    76 
       
    77 	void StartAvailabilityMonitoringL(const Messages::TNodeCtxId& aAvailabilityActivity);
       
    78 	void CancelAvailabilityMonitoring();
       
    79 
       
    80 private:
       
    81 	CMCPrPubSubAvailability(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
       
    82 	void RunL();
       
    83 
       
    84 	//the availablity activity subscribing for pubsub availablity changes.
       
    85 	Messages::TNodeCtxId iAvailabilityActivity;
       
    86     };
       
    87 
       
    88 NONSHARABLE_CLASS(CMCPrPubSubStopTrigger) : public CMCPrPubSubSubscriber
       
    89     {
       
    90 public:
       
    91     static CMCPrPubSubStopTrigger* NewL(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
       
    92 
       
    93     enum
       
    94     {
       
    95 		KStart			= 1, // Causes a TStart message to be issued
       
    96 		KBlockingStop   = 2, // Causes a TStop to be issued and increments the blocking count to stop the node from being cleaned up.
       
    97 		KStop	        = 3  // Causes a TStop to be issued;
       
    98 	};
       
    99 
       
   100 protected:
       
   101     void StartL();
       
   102 private:
       
   103 	CMCPrPubSubStopTrigger(const ESock::CMetaConnectionProviderBase& aProvBase, TUint aStopCode);
       
   104 	void RunL();
       
   105 
       
   106 	Messages::TNodeId iNodeId;
       
   107     };
       
   108 
       
   109 #endif // _DUMMYPR_MCPrPUBSUBSUBSCRIBER_H_
    80 #endif // _DUMMYPR_MCPrPUBSUBSUBSCRIBER_H_