21 #include "mtppictbridgedpconst.h" |
21 #include "mtppictbridgedpconst.h" |
22 #include "cptpreceivedmsghandler.h" |
22 #include "cptpreceivedmsghandler.h" |
23 #include "cmtppictbridgeprinter.h" |
23 #include "cmtppictbridgeprinter.h" |
24 #include "cptpserver.h" |
24 #include "cptpserver.h" |
25 #include "ptpdef.h" |
25 #include "ptpdef.h" |
|
26 #include "OstTraceDefinitions.h" |
|
27 #ifdef OST_TRACE_COMPILER_IN_USE |
|
28 #include "cptpreceivedmsghandlerTraces.h" |
|
29 #endif |
|
30 |
26 |
31 |
27 // -------------------------------------------------------------------------- |
32 // -------------------------------------------------------------------------- |
28 // CPtpReceivedMsgHandler::NewL() |
33 // CPtpReceivedMsgHandler::NewL() |
29 // |
34 // |
30 // -------------------------------------------------------------------------- |
35 // -------------------------------------------------------------------------- |
54 // |
59 // |
55 // -------------------------------------------------------------------------- |
60 // -------------------------------------------------------------------------- |
56 // |
61 // |
57 void CPtpReceivedMsgHandler::ConstructL() |
62 void CPtpReceivedMsgHandler::ConstructL() |
58 { |
63 { |
59 __FLOG_OPEN(KMTPSubsystem, KPtpServerLog); |
|
60 } |
64 } |
61 |
65 |
62 // -------------------------------------------------------------------------- |
66 // -------------------------------------------------------------------------- |
63 // CPtpReceivedMsgHandler::~CPtpReceivedMsgHandler() |
67 // CPtpReceivedMsgHandler::~CPtpReceivedMsgHandler() |
64 // C++ destructor. |
68 // C++ destructor. |
65 // -------------------------------------------------------------------------- |
69 // -------------------------------------------------------------------------- |
66 // |
70 // |
67 CPtpReceivedMsgHandler::~CPtpReceivedMsgHandler() |
71 CPtpReceivedMsgHandler::~CPtpReceivedMsgHandler() |
68 { |
72 { |
69 __FLOG(_L8("CPtpReceivedMsgHandler::~")); |
73 OstTraceFunctionEntry0( CPTPRECEIVEDMSGHANDLER_CPTPRECEIVEDMSGHANDLER_DES_ENTRY ); |
70 iReceiveQ.Close(); |
74 iReceiveQ.Close(); |
71 __FLOG_CLOSE; |
75 OstTraceFunctionExit0( CPTPRECEIVEDMSGHANDLER_CPTPRECEIVEDMSGHANDLER_DES_EXIT ); |
72 } |
76 } |
73 |
77 |
74 // -------------------------------------------------------------------------- |
78 // -------------------------------------------------------------------------- |
75 // CPtpReceivedMsgHandler::Initialize() |
79 // CPtpReceivedMsgHandler::Initialize() |
76 // |
80 // |
90 // |
94 // |
91 // -------------------------------------------------------------------------- |
95 // -------------------------------------------------------------------------- |
92 // |
96 // |
93 void CPtpReceivedMsgHandler::RegisterReceiveObjectNotify(const TDesC& aExtension) |
97 void CPtpReceivedMsgHandler::RegisterReceiveObjectNotify(const TDesC& aExtension) |
94 { |
98 { |
95 __FLOG(_L8(">>>PtpMsgHandler::RegisterReceiveObjectNotify")); |
99 OstTraceFunctionEntry0( CPTPRECEIVEDMSGHANDLER_REGISTERRECEIVEOBJECTNOTIFY_ENTRY ); |
96 iExtension.Copy(aExtension); |
100 iExtension.Copy(aExtension); |
97 __FLOG_VA((_L8("***the Receiving Que msg count: %d"), iReceiveQ.Count())); |
101 OstTrace1( TRACE_NORMAL, CPTPRECEIVEDMSGHANDLER_REGISTERRECEIVEOBJECTNOTIFY, |
|
102 "***the Receiving Que msg count: %d", iReceiveQ.Count()); |
98 for ( TUint index = 0; index < iReceiveQ.Count(); ++index ) |
103 for ( TUint index = 0; index < iReceiveQ.Count(); ++index ) |
99 { |
104 { |
100 if ( ObjectReceived( iReceiveQ[index] ) ) |
105 if ( ObjectReceived( iReceiveQ[index] ) ) |
101 { |
106 { |
102 iReceiveQ.Remove(index); |
107 iReceiveQ.Remove(index); |
103 break; |
108 break; |
104 } |
109 } |
105 } |
110 } |
106 __FLOG_VA((_L8("***the Receiving Que msg count:%d"), iReceiveQ.Count())); |
111 OstTrace1( TRACE_NORMAL, DUP1_CPTPRECEIVEDMSGHANDLER_REGISTERRECEIVEOBJECTNOTIFY, |
107 __FLOG(_L8("<<<PtpMsgHandler::RegisterReceiveObjectNotify")); |
112 "***the Receiving Que msg count:%d", iReceiveQ.Count() ); |
|
113 OstTraceFunctionExit0( CPTPRECEIVEDMSGHANDLER_REGISTERRECEIVEOBJECTNOTIFY_EXIT ); |
108 } |
114 } |
109 |
115 |
110 // -------------------------------------------------------------------------- |
116 // -------------------------------------------------------------------------- |
111 // |
117 // |
112 // -------------------------------------------------------------------------- |
118 // -------------------------------------------------------------------------- |
113 // |
119 // |
114 TBool CPtpReceivedMsgHandler::ObjectReceived(TUint32 aHandle) |
120 TBool CPtpReceivedMsgHandler::ObjectReceived(TUint32 aHandle) |
115 { |
121 { |
116 __FLOG_VA((_L8(">>>CPtpReceivedMsgHandler::ObjectReceived 0x%x"), aHandle)); |
122 OstTraceFunctionEntry0( CPTPRECEIVEDMSGHANDLER_OBJECTRECEIVED_ENTRY ); |
|
123 OstTrace1( TRACE_NORMAL, CPTPRECEIVEDMSGHANDLER_OBJECTRECEIVED, "Handle 0x%x", aHandle ); |
117 TBuf<KFileNameAndPathLength> file; |
124 TBuf<KFileNameAndPathLength> file; |
118 TInt err=KErrNone; |
125 TInt err=KErrNone; |
119 TRAP( err, iServerP->GetObjectNameByHandleL(file, aHandle)); |
126 TRAP( err, iServerP->GetObjectNameByHandleL(file, aHandle)); |
120 __FLOG_VA((_L16("---after GetObjectNameByHandleL err(%d) file is %S"), err, &file)); |
127 OstTraceExt2( TRACE_NORMAL, DUP2_CPTPRECEIVEDMSGHANDLER_OBJECTRECEIVED, |
|
128 "---after GetObjectNameByHandleL err(%d) file is %S", err, file ); |
|
129 |
121 if (err == KErrNone) |
130 if (err == KErrNone) |
122 { |
131 { |
123 TFileName fileName; |
132 TFileName fileName; |
124 TBuf<KFileExtLength> extension; |
133 TBuf<KFileExtLength> extension; |
125 TParse p; |
134 TParse p; |
126 err = p.Set(file,NULL,NULL); |
135 err = p.Set(file,NULL,NULL); |
127 __FLOG_VA((_L8("---after Set err(%d)"), err)); |
136 OstTrace1(TRACE_NORMAL, DUP3_CPTPRECEIVEDMSGHANDLER_OBJECTRECEIVED, "---after Set err(%d)", err ); |
|
137 |
128 if (err == KErrNone) |
138 if (err == KErrNone) |
129 { |
139 { |
130 fileName = p.FullName(); |
140 fileName = p.FullName(); |
131 |
141 |
132 extension = p.Ext(); |
142 extension = p.Ext(); |
133 __FLOG_VA((_L16("---after parse file is %S ext is %S comparing it to %S"), &fileName, &extension, &iExtension)); |
143 OstTraceExt3( TRACE_NORMAL, DUP4_CPTPRECEIVEDMSGHANDLER_OBJECTRECEIVED, |
|
144 "---after parse file is %S ext is %S comparing it to %S", fileName, extension, iExtension ); |
|
145 |
134 if (!iExtension.CompareF(extension)) |
146 if (!iExtension.CompareF(extension)) |
135 { |
147 { |
136 iServerP->Printer()->ObjectReceived(fileName); |
148 iServerP->Printer()->ObjectReceived(fileName); |
137 // deregister notification |
149 // deregister notification |
138 DeRegisterReceiveObjectNotify(); |
150 DeRegisterReceiveObjectNotify(); |
|
151 OstTraceFunctionExit0( CPTPRECEIVEDMSGHANDLER_OBJECTRECEIVED_EXIT ); |
139 return ETrue; |
152 return ETrue; |
140 } |
153 } |
141 else |
154 else |
142 { |
155 { |
143 // we keep the coming file in a "queue" so that later |
156 // we keep the coming file in a "queue" so that later |
146 if(KErrNotFound == iReceiveQ.Find(aHandle)) |
159 if(KErrNotFound == iReceiveQ.Find(aHandle)) |
147 { |
160 { |
148 iReceiveQ.Append(aHandle); |
161 iReceiveQ.Append(aHandle); |
149 } |
162 } |
150 |
163 |
151 __FLOG_VA((_L8("*** Que length is %d err is %d"), iReceiveQ.Count(), err)); |
164 OstTraceExt2( TRACE_NORMAL, DUP5_CPTPRECEIVEDMSGHANDLER_OBJECTRECEIVED, |
152 } |
165 "*** Que length is %d err is %d", iReceiveQ.Count(), err); |
|
166 } |
153 } |
167 } |
154 } |
168 } |
155 |
169 |
156 __FLOG_VA((_L8("<<<CPtpReceivedMsgHandler::ObjectReceived %d"), err)); |
170 OstTrace1( TRACE_NORMAL, DUP1_CPTPRECEIVEDMSGHANDLER_OBJECTRECEIVED, "error code %d", err ); |
|
171 OstTraceFunctionExit0( DUP1_CPTPRECEIVEDMSGHANDLER_OBJECTRECEIVED_EXIT ); |
157 return EFalse; |
172 return EFalse; |
158 } |
173 } |
159 |
174 |
160 |
175 |
161 // -------------------------------------------------------------------------- |
176 // -------------------------------------------------------------------------- |