20 #ifndef __ISIROUTER_H__ |
20 #ifndef __ISIROUTER_H__ |
21 #define __ISIROUTER_H__ |
21 #define __ISIROUTER_H__ |
22 |
22 |
23 |
23 |
24 #include "misilinkrouterif.h" // For MISILinkRouterIf |
24 #include "misilinkrouterif.h" // For MISILinkRouterIf |
25 #include "misichannelrouterif.h" // For MISIChannelRouterIf |
25 #include "misiobjectrouterif.h" // For MISIObjectRouterIf |
26 #include "isiinternaldefs.h" // For KMaxAmountOfObjId |
26 #include "isiinternaldefs.h" // For KMaxAmountOfObjId |
27 //#include "misiobjectrouterif.h" |
27 //#include "misiobjectrouterif.h" |
28 |
28 |
29 |
29 |
30 class MISIRouterChannelIf; |
30 class MISIRouterObjectIf; |
31 class MISIRouterObjectIf; |
31 class MISIRouterObjectIf; |
32 class MISIRouterLinkIf; |
32 class MISIRouterLinkIf; |
33 class DISICLTransceiver; |
33 class DISICLTransceiver; |
34 class DISIThreadContainer; |
34 class DISIThreadContainer; |
35 |
35 |
36 /* |
36 /* |
37 * ISI router. |
37 * ISI router. |
38 */ |
38 */ |
39 NONSHARABLE_CLASS( DISIRouter ) : public DBase, public MISIChannelRouterIf |
39 NONSHARABLE_CLASS( DISIRouter ) : public DBase, public MISIObjectRouterIf |
40 { |
40 { |
41 |
41 |
42 public: |
42 public: |
43 |
43 |
44 /* |
44 /* |
49 /* |
49 /* |
50 * Destructor |
50 * Destructor |
51 */ |
51 */ |
52 ~DISIRouter(); |
52 ~DISIRouter(); |
53 |
53 |
54 /* |
|
55 * See comments from MISILinkRouterIf |
|
56 */ |
|
57 //void Receive( TDes8& aMessage ); |
|
58 |
|
59 //From CLTransceiver |
54 //From CLTransceiver |
60 TBool Receive( TDes8& aMessage, const TUint8 aObjId ); |
55 TBool Receive( TDes8& aMessage, const TUint8 aObjId ); |
61 |
56 |
62 /* |
57 /* |
63 * See comments from MISIChannelRouterIf |
58 * See comments from MISIObjectRouterIf |
64 */ |
59 */ |
65 TInt Send( TDes8& aMessage, const TUint8 aObjId ); |
60 TInt Send( TDes8& aMessage, const TUint8 aObjId ); |
66 |
61 |
67 /* |
62 /* |
68 * See comments from MISIChannelRouterIf |
63 * See comments from MISIObjectRouterIf |
69 */ |
64 */ |
70 void Disconnect( const TUint8 aObjId ); |
65 void Disconnect( const TUint8 aObjId ); |
71 |
66 |
72 /* |
67 /* |
73 * See comments from MISIChannelRouterIf |
68 * See comments from MISIObjectRouterIf |
74 */ |
69 */ |
75 TDfcQue* GetDfcThread( const TISIDfcQThreadType aType ); |
70 TDfcQue* GetDfcThread( const TISIDfcQThreadType aType ); |
76 |
71 |
77 void FreeDfcThread( TDfcQue* aThread ); |
72 void FreeDfcThread( TDfcQue* aThread ); |
78 |
73 |
79 /* |
74 /* |
80 * See comments from MISIChannelRouterIf |
75 * See comments from MISIObjectRouterIf |
81 */ |
76 */ |
82 void Connect( const TInt32 aUID, TUint8& aObjId, MISIRouterChannelIf* aCallback ); |
77 void Connect( const TInt32 aUID, TUint8& aObjId, MISIRouterObjectIf* aCallback ); |
83 |
78 |
84 /* |
79 /* |
85 * Returns pointer to router it self, called only from MISIChannelRouterIf::GetIf |
80 * Returns pointer to router it self, called only from MISIObjectRouterIf::GetIf |
86 * @return pointer to router. |
81 * @return pointer to router. |
87 */ |
82 */ |
88 static DISIRouter* GetRouter(){ return iSelfPtr; }; |
83 static DISIRouter* GetRouter(){ return iSelfPtr; }; |
89 |
84 |
90 |
|
91 private: |
85 private: |
92 |
86 |
93 NONSHARABLE_CLASS( TISIClient ) |
87 NONSHARABLE_CLASS( TISIClient ) |
94 { |
88 { |
95 public: |
89 public: |
96 |
|
97 TInt32 iUID; |
90 TInt32 iUID; |
98 TUint8 iObjId; |
91 TUint8 iObjId; |
99 MISIRouterChannelIf* iChannel; |
92 MISIRouterObjectIf* iChannel; |
100 }; |
93 }; |
101 //private: |
94 |
102 NONSHARABLE_CLASS( TStaticId ) |
95 NONSHARABLE_CLASS( TStaticId ) |
103 { |
96 { |
104 public: |
97 public: |
105 |
|
106 TStaticId( const TInt32 aUID, TUint8 aObjId ){iUID = aUID; iObjId = aObjId;}; |
98 TStaticId( const TInt32 aUID, TUint8 aObjId ){iUID = aUID; iObjId = aObjId;}; |
107 |
|
108 TInt32 iUID; |
99 TInt32 iUID; |
109 TUint8 iObjId; |
100 TUint8 iObjId; |
110 }; |
101 }; |
111 |
102 |
112 private: |
103 private: |
113 |
104 |
114 /* |
105 /* |
115 * Handles initialization of this class. |
106 * Handles initialization of this class. |
116 * Called in own thread context not supervisors |
107 * Called in own thread context not supervisors |
117 */ |
108 */ |
118 void Initialize(); |
109 void Initialize(); |
119 |
110 |
120 void CheckUIDUniqueness( const TInt32 aUID ); |
111 TBool CheckUIDUniqueness( const TInt32 aUID ); |
121 |
112 |
122 TUint8 ReceiveStaticObjId( const TInt32 aUID ); |
113 TUint8 ReserveStaticObjId( const TInt32 aUID ); |
123 |
114 |
124 TUint8 ReserveNewDynamicObjId(); |
115 TUint8 ReserveNewDynamicObjId(); |
125 |
116 |
126 static void InitializeDfc( TAny* aPtr ); |
117 static void InitializeDfc( TAny* aPtr ); |
127 |
118 |
128 |
|
129 public: |
119 public: |
|
120 |
130 // Written only once no need to synch. |
121 // Written only once no need to synch. |
131 static DISIRouter* iSelfPtr; |
122 static DISIRouter* iSelfPtr; |
132 MISIRouterObjectIf* iNameService; |
|
133 MISIRouterObjectIf* iCommunicationManager; |
|
134 |
|
135 private: |
|
136 |
123 |
|
124 |
|
125 DISICLTransceiver* GetDISICLTransceiver(){ return iShCLTransceiver;}; |
|
126 |
|
127 private: |
|
128 |
137 // Owned, synchronized internally with fastmutexes. |
129 // Owned, synchronized internally with fastmutexes. |
138 RArray< TStaticId* > iStaticObjIdTable; |
130 RArray< TStaticId* > iStaticObjIdTable; |
139 // Owned, synchronized internally with fastmutexes. |
131 // Owned, synchronized internally with fastmutexes. |
140 TISIClient* iClientTable[ KMaxAmountOfObjId ]; |
132 TISIClient* iClientTable[ KMaxAmountOfObjId ];// switch this to objects |
141 // Guards class shared array, owned |
133 // Guards class shared array, owned |
142 NFastMutex* iClientTableFastMutex; |
134 NFastMutex* iClientTableFastMutex; |
143 // Owned |
135 // Owned, executed only from one thread. |
144 TDfc* iInitializeDfc; |
136 TDfc* iInitializeDfc; |
|
137 // Owned, executed only from one thread. |
145 TDfcQue* iInitThread; |
138 TDfcQue* iInitThread; |
146 DISICLTransceiver* iCLTransceiver; |
139 // Owned, synch done inside the class. |
147 DISIThreadContainer* iClientThreadContainer; |
140 DISICLTransceiver* iShCLTransceiver; |
148 |
141 // Owned, synch done inside the class. |
|
142 DISIThreadContainer* iShClientThreadContainer; |
149 |
143 |
150 }; |
144 }; |
151 |
145 |
152 #endif /* __ISIROUTER_H__ */ |
146 #endif /* __ISIROUTER_H__ */ |
153 |
147 |