equal
deleted
inserted
replaced
76 // |
76 // |
77 // -------------------------------------------------------------------------- |
77 // -------------------------------------------------------------------------- |
78 // |
78 // |
79 void CMTPPictBridgeUsbConnection::Listen() |
79 void CMTPPictBridgeUsbConnection::Listen() |
80 { |
80 { |
81 iProperty.Subscribe(iStatus); |
81 __FLOG(_L8(">> CMTPPictBridgeUsbConnection::Listen")); |
82 SetActive(); |
82 if(!IsActive()) |
83 if(ConnectionClosed()) // we listen to the disconnection only if connected to the printer |
|
84 { |
83 { |
85 iPrinter.ConnectionClosed(); |
84 __FLOG(_L8(" CMTPPictBridgeUsbConnection AO is NOT active and run AO")); |
86 Cancel(); |
85 iProperty.Subscribe(iStatus); |
|
86 SetActive(); |
|
87 if(ConnectionClosed()) // we listen to the disconnection only if connected to the printer |
|
88 { |
|
89 iPrinter.ConnectionClosed(); |
|
90 Cancel(); |
|
91 } |
87 } |
92 } |
|
93 __FLOG(_L8("<< CMTPPictBridgeUsbConnection::Listen")); |
88 } |
94 } |
89 |
95 |
90 // -------------------------------------------------------------------------- |
96 // -------------------------------------------------------------------------- |
91 // |
97 // |
92 // -------------------------------------------------------------------------- |
98 // -------------------------------------------------------------------------- |
95 { |
101 { |
96 TInt personality=KNotAssigned; |
102 TInt personality=KNotAssigned; |
97 TInt ret = RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, personality); |
103 TInt ret = RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, personality); |
98 |
104 |
99 __FLOG_VA((_L8("CMTPPictBridgeUsbConnection::ConnectionClosed() current personality = %d, previous personality = %d"), personality, iPreviousPersonality)); |
105 __FLOG_VA((_L8("CMTPPictBridgeUsbConnection::ConnectionClosed() current personality = %d, previous personality = %d"), personality, iPreviousPersonality)); |
100 if ((ret == KErrNone && |
106 if ((ret == KErrNone && personality == KUsbPersonalityIdMS) |
101 (personality == KUsbPersonalityIdMS || personality == KUsbPersonalityIdPTP)) |
|
102 || (iPreviousPersonality != KNotAssigned && personality != iPreviousPersonality)) |
107 || (iPreviousPersonality != KNotAssigned && personality != iPreviousPersonality)) |
103 { |
108 { |
104 __FLOG_VA((_L8("****WARNING!!! PTP server detects the USB connection closed!"))); |
109 if((personality != KUsbPersonalityIdPCSuiteMTP)&&(personality != KUsbPersonalityIdMTP)) |
105 return ETrue; |
110 { |
|
111 __FLOG_VA((_L8("****WARNING!!! PTP server detects the USB connection closed!"))); |
|
112 return ETrue; |
|
113 } |
106 } |
114 } |
107 |
115 |
108 iPreviousPersonality = personality; |
116 iPreviousPersonality = personality; |
109 return EFalse; |
117 return EFalse; |
110 } |
118 } |