120 |
120 |
121 server.Close(); |
121 server.Close(); |
122 |
122 |
123 if( err ) |
123 if( err ) |
124 { |
124 { |
125 OstTrace1( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP2, "RUsbPnClient::ConnectL() - waiting server response status; err=%d", err ); |
125 OstTrace1( TRACE_INTERNALS, RUSBPNCLIENT_CONNECTL_DUP2, "RUsbPnClient::ConnectL() - waiting server response status; err=%d", err ); |
126 E_TRACE( ( _T( "RUsbPnClient::ConnectL() - waiting server response status: %d" ), err ) ); |
126 E_TRACE( ( _T( "RUsbPnClient::ConnectL() - waiting server response status: %d" ), err ) ); |
127 TRACE_ASSERT_ALWAYS; |
127 TRACE_ASSERT_ALWAYS; |
128 User::LeaveIfError( err ); |
128 User::LeaveIfError( err ); |
129 } |
129 } |
130 /* End of starting process */ |
130 /* End of starting process */ |
131 /********************************************/ |
131 /********************************************/ |
132 |
132 |
133 OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP3, "RUsbPnClient::ConnectL() - server is started, signal other clients" ); |
133 OstTrace0( TRACE_INTERNALS, RUSBPNCLIENT_CONNECTL_DUP3, "RUsbPnClient::ConnectL() - server is started, signal other clients" ); |
134 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - server is started, signal other clients" ) ) ); |
134 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - server is started, signal other clients" ) ) ); |
135 // Signal other clients |
135 // Signal other clients |
136 startLock.Signal( KMaxTInt ); |
136 startLock.Signal( KMaxTInt ); |
137 |
137 |
138 // Close semaphore |
138 // Close semaphore |
145 RSemaphore startLock; |
145 RSemaphore startLock; |
146 |
146 |
147 // Open lock semaphore |
147 // Open lock semaphore |
148 User::LeaveIfError( startLock.Open( lock ) ); |
148 User::LeaveIfError( startLock.Open( lock ) ); |
149 |
149 |
150 OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP4, "RUsbPnClient::ConnectL() - server is starting, wait for signal" ); |
150 OstTrace0( TRACE_INTERNALS, RUSBPNCLIENT_CONNECTL_DUP4, "RUsbPnClient::ConnectL() - server is starting, wait for signal" ); |
151 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - server is starting, wait for signal" ) ) ); |
151 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - server is starting, wait for signal" ) ) ); |
152 // Wait for signal |
152 // Wait for signal |
153 startLock.Wait(); |
153 startLock.Wait(); |
154 OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP5, "RUsbPnClient::ConnectL() - signal received" ); |
154 OstTrace0( TRACE_INTERNALS, RUSBPNCLIENT_CONNECTL_DUP5, "RUsbPnClient::ConnectL() - signal received" ); |
155 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - signal received" ) ) ); |
155 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - signal received" ) ) ); |
156 |
156 |
157 // Close semaphore |
157 // Close semaphore |
158 startLock.Close(); |
158 startLock.Close(); |
159 |
159 |
160 } |
160 } |
161 |
161 |
162 // Create USB Phonet Link server session |
162 // Create USB Phonet Link server session |
163 OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP6, "RUsbPnClient::ConnectL() - Create session" ); |
163 OstTrace0( TRACE_INTERNALS, RUSBPNCLIENT_CONNECTL_DUP6, "RUsbPnClient::ConnectL() - Create session" ); |
164 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - Create session" ) ) ); |
164 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - Create session" ) ) ); |
165 |
165 |
166 User::LeaveIfError( CreateSession( KUsbPnServerName, TVersion(1,0,0) ) ); |
166 User::LeaveIfError( CreateSession( KUsbPnServerName, TVersion(1,0,0) ) ); |
167 |
167 |
168 OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP7, "RUsbPnClient::ConnectL() - session created1" ); |
168 OstTrace0( TRACE_INTERNALS, RUSBPNCLIENT_CONNECTL_DUP7, "RUsbPnClient::ConnectL() - session created1" ); |
169 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - session created1" ) ) ); |
169 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - session created1" ) ) ); |
170 } |
170 } |
171 else if ( err ) |
171 else if ( err ) |
172 { |
172 { |
173 OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP8, "RUsbPnClient::ConnectL() - session not created, reason uknown" ); |
173 OstTrace0( TRACE_INTERNALS, RUSBPNCLIENT_CONNECTL_DUP8, "RUsbPnClient::ConnectL() - session not created, reason uknown" ); |
174 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - session not created, reason uknown" ) ) ); |
174 E_TRACE( ( _L( "RUsbPnClient::ConnectL() - session not created, reason uknown" ) ) ); |
175 TRACE_ASSERT_ALWAYS; |
175 TRACE_ASSERT_ALWAYS; |
176 User::Leave( err ); |
176 User::Leave( err ); |
177 } |
177 } |
178 else |
178 else |
179 { |
179 { |
180 OstTrace0( TRACE_DETAILED, RUSBPNCLIENT_CONNECTL_DUP9, "RUsbPnClient::ConnectL() - session created2" ); |
180 OstTrace0( TRACE_INTERNALS, RUSBPNCLIENT_CONNECTL_DUP9, "RUsbPnClient::ConnectL() - session created2" ); |
181 E_TRACE( ( _T( "RUsbPnClient::ConnectL() - session created2" ) ) ); |
181 E_TRACE( ( _T( "RUsbPnClient::ConnectL() - session created2" ) ) ); |
182 } |
182 } |
183 OstTrace0( TRACE_API, RUSBPNCLIENT_CONNECTL_EXIT, "RUsbPnClient::ConnectL() - return void" ); |
183 OstTrace0( TRACE_BORDER, RUSBPNCLIENT_CONNECTL_EXIT, "RUsbPnClient::ConnectL() - return void" ); |
184 A_TRACE( ( _T( "RUsbPnClient::ConnectL() - return void" ) ) ); |
184 A_TRACE( ( _T( "RUsbPnClient::ConnectL() - return void" ) ) ); |
185 } |
185 } |
186 |
186 |
187 //----------------------------------------------------------------------------- |
187 //----------------------------------------------------------------------------- |
188 // RPtp::DestroyPtpStatck() |
188 // RPtp::DestroyPtpStatck() |
189 // Destroy PTP stack |
189 // Destroy PTP stack |
190 //----------------------------------------------------------------------------- |
190 //----------------------------------------------------------------------------- |
191 // |
191 // |
192 EXPORT_C void RUsbPnClient::Detach() |
192 EXPORT_C void RUsbPnClient::Detach() |
193 { |
193 { |
194 OstTrace0( TRACE_API, RUSBPNCLIENT_DETACH_ENTRY, "RUsbPnClient::Detach" ); |
194 OstTrace0( TRACE_BORDER, RUSBPNCLIENT_DETACH_ENTRY, "RUsbPnClient::Detach" ); |
195 A_TRACE( ( _T( "RUsbPnClient::Disconnect()" ) ) ); |
195 A_TRACE( ( _T( "RUsbPnClient::Disconnect()" ) ) ); |
196 SendReceive( EPnDetach ); |
196 SendReceive( EPnDetach ); |
197 // close the session |
197 // close the session |
198 RSessionBase::Close(); |
198 RSessionBase::Close(); |
199 OstTrace0( TRACE_API, RUSBPNCLIENT_DETACH_EXIT, "RUsbPnClient::Detach - return void" ); |
199 OstTrace0( TRACE_BORDER, RUSBPNCLIENT_DETACH_EXIT, "RUsbPnClient::Detach - return void" ); |
200 A_TRACE( ( _T( "RUsbPnClient::Disconnect() - return void" ) ) ); |
200 A_TRACE( ( _T( "RUsbPnClient::Disconnect() - return void" ) ) ); |
201 } |
201 } |
202 |
202 |
203 |
203 |
204 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
204 // ========================== OTHER EXPORTED FUNCTIONS ========================= |