equal
deleted
inserted
replaced
30 // -------------------------------------------------------------------------- |
30 // -------------------------------------------------------------------------- |
31 // |
31 // |
32 TInt LaunchServer() |
32 TInt LaunchServer() |
33 { |
33 { |
34 LOG( "RLocationManager::LaunchServer begin" ); |
34 LOG( "RLocationManager::LaunchServer begin" ); |
35 TParse parser; |
|
36 parser.Set( KLocServerFileName, &KDC_PROGRAMS_DIR, NULL ); |
|
37 |
35 |
38 // DLL launch |
36 // DLL launch |
39 RProcess server; |
37 RProcess server; |
40 const TInt ret = server.Create( parser.FullName(), KNullDesC ); |
38 TInt ret = server.Create( KLocServerFileName, KNullDesC ); |
41 |
39 |
42 if ( ret != KErrNone ) // Loading failed. |
40 if ( ret != KErrNone ) // Loading failed. |
43 { |
41 { |
44 return ret; |
42 return ret; |
45 } |
43 } |
49 |
47 |
50 if ( status != KRequestPending ) |
48 if ( status != KRequestPending ) |
51 { |
49 { |
52 LOG( "RLocationManager::LaunchServer Failed" ); |
50 LOG( "RLocationManager::LaunchServer Failed" ); |
53 server.Kill( 0 ); // Abort startup. |
51 server.Kill( 0 ); // Abort startup. |
54 server.Close(); |
|
55 return KErrGeneral; |
|
56 } |
52 } |
57 else |
53 else |
58 { |
54 { |
59 server.Resume(); // Logon OK - start the server. |
55 server.Resume(); // Logon OK - start the server. |
60 } |
56 } |
61 |
57 |
62 User::WaitForRequest( status ); |
58 User::WaitForRequest( status ); // wait for start or death |
|
59 // we can't use the 'exit reason' if the server panicked as this |
|
60 // is the panic 'reason' and may be '0' wehich cannot be distinguished |
|
61 // from KErrNone |
|
62 ret = ( server.ExitType() == EExitPanic ) ? KErrCommsBreak : status.Int(); |
63 server.Close(); |
63 server.Close(); |
64 LOG( "RLocationManager::LaunchServer end" ); |
64 LOG( "RLocationManager::LaunchServer end" ); |
65 return status.Int(); |
65 return ret; |
66 } |
66 } |
67 |
67 |
68 // -------------------------------------------------------------------------- |
68 // -------------------------------------------------------------------------- |
69 // RLocationManager::RLocationManager |
69 // RLocationManager::RLocationManager |
70 // C++ Constructor |
70 // C++ Constructor |
80 // -------------------------------------------------------------------------- |
80 // -------------------------------------------------------------------------- |
81 // |
81 // |
82 EXPORT_C TInt RLocationManager::Connect() |
82 EXPORT_C TInt RLocationManager::Connect() |
83 { |
83 { |
84 LOG( "RLocationManager::Connect(), begin" ); |
84 LOG( "RLocationManager::Connect(), begin" ); |
85 TInt ret = CreateSession( KLocServerName, Version(), KSessionSlotCount); |
85 |
86 if ( ret != KErrNone ) |
86 TInt error = LaunchServer(); |
|
87 |
|
88 if ( error == KErrNone || error == KErrAlreadyExists ) |
87 { |
89 { |
88 ret = LaunchServer(); |
90 error = CreateSession( KLocServerName, Version(), KSessionSlotCount ); |
89 if ( ret == KErrNone ) |
|
90 { |
|
91 ret = CreateSession( KLocServerName, Version() ); |
|
92 } |
|
93 } |
91 } |
|
92 |
94 LOG( "RLocationManager::Connect(), end" ); |
93 LOG( "RLocationManager::Connect(), end" ); |
95 return ret; |
94 |
|
95 return error; |
96 } |
96 } |
97 |
97 |
98 // -------------------------------------------------------------------------- |
98 // -------------------------------------------------------------------------- |
99 // RLocationManager::Close |
99 // RLocationManager::Close |
100 // -------------------------------------------------------------------------- |
100 // -------------------------------------------------------------------------- |