1 /* ------------------------------------------------------------------
2 * Copyright (C) 1998-2009 PacketVideo
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13 * express or implied.
14 * See the License for the specific language governing permissions
15 * and limitations under the License.
16 * -------------------------------------------------------------------
17 */
18 #include "oscl_base.h"
19 #include "oscl_mem.h"
20 #include "osclconfig_compiler_warnings.h"
21 #include "tscmain.h"
22 #include "h223types.h"
23 #include "h223_api.h"
24 #include "h223.h"
25 #include "cpvh223multiplex.h"
26 #include "layer.h"
27 #include "tsc_eventreceive.h"
28 #include "tsc_h324m_config.h"
29 #include "tsc_statemanager.h"
30 #include "tsc_lc.h"
31 #include "tsc_blc.h"
32 #include "tsc_clc.h"
33 #include "tsc_constants.h"
34 #include "tsc_mt.h"
35 #include "tsc_component.h"
36 #include "tsc_capability.h"
37 #include "tsc_channelcontrol.h"
38 #ifdef MEM_TRACK
39 #include "oscl_mem.h"
40 #include "oscl_mem_audit.h"
41 #endif
42 #define PV_2WAY_TSC_TIMER_ID "PV_2WAY_TSC_TIMER"
43 #define PV_2WAY_TSC_TIMER_INTERVAL 1 /* 1 second */
44
45 #define PV_2WAY_TSC_NUM_CMD_Q_ELEMENTS 10
46 #define PV_2WAY_TSC_NUM_PENDING_CMD_Q_ELEMENTS 10
47
48 #define TSC_MAX_CONTROL_CHANNEL_BITRATE_BPS 64000
49 #define TSC_BIG_UINT32 0XFFFFFFFF
50 #define TSC_H223_LEVEL_DEFAULT H223_LEVEL2
51 #define DEFAULT_TCS_RECEIVE_TIMEOUT_SECONDS 20
52 #define DEFAULT_TCS_LEVEL_SETUP_TIMEOUT_SECONDS 6
53 #define DEFAULT_RTD_TIMER_SECONDS 7
54
55
56 // Default command queue reserve size
57 #define PVMF_CMD_QUEUE_RESERVE 10
58
59 // Starting value for command IDs
60 #define PVMF_CMD_ID_START 10000
61
62 // the assumed minimum T401 timer interval for sizing memory pools
63 #define PV2WAY_TSC_MIN_T401_INCOMING 100
64
TSC_324m(TPVLoopbackMode aLoopbackMode)65 OSCL_EXPORT_REF TSC_324m::TSC_324m(TPVLoopbackMode aLoopbackMode)
66 : TSC(),
67 OsclActiveObject(OsclActiveObject::EPriorityHigh, "TSC"),
68 Msd(NULL),
69 Ce(NULL),
70 iSrp(NULL),
71 iH245(NULL),
72 iH223(NULL),
73 iVendor(NULL),
74 iProductNumber(NULL),
75 iVersionNumber(NULL),
76 iVendorR(NULL),
77 iProductNumberR(NULL),
78 iVersionNumberR(NULL),
79 iTransmitCaps(NULL),
80 iSuppInfo(NULL),
81 iSuppInfoLen(0),
82 iLoopbackMode(aLoopbackMode),
83 iTimer(NULL),
84 iOutgoingSrpPort(NULL),
85 iIncomingSrpPort(NULL),
86 iTscSrpBuffer(NULL),
87 iLogger(NULL),
88 iTSC_324mObserver(NULL),
89 iTSCcomponent(NULL),
90 iTSCblc(iTSCstatemanager),
91 iTSClc(iTSCstatemanager),
92 iTSCcapability(iTSCstatemanager),
93 iComponentRegistry(iTSCstatemanager,
94 iTSCcapability,
95 iTSClc,
96 iTSCblc,
97 iTSCclc,
98 iTSCmt)
99 {
100 iLogger = PVLogger::GetLoggerObject("3g324m.h245user");
101
102 iTSCcomponent = NULL;
103
104 AddToScheduler();
105
106 SetDispatchTable();
107
108 iDisconnectInitiator = EPVT_NONE;
109 iConnectFailReason = EPVT_Failed;
110
111 iOutgoingSrpPort = NULL;
112 iIncomingSrpPort = NULL;
113
114 iTscSrpBuffer = NULL;
115 iCurrentCmdId = 1;
116 iInitialized = false;
117 iInitializedComponent = false;
118 iEnableWnsrp = true;
119 iCmdQueue.Construct(PVMF_CMD_ID_START, PVMF_CMD_QUEUE_RESERVE);
120 iPendingCmdQueue.Construct(PVMF_CMD_ID_START, PVMF_CMD_QUEUE_RESERVE);
121 }
122
~TSC_324m()123 TSC_324m::~TSC_324m()
124 {
125 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
126 (0, "TSC_324m::~TSC_324m"));
127 ResetTsc();
128 }
129
SetInitialValues()130 void TSC_324m::SetInitialValues()
131 {
132 initVarsLocal();
133 initVarsSession();
134 iInitialized = true;
135 }
136
initVarsLocal()137 void TSC_324m::initVarsLocal()
138 {
139 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
140 (0, "TSC_324m::initVarsLocal"));
141
142 if (iTransmitCaps)
143 {
144 OSCL_DEFAULT_FREE(iTransmitCaps);
145 iTransmitCaps = NULL;
146 }
147
148
149 iSendRme = false;
150 iCsupSeq = 0;
151 iRequestMaxMuxPduSize = H223_MAX_DEMUX_PDU_SIZE;
152
153 iPendingCmdQueue.Construct(1, 5);
154
155 iOutgoingPduType = H223_PDU_COMBINED;
156
157 iEndSessionTimeout = DEFAULT_END_SESSION_TIMEOUT;
158
159 iTimerValues.iT101 = iTimerValues.iT103 = iTimerValues.iT104 =
160 iTimerValues.iT105 = iTimerValues.iT106 = iTimerValues.iT107 =
161 iTimerValues.iT108 = iTimerValues.iT109 = TSC_SE_TIMEOUT_DEFAULT;
162 iT401 = T401_DEFAULT; /* SRP */
163 iN100 = N100_DEFAULT; /* H245 */
164 iN401 = N401_DEFAULT; /* SRP */
165 iCeRetries = iN100; /* Num CE retries left */
166
167 iEnableWnsrp = true;
168
169 iMultiplexingDelayMs = 0;
170 iInLogicalChannelBufferingMs = 0;
171 iOutLogicalChannelBufferingMs = 0;
172
173 iTSCstatemanager.InitVarsLocal();
174 iTSCcapability.InitVarsLocal();
175 if (iTSCcomponent)
176 {
177 iTSCcomponent->InitVarsLocal();
178 }
179 }
180
initVarsSession()181 void TSC_324m::initVarsSession()
182 {
183 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
184 (0, "TSC_324m::initVarsSession"));
185 iTerminalStatus = Phase0_Idle; /* Terminal Status */
186
187
188 iDisconnectInitiator = EPVT_NONE;
189 iConnectFailReason = EPVT_Failed;
190
191 iMaxMuxPduCapabilityR = false;
192
193 /* Terminal ID for vendor identification */
194 /* Local terminal id */
195 if (iVendorR)
196 {
197 OSCL_DELETE(iVendorR);
198 }
199 if (iProductNumberR)
200 {
201 OSCL_DEFAULT_FREE(iProductNumberR);
202 }
203 if (iVersionNumberR)
204 {
205 OSCL_DEFAULT_FREE(iVersionNumberR);
206 }
207 iVendorR = NULL;
208 iProductNumberR = NULL;
209 iProductNumberLenR = 0;
210 iVersionNumberR = NULL;
211 iVersionNumberLenR = 0;
212
213 iH223Level = TSC_H223_LEVEL_DEFAULT;
214
215 iMuxTableUpdateRequired = false;
216
217 if (iSuppInfo)
218 {
219 OSCL_DEFAULT_FREE(iSuppInfo);
220 iSuppInfo = NULL;
221 iSuppInfoLen = 0;
222 }
223
224
225 iCeRetries = iN100; /* Num CE retries left */
226
227
228 /* Initialized RTD values */
229 iNumRtdRequests = 0;
230 iRtdMin = TSC_BIG_UINT32;
231 iRtdMax = 0;
232 iRtdAve = 0;
233
234 iTSCstatemanager.InitVarsSession();
235 iTSCmt.InitVarsSession();
236 iTSCcapability.InitVarsSession();
237 if (iTSCcomponent)
238 {
239 iTSCcomponent->InitVarsSession();
240 }
241 }
242
IgnoreH245Callbacks()243 void TSC_324m::IgnoreH245Callbacks()
244 {
245 if (!iH245)
246 {
247 return;
248 }
249 iH245->SetObserver(NULL);
250 Msd->SetObserver(NULL);
251 Ce->SetObserver(NULL);
252 }
253
InitComponent()254 void TSC_324m::InitComponent()
255 {
256 #ifdef MEM_TRACK
257 printf("\nMemory Stats before TSC Component Init\n");
258 MemStats();
259 #endif
260 if (!iTSCcomponent)
261 {
262 PVInterface *componentInterface;
263 // QueryInterface sets iTSCcomponent
264 QueryInterface(0, PVUuidH324ComponentInterface, (PVInterface*&)componentInterface);
265 if (!iTSCcomponent)
266 {
267 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
268 (0, "TSC_324m::InitComponent- unable to create component"));
269 OSCL_LEAVE(PVMFFailure);
270 }
271 iTSCcomponent->InitVarsLocal();
272 iTSCcomponent->InitVarsSession();
273 }
274 if (iTSCcomponent &&
275 !iInitializedComponent &&
276 iH245 &&
277 iH223)
278 {
279 iTSCcomponent->SetMembers(iH245, iH223, iObserver);
280 iTSCcomponent->InitTsc();
281 iInitializedComponent = true;
282 }
283 #ifdef MEM_TRACK
284 printf("\nMemory Stats after TSC Component Init\n");
285 MemStats();
286 #endif
287 }
288
InitTsc()289 TPVStatusCode TSC_324m::InitTsc()
290 {
291 #ifdef MEM_TRACK
292 printf("\nMemory Stats before TSC Init\n");
293 MemStats();
294 #endif
295 int error;
296 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
297 (0, "TSC: InitTsc"));
298
299 if (!iInitialized)
300 {
301 SetInitialValues();
302 }
303
304 // Allocate stack elements.
305 iH245 = OSCL_NEW(H245, ());
306 iH245->SetObserver(this);
307
308 iSrp = OSCL_NEW(SRP, ());
309 iSrp->SetObserver(this);
310
311 iH223 = OSCL_NEW(CPVH223Multiplex, (iLoopbackMode));
312 iH223->SetObserver(this);
313
314
315
316 iTSClc.SetH245(iH245);
317 iTSCblc.SetH245(iH245);
318 iTSCclc.SetH245(iH245);
319
320 InitComponent();
321
322
323 iTSCcapability.SetMembers(iTSCcomponent);
324 iTSCmt.SetMembers(iH245, iH223, iTSCcomponent);
325 iH223->SetClock(iClock);
326 iH223->Open();
327
328 // set direct connection to MSD SE
329 Msd = iH245->GetMSD();
330 Msd->SetObserver(this);
331
332 // set direct connection to CE SE
333 Ce = iH245->GetCE();
334 Ce->SetObserver(this);
335
336 OSCL_TRY(error, iTscSrpBuffer = TscSrpBuffer::NewL());
337 if (error)
338 {
339 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR,
340 (0, "TSC: InitTsc, tscsrpbuffer allocation failed", error));
341 }
342
343 iTimer = OSCL_NEW(OsclTimer<OsclMemAllocator>,
344 (PV_2WAY_TSC_TIMER_ID, PV_2WAY_TSC_TIMER_INTERVAL));
345 //OSCL_TRAP_NEW(iTimer, OsclTimer<OsclMemAllocator>, (PV_2WAY_TSC_TIMER_ID, PV_2WAY_TSC_TIMER_INTERVAL) );
346 iTimer->SetObserver(this);
347
348 #ifdef MEM_TRACK
349 printf("\nMemory Stats after TSC Init\n");
350 MemStats();
351 #endif
352
353 return EPVT_Success;
354 }
355
ResetTsc()356 TPVStatusCode TSC_324m::ResetTsc()
357 {
358 TPVStatusCode ret = EPVT_Success;
359 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
360 (0, "TSC: Reset request."));
361
362 if (iTSCcomponent)
363 {
364 iTSCcomponent->ResetTsc();
365 iTSCstatemanager.WriteState(TSC_CE_RECEIVE, NOT_STARTED);
366 iTSCstatemanager.WriteState(TSC_CE_SEND, NOT_STARTED);
367 iInitializedComponent = false; // TSC Component
368 }
369
370 if (iSrp)
371 {
372 if (iSrp->RequestULPort(SRP_INPUT_PORT_TAG))
373 iSrp->RequestULPort(SRP_INPUT_PORT_TAG)->Disconnect();
374
375 if (iSrp->RequestULPort(SRP_OUTPUT_PORT_TAG))
376 iSrp->RequestULPort(SRP_OUTPUT_PORT_TAG)->Disconnect();
377
378 iSrp->SrpStop();
379 }
380
381 if (iTscSrpBuffer)
382 {
383 iTscSrpBuffer->GetLLPort(TSCSRPBUFFER_INPUT_PORT_TAG)->Disconnect();
384 iTscSrpBuffer->GetLLPort(TSCSRPBUFFER_OUTPUT_PORT_TAG)->Disconnect();
385 }
386
387 if (iH245)
388 {
389 iH245->UnBind();
390 }
391
392 if (iIncomingSrpPort)
393 {
394 iIncomingSrpPort->Disconnect();
395 iIncomingSrpPort = NULL;
396 }
397
398 if (iOutgoingSrpPort)
399 {
400 iOutgoingSrpPort->Disconnect();
401 iOutgoingSrpPort = NULL;
402 }
403
404 if (iH223)
405 {
406 H223IncomingChannelPtr incoming_control_channel;
407 PVMFStatus aStatus = iH223->GetIncomingChannel((TPVChannelId)0,
408 incoming_control_channel);
409 if (aStatus == PVMFSuccess)
410 {
411 incoming_control_channel->Disconnect();
412 }
413 else
414 {
415 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
416 (0, "TSC_324m::ResetTsc Error - Failed to lookup incoming logical channel %d", 0));
417 }
418
419 H223OutgoingChannelPtr outgoing_control_channel;
420 aStatus = iH223->GetOutgoingChannel((TPVChannelId)0, outgoing_control_channel);
421 if (aStatus == PVMFSuccess)
422 {
423 outgoing_control_channel->Disconnect();
424 }
425 else
426 {
427 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
428 (0, "TSC_324m::ResetTsc Error - Failed to lookup outgoing logical channel %d", 0));
429 }
430 }
431
432 //Shutdown stack elements.
433
434 if (iTransmitCaps)
435 {
436 OSCL_DEFAULT_FREE(iTransmitCaps);
437 iTransmitCaps = NULL;
438 }
439
440 if (iVendor)
441 {
442 delete iVendor;
443 iVendor = NULL;
444 }
445
446 if (iVendorR)
447 {
448 delete iVendorR;
449 iVendorR = NULL;
450 }
451
452 if (iProductNumber)
453 {
454 OSCL_DEFAULT_FREE(iProductNumber);
455 iProductNumber = NULL;
456 }
457
458 if (iProductNumberR)
459 {
460 OSCL_DEFAULT_FREE(iProductNumberR);
461 iProductNumberR = NULL;
462 }
463
464 if (iVersionNumber)
465 {
466 OSCL_DEFAULT_FREE(iVersionNumber);
467 iVersionNumber = NULL;
468 }
469
470 if (iVersionNumberR)
471 {
472 OSCL_DEFAULT_FREE(iVersionNumberR);
473 iVersionNumberR = NULL;
474 }
475
476
477 if (iTimer)
478 {
479 iTimer->Clear();
480 OSCL_DELETE(iTimer);
481 iTimer = NULL;
482 }
483
484
485 if (iTSCcomponent)
486 {
487 OSCL_DELETE(iTSCcomponent);
488 iTSCcomponent = NULL;
489 }
490
491
492 if (iH223)
493 {
494 iH223->Close();
495 DeallocateH223Mux(iH223);
496 iH223 = NULL;
497 }
498
499 if (iTscSrpBuffer)
500 {
501 OSCL_DELETE(iTscSrpBuffer);
502 iTscSrpBuffer = NULL;
503 }
504
505 if (iSrp)
506 {
507 iSrp->SrpReset();
508 OSCL_DELETE(iSrp);
509 iSrp = NULL;
510 }
511
512 if (iH245)
513 {
514 OSCL_DELETE(iH245);
515 iH245 = NULL;
516 }
517
518 iInitialized = false; //TSC node
519
520 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
521 (0, "TSC: Reset request - done"));
522 #ifdef MEM_TRACK
523 printf("\nMemory Stats after TSC Reset\n");
524 MemStats();
525 #endif
526 return ret;
527 }
528
SetOutgoingBitrate(int32 bitrate)529 TPVStatusCode TSC_324m::SetOutgoingBitrate(int32 bitrate)
530 {
531 iH223->SetBitrate(bitrate);
532 return EPVT_Success;
533 }
534
SetTimerRes(uint32 timer_res)535 TPVStatusCode TSC_324m::SetTimerRes(uint32 timer_res)
536 {
537 return iH223->SetTimerRes(timer_res);
538 }
539
SetTerminalParam(CPVTerminalParam * params)540 TPVStatusCode TSC_324m::SetTerminalParam(CPVTerminalParam* params)
541 {
542 CPVH324MParam* h324params = (CPVH324MParam*)params;
543
544 iSendRme = h324params->iSendRme;
545 iRequestMaxMuxPduSize = h324params->iRequestMaxMuxPduSize;
546 iTSCcomponent->SetTerminalParam(*h324params);
547 iTSCstatemanager.SetTerminalParam(params);
548 return EPVT_Success;
549 }
550
GetTerminalParam()551 CPVTerminalParam* TSC_324m::GetTerminalParam()
552 {
553 CPVH223MuxParam h223Param;
554 CPVH324MParam* h324param = new CPVH324MParam();
555 iTSCcomponent->GetTerminalParam(*h324param);
556 h324param->iMasterSlave = (TPVMasterSlave)iTSCstatemanager.ReadState(TSC_MSD_DECISION);
557 h324param->SetH223Param(&h223Param);
558 return h324param;
559 }
560
561 TPVStatusCode
Connect(uint16 info_len,uint8 * info_buf)562 TSC_324m::Connect(uint16 info_len, uint8* info_buf)
563 {
564 PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iLogger, PVLOGMSG_NOTICE,
565 (0, "TSC_324m::Connect"));
566 TPVStatusCode ret = EPVT_Pending;
567
568 iMuxTableUpdateRequired = false;
569 iStopCmd = NULL;
570 iTerminalStatus = Phase0_Idle;
571
572 iTSCmt.ClearVars();
573
574 // moved stuff to component
575
576 if (!iTSCcomponent->Connect1LevelKnown())
577 {
578 iH223Level = H223_LEVEL_UNKNOWN;
579 }
580 ResetStats();
581
582 iH245->Reset();
583 iH245->SetTimers(iTimerValues);
584
585
586 // set direct connection to MSD SE
587 Msd = iH245->GetMSD();
588 Msd->SetObserver(this);
589
590 // set direct connection to CE SE
591 Ce = iH245->GetCE();
592 Ce->SetObserver(this);
593
594 if (iSuppInfo)
595 {
596 OSCL_DEFAULT_FREE(iSuppInfo);
597 iSuppInfo = NULL;
598 iSuppInfoLen = 0;
599 }
600
601 if (info_len)
602 {
603 iSuppInfo = (uint8*)OSCL_DEFAULT_MALLOC(info_len);
604 iSuppInfoLen = info_len;
605 oscl_memcpy(iSuppInfo, info_buf, info_len);
606 }
607 iTimer->Clear();
608
609 CPVH223MuxParam level_set;
610
611 // Initialize the mux and wait for completion. Performs level setup
612 if (iH223Level != H223_LEVEL_UNKNOWN)
613 {
614 iH223->SetMultiplexLevel(iH223Level);
615 }
616 iH223->SetMultiplexingDelayMs((uint16)iMultiplexingDelayMs);
617 iH223->SetLogicalChannelBufferingMs(iInLogicalChannelBufferingMs,
618 iOutLogicalChannelBufferingMs);
619 iH223->SetClock(iClock);
620
621 S_H223LogicalChannelParameters lcnParams;
622 lcnParams.segmentableFlag = true;
623 lcnParams.adaptationLayerType.index = 1;
624 H223ChannelParam in_channel_params(0,
625 &lcnParams,
626 TSC_MAX_CONTROL_CHANNEL_BITRATE_BPS,
627 PV2WAY_TSC_MIN_T401_INCOMING);
628 H223ChannelParam out_channel_params(0,
629 &lcnParams,
630 TSC_MAX_CONTROL_CHANNEL_BITRATE_BPS,
631 iT401*100);
632
633 iH223->OpenChannel(OUTGOING, 0, &out_channel_params);
634 iH223->OpenChannel(INCOMING, 0, &in_channel_params);
635
636
637 ConfigureSrp(iH223Level);
638
639 // Reset global states (RAN-MS)
640 iTSCstatemanager.StateInitialize(); // Reset call-setup states
641
642 iTerminalStatus = PhaseD_CSUP;
643
644 iTSCcomponent->Connect2();
645 return ret;
646 }
647
SetClock(PVMFMediaClock * aClock)648 void TSC_324m::SetClock(PVMFMediaClock* aClock)
649 {
650 iClock = aClock;
651 }
652
DataReceptionStart()653 void TSC_324m::DataReceptionStart()
654 {
655 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
656 (0, "TSC_324m::DataReceptionStart"));
657 /* Start timer for Level Setup countdown */
658 int32 levelSetupTimeoutInfo = 0;
659 if (iTSCcomponent->IsEnabled())
660 {
661 levelSetupTimeoutInfo = 1; // Level setup can commence again if it fails the first time
662 }
663 iTimer->Request(PV_TSC_LEVEL_SETUP_TIMER_ID, levelSetupTimeoutInfo,
664 DEFAULT_TCS_LEVEL_SETUP_TIMEOUT_SECONDS, this);
665 }
666
MuxSetupComplete(PVMFStatus status,TPVH223Level level)667 void TSC_324m::MuxSetupComplete(PVMFStatus status, TPVH223Level level)
668 {
669 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
670 (0, "TSC_324m::MuxSetupComplete status=%d, level=%d",
671 status, level));
672 iTimer->Cancel(PV_TSC_LEVEL_SETUP_TIMER_ID);
673
674 /* Reconfigure SRP if multiplex level 0 is negotiated starting from a higher level */
675 if (level == H223_LEVEL0 && level != iH223Level)
676 {
677 ConfigureSrp(level);
678 }
679 iH223Level = level;
680 if (status == PVMFPending)
681 {
682 return;
683 }
684 if (status != PVMFSuccess)
685 {
686 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
687 (0, "TSC_324m::MuxSetupComplete Mux setup failed."));
688 SignalCsupComplete(status);
689 return;
690 }
691
692 iTSCcomponent->MuxSetupComplete(status, level);
693
694 OpenSession();
695 iTimer->Request(PV_TSC_RTD_TIMER_ID, PV_TSC_RTD_TIMER_ID, DEFAULT_RTD_TIMER_SECONDS, this, false);
696 /* Start timer for TCS countdown */
697 if (iTSCstatemanager.ReadState(TSC_CE_RECEIVE) != COMPLETE)
698 {
699 iTimer->Request(PV_TSC_TCS_RECEIVE_TIMER_ID, PV_TSC_TCS_RECEIVE_TIMER_ID,
700 DEFAULT_TCS_RECEIVE_TIMEOUT_SECONDS, this);
701 }
702 else
703 {
704 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
705 (0, "TSC_324m::MuxSetupComplete TCS received before MuxSetupComplete."));
706 }
707 }
708
MuxCloseComplete()709 void TSC_324m::MuxCloseComplete()
710 {
711 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
712 (0, "TSC_324m: Mux close complete - status(%d).", iTerminalStatus));
713
714 /* All logical channels closed */
715 iTerminalStatus = PhaseF_End;
716
717 iH245->Reset();
718 // set direct connection to MSD SE
719 Msd = iH245->GetMSD();
720 Msd->SetObserver(this);
721
722 // set direct connection to CE SE
723 Ce = iH245->GetCE();
724 Ce->SetObserver(this);
725
726 iH223->CloseChannel(OUTGOING, 0);
727 iH223->CloseChannel(INCOMING, 0);
728 }
729
MuxErrorOccurred(TPVDirection direction,TPVMuxComponent component,PVMFStatus error,uint8 * info,uint info_len)730 void TSC_324m::MuxErrorOccurred(TPVDirection direction,
731 TPVMuxComponent component,
732 PVMFStatus error,
733 uint8* info,
734 uint info_len)
735 {
736 OSCL_UNUSED_ARG(info_len);
737 OSCL_UNUSED_ARG(info);
738 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
739 (0, "TSC_324m::MuxErrorOccurred - direction(%d), component(%d), error(%d)",
740 direction, component, error));
741 TPVChannelId id = CHANNEL_ID_UNKNOWN;
742 if (info && component == PV_MUX_COMPONENT_LOGICAL_CHANNEL)
743 {
744 id = *((TPVChannelId*)info);
745
746 if (!iTSCcomponent->HasOlc(direction, id))
747 {
748 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
749 (0, "TSC_324m::MuxErrorOccurred - Failed to lookup channel info, lcn=%d",
750 id));
751 return;
752 }
753 if (direction == INCOMING)
754 {
755 H223IncomingChannelPtr incoming_lcn;
756 PVMFStatus aStatus = iH223->GetIncomingChannel(id, incoming_lcn);
757 if (aStatus == PVMFSuccess)
758 {
759 if (!incoming_lcn->IsConnected())
760 {
761 RequestFrameUpdate(incoming_lcn);
762 }
763 }
764 else
765 {
766 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
767 (0, "TSC_324m::MuxErrorOccurred - Failed to lookup incoming channel, lcn=%d",
768 id));
769 return;
770 }
771 }
772 }
773
774 PVMFAsyncEvent aEvent(PVMFInfoEvent, error, this, NULL);
775 uint8* buf = aEvent.GetLocalBuffer();
776 buf[0] = (uint8)PV_H324COMPONENT_H223;
777 buf[1] = (uint8)component;
778 buf[2] = (uint8)direction;
779 if (component == PV_MUX_COMPONENT_LOGICAL_CHANNEL)
780 {
781 *((TPVChannelId*)(buf + 4)) = id;
782 }
783 //iInfoObserver->HandleNodeInformationalEvent(aEvent);
784 }
785
SkewDetected(TPVChannelId lcn1,TPVChannelId lcn2,uint32 skew)786 void TSC_324m::SkewDetected(TPVChannelId lcn1, TPVChannelId lcn2, uint32 skew)
787 {
788 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
789 (0, "TSC_324m::SkewDetected - lcn1=%d, lcn2=%d, skew=%d",
790 lcn1, lcn2, skew));
791 Tsc_IdcSkew(lcn1, lcn2, (uint16)skew);
792 }
793
LcnDataDetected(TPVChannelId lcn)794 void TSC_324m::LcnDataDetected(TPVChannelId lcn)
795 {
796 iTSCcomponent->LcnDataDetected(lcn);
797 }
798
ReceivedFormatSpecificInfo(TPVChannelId channel_id,uint8 * fsi,uint32 fsi_len)799 void TSC_324m::ReceivedFormatSpecificInfo(TPVChannelId channel_id,
800 uint8* fsi,
801 uint32 fsi_len)
802 {
803 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
804 (0, "TSC_324m::ReceivedFormatSpecificInfo lcn=%d, len=%d",
805 channel_id, fsi_len));
806 iTSCcomponent->ReceivedFormatSpecificInfo(channel_id, fsi, fsi_len);
807 }
808
Disconnect()809 TPVStatusCode TSC_324m::Disconnect()
810 {
811 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
812 (0, "TSC: Disconnect request."));
813 //LogStats(OUTGOING);
814 //LogStats(INCOMING);
815
816 TPVStatusCode ret = EPVT_Success;
817
818 iDisconnectInitiator |= EPVT_LOCAL;
819
820 iTimer->Clear();
821
822 StopSrp();
823 iH223->Stop();
824
825 MuxCloseComplete();
826 while (iIncomingChannels.size())
827 {
828 H223ChannelParam* param = iIncomingChannels.back();
829 iIncomingChannels.pop_back();
830 delete param;
831 }
832
833 initVarsSession();
834 return ret;
835 }
836
Abort()837 TPVStatusCode TSC_324m::Abort()
838 {
839 // iMutex->Lock();
840 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
841 (0, "TSC: Abort."));
842 //LogStats(OUTGOING);
843 //LogStats(INCOMING);
844 TPVStatusCode ret = EPVT_Success;
845
846 iDisconnectInitiator |= EPVT_LOCAL;
847
848 if (iSuppInfo)
849 {
850 OSCL_DEFAULT_FREE(iSuppInfo);
851 iSuppInfo = NULL;
852 iSuppInfoLen = 0;
853 iTimer->Clear();
854 }
855
856 SessionClose_Comm();
857
858 iSrp->SrpStop();
859
860 /* All logical channels closed */
861 iTerminalStatus = PhaseF_End;
862
863 iH245->Reset();
864 // set direct connection to MSD SE
865 Msd = iH245->GetMSD();
866 Msd->SetObserver(this);
867
868 // set direct connection to CE SE
869 Ce = iH245->GetCE();
870 Ce->SetObserver(this);
871
872 initVarsSession();
873
874 // iMutex->Unlock();
875 return ret;
876 }
877
878 /* Handle control events depending on state */
879 /*
880 Phase0_Idle = 1 ,
881 PhaseA ,
882 PhaseB ,
883 PhaseC ,
884 PhaseD_CSUP , // Call Setup
885 PhaseE_Comm , // Ongoing Communication
886 PhaseF_Clc , // Closing all outgoing LCNs
887 PhaseF_End , // End of Session
888 PhaseG_Dis
889 */
Handle(PS_ControlMsgHeader msg)890 void TSC_324m::Handle(PS_ControlMsgHeader msg)
891 {
892 uint32 EventNo; /* EventNo */
893 uint32 Cnt; /* Counter */
894 DISPATCH_PTR func_ptr = NULL;
895 bool handled = false;
896
897 // iMutex->Lock();
898
899 /* Event Receive; a non blocking call */
900 EventNo = Tsc_EventReceive(msg);
901
902 for (Cnt = 0; iDispatchTable[Cnt].Module != NULL; Cnt++)
903 {
904 if (iDispatchTable[Cnt].Status == iTerminalStatus && iDispatchTable[Cnt].Event == EventNo)
905 {
906 func_ptr = iDispatchTable[Cnt].Module;
907 handled = true;
908 (this->*func_ptr)(msg);
909 break;
910 }
911 }
912 if (!handled)
913 {
914 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
915 (0, "TSC_324m: Failed to handle control message - state(%d), event no(%d).",
916 iTerminalStatus, EventNo));
917 }
918
919 return;
920 }
921
RequestFrameUpdate(PVMFPortInterface * port)922 TPVStatusCode TSC_324m::RequestFrameUpdate(PVMFPortInterface* port)
923 {
924 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
925 (0, "TSC_324m::RequestFrameUpdate"));
926
927 if (iTSCstatemanager.ReadState(TSC_CE_SEND) == NOT_STARTED)
928 {
929 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
930 (0, "TSC_324m::RequestFrameUpdate ERROR - TCS not yet requested, tcs state=NOT_STARTED"));
931 return EPVT_ErrorInvalidState;
932 }
933
934 H223IncomingChannel *channel = OSCL_STATIC_CAST(H223IncomingChannel *, port);
935 if (channel == NULL)
936 {
937 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
938 (0, "TSC: RequestFrameUpdate - Null port"));
939 return EPVT_Failed;
940 }
941 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
942 (0, "TSC_324m::RequestFrameUpdate lcn=%d", channel->GetLogicalChannelNumber()));
943 OlcParam* param = iTSCcomponent->FindOlcGivenChannel(INCOMING, channel->GetLogicalChannelNumber());
944 if (param == NULL)
945 {
946 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
947 (0, "TSC_324m: RequestFrameUpdate - Failed to lookup channel param"));
948 return EPVT_Failed;
949 }
950 if (param->GetState() != OLC_ESTABLISHED)
951 {
952 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
953 (0, "TSC_324m: RequestFrameUpdate - Channel not in established state. Not sending request."));
954 return EPVT_Failed;
955 }
956
957 CmdMisc(EVideoFastUpdatePicture, channel->GetLogicalChannelNumber());
958 return EPVT_Success;
959 }
960
RequestMaxMuxPduSize(unsigned aPduSize)961 TPVStatusCode TSC_324m::RequestMaxMuxPduSize(unsigned aPduSize)
962 {
963 if ((iTerminalStatus != PhaseD_CSUP) && (iTerminalStatus != PhaseE_Comm))
964 {
965 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
966 (0, "TSC_324m: ERROR - RequestMaxMuxPduSize - invalid state(%d)",
967 iTerminalStatus));
968 return EPVT_ErrorInvalidState;
969 }
970 CmdMisc(EMaxH223MUXPDUsize, CHANNEL_ID_UNKNOWN&0xFFFF, aPduSize);
971 return EPVT_Success;
972 }
973
SetTerminalType(uint8 aTType)974 OSCL_EXPORT_REF TPVStatusCode TSC_324m::SetTerminalType(uint8 aTType)
975 {
976 if (Msd)
977 {
978 Msd->SetTerminalType(aTType);
979 return EPVT_Success;
980 }
981 else
982 {
983 return EPVT_Failed;
984 }
985 }
986
SetEndSessionTimeout(uint32 timeout)987 OSCL_EXPORT_REF void TSC_324m::SetEndSessionTimeout(uint32 timeout)
988 {
989 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
990 (0, "TSC_324m::SetEndSessionTimeout timeout(%d)", timeout));
991 iEndSessionTimeout = timeout;
992 if (iStopCmd != 0)
993 {
994 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
995 (0, "TSC_324m::SetEndSessionTimeout Already disconnectiing",
996 timeout));
997 }
998 }
999
SetTimerCounter(TPVH324TimerCounter aTimerCounter,uint8 aSeries,uint32 aSeriesOffset,uint32 aValue)1000 OSCL_EXPORT_REF void TSC_324m::SetTimerCounter(TPVH324TimerCounter aTimerCounter,
1001 uint8 aSeries, uint32 aSeriesOffset, uint32 aValue)
1002 {
1003 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1004 (0, "TSC_324m::SetTimerCounter timer/counter(%d), series(%d), offset(%d), value(%d)",
1005 aTimerCounter, aSeries, aSeriesOffset, aValue));
1006 if (aTimerCounter == EH324Timer)
1007 {
1008 switch (aSeries)
1009 {
1010 case 1:
1011 {
1012 switch (aSeriesOffset)
1013 {
1014 case 1:
1015 iTimerValues.iT101 = aValue;
1016 break;
1017 case 3:
1018 iTimerValues.iT103 = aValue;
1019 break;
1020 case 4:
1021 iTimerValues.iT104 = aValue;
1022 break;
1023 case 5:
1024 iTimerValues.iT105 = aValue;
1025 break;
1026 case 6:
1027 iTimerValues.iT106 = aValue;
1028 break;
1029 case 7:
1030 iTimerValues.iT107 = aValue;
1031 break;
1032 case 8:
1033 iTimerValues.iT108 = aValue;
1034 break;
1035 case 9:
1036 iTimerValues.iT109 = aValue;
1037 break;
1038 default:
1039 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1040 (0, "TSC_324m::SetTimerCounter Error - Offset not supported for series"));
1041 }
1042 }
1043 break;
1044 case 4:
1045 {
1046 switch (aSeriesOffset)
1047 {
1048 case 1:
1049 iT401 = aValue;
1050 break;
1051 default:
1052 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1053 (0, "TSC_324m::SetTimerCounter Error - Offset not supported for series"));
1054 }
1055 }
1056 break;
1057 default:
1058 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1059 (0, "TSC_324m::SetTimerCounter Error - Series not supported"));
1060 }
1061 }
1062 else if (aTimerCounter == EH324Counter)
1063 {
1064 switch (aSeries)
1065 {
1066 case 1:
1067 {
1068 switch (aSeriesOffset)
1069 {
1070 case 0:
1071 iN100 = aValue;
1072 iTSCstatemanager.SetN100(iN100);
1073 break;
1074 default:
1075 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1076 (0, "TSC_324m::SetTimerCounter Error - Offset not supported for series"));
1077 }
1078 }
1079 break;
1080 case 4:
1081 {
1082 switch (aSeriesOffset)
1083 {
1084 case 1:
1085 iN401 = aValue;
1086 break;
1087 default:
1088 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1089 (0, "TSC_324m::SetTimerCounter Error - Offset not supported for series"));
1090 }
1091 }
1092 break;
1093 default:
1094 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1095 (0, "TSC_324m::SetTimerCounter Error - Series not supported"));
1096 }
1097 }
1098 }
1099
SetVideoResolutions(TPVDirection dir,Oscl_Vector<PVMFVideoResolutionRange,OsclMemAllocator> & resolutions)1100 OSCL_EXPORT_REF void TSC_324m::SetVideoResolutions(TPVDirection dir,
1101 Oscl_Vector<PVMFVideoResolutionRange, OsclMemAllocator>& resolutions)
1102 {
1103 iTSCcapability.SetVideoResolutions(dir, resolutions);
1104 }
1105
SetDispatchTable()1106 void TSC_324m::SetDispatchTable()
1107 {
1108 const uint16 sizeofDispatchTable = 56;
1109 S_DispatchTable aDispatchTable[sizeofDispatchTable] =
1110 {
1111 /* ----------------------------------------- */
1112 /* ---------- CALL SETUP EVENTS ------------ */
1113 /* ----------------------------------------- */
1114 { OSCL_FUNCTION_PTR(TSC_324m::Status04Event22) , PhaseD_CSUP , 22 }, //E_PtvId_Mt_Trf_Idc
1115 { OSCL_FUNCTION_PTR(TSC_324m::Status04Event23) , PhaseD_CSUP , 23 }, //E_PtvId_Mt_Trf_Cfm
1116 { OSCL_FUNCTION_PTR(TSC_324m::Status04Event24) , PhaseD_CSUP , 24 }, //E_PtvId_Mt_Rjt_Idc
1117 { OSCL_FUNCTION_PTR(TSC_324m::ModeRequestIndication) , PhaseD_CSUP , 28 }, //E_PtvId_Mr_Trf_Idc
1118 { OSCL_FUNCTION_PTR(TSC_324m::EndSessionRecv) , PhaseD_CSUP , 37 }, //E_PtvId_Cmd_Es_Cfm
1119 { OSCL_FUNCTION_PTR(TSC_324m::VendorIdRecv) , PhaseD_CSUP, 56},
1120 { OSCL_FUNCTION_PTR(TSC_324m::UserInputIndicationRecv), PhaseD_CSUP, 57}, //E_PtvId_Idc_Ui_Cfm
1121 { OSCL_FUNCTION_PTR(TSC_324m::LcEtbIdc) , PhaseD_CSUP , 9 }, //E_PtvId_Lc_Etb_Idc
1122 { OSCL_FUNCTION_PTR(TSC_324m::LcRlsIdc) , PhaseD_CSUP , 11 }, //E_PtvId_Lc_Rls_Idc
1123 { OSCL_FUNCTION_PTR(TSC_324m::BlcEtbIdc) , PhaseD_CSUP , 14 }, //E_PtvId_Lc_Etb_Idc
1124 { OSCL_FUNCTION_PTR(TSC_324m::BlcRlsIdc) , PhaseD_CSUP , 16 }, //E_PtvId_Lc_Rls_Idc
1125 { OSCL_FUNCTION_PTR(TSC_324m::FunctionNotSupportedIndicationReceived) , PhaseD_CSUP , 49}, //E_PtvId_Idc_Fns_Cfm
1126 { OSCL_FUNCTION_PTR(TSC_324m::FlowControlCommandReceived) , PhaseD_CSUP , 53 }, //E_PtvId_Cmd_Fc
1127 { OSCL_FUNCTION_PTR(TSC_324m::SendTerminalCapabilitySet) , PhaseD_CSUP , 52 }, //E_PtvId_Cmd_Stcs_Cfm
1128 { OSCL_FUNCTION_PTR(TSC_324m::MiscCmdRecv) , PhaseD_CSUP , 54 }, //E_PtvId_Cmd_Mscl_Cfm
1129 { OSCL_FUNCTION_PTR(TSC_324m::MiscIndicationRecv), PhaseD_CSUP, 58}, //E_PtvId_Idc_Mscl_Cfm
1130 { OSCL_FUNCTION_PTR(TSC_324m::SkewIndicationRecv), PhaseD_CSUP, 59}, //E_PtvId_Idc_H223skw_Cfm
1131 { OSCL_FUNCTION_PTR(TSC_324m::FlowControlIndicationReceived) , PhaseD_CSUP , 60 }, //E_PtvId_Cmd_Fc
1132 // { InternalError_CSUP, PhaseD_CSUP , 38 }, //H245_INTERNAL_ERROR
1133 /* ----------------------------------------- */
1134 /* --------- ONGOING COMM EVENTS ----------- */
1135 /* ----------------------------------------- */
1136 { OSCL_FUNCTION_PTR(TSC_324m::LcEtbIdc) , PhaseE_Comm , 9 }, //E_PtvId_Lc_Etb_Idc
1137 { OSCL_FUNCTION_PTR(TSC_324m::LcRlsIdc) , PhaseE_Comm , 11 }, //E_PtvId_Lc_Rls_Idc
1138 { OSCL_FUNCTION_PTR(TSC_324m::LcEtbCfm) , PhaseE_Comm , 10 }, //E_PtvId_Lc_Etb_Cfm
1139 { OSCL_FUNCTION_PTR(TSC_324m::LcRlsCfm) , PhaseE_Comm , 12 }, //E_PtvId_Lc_Rls_Cfm
1140 { OSCL_FUNCTION_PTR(TSC_324m::LcErrIdc) , PhaseE_Comm , 13 }, //E_PtvId_Lc_Err_Idc
1141 { OSCL_FUNCTION_PTR(TSC_324m::BlcEtbIdc) , PhaseE_Comm , 14 }, //E_PtvId_Blc_Etb_Idc
1142 { OSCL_FUNCTION_PTR(TSC_324m::BlcEtbCfm) , PhaseE_Comm , 15 }, //E_PtvId_Blc_Etb_Cfm
1143 { OSCL_FUNCTION_PTR(TSC_324m::BlcEtbCfm2) , PhaseE_Comm , 50 }, //E_PtvId_Blc_Etb_Cfm2
1144 { OSCL_FUNCTION_PTR(TSC_324m::BlcErrIdc) , PhaseE_Comm , 18 }, //E_PtvId_Blc_Err_Idc
1145 { OSCL_FUNCTION_PTR(TSC_324m::BlcRlsIdc) , PhaseE_Comm , 16 }, //E_PtvId_Blc_Rls_Idc
1146 { OSCL_FUNCTION_PTR(TSC_324m::BlcRlsCfm) , PhaseE_Comm , 17 }, //E_PtvId_Blc_Rls_Cfm
1147 { OSCL_FUNCTION_PTR(TSC_324m::Status08Event19) , PhaseE_Comm , 19 }, //E_PtvId_Clc_Cls_Idc
1148 { OSCL_FUNCTION_PTR(TSC_324m::Status08Event20) , PhaseE_Comm , 20 }, //E_PtvId_Clc_Cls_Cfm
1149 { OSCL_FUNCTION_PTR(TSC_324m::Status08Event21) , PhaseE_Comm , 21 }, //E_PtvId_Clc_Rjt_Idc
1150 { OSCL_FUNCTION_PTR(TSC_324m::Status04Event22) , PhaseE_Comm , 22 }, //E_PtvId_Mt_Trf_Idc
1151 { OSCL_FUNCTION_PTR(TSC_324m::Status04Event23) , PhaseE_Comm , 23 }, //E_PtvId_Mt_Trf_Cfm
1152 { OSCL_FUNCTION_PTR(TSC_324m::Status04Event24) , PhaseE_Comm , 24 }, //E_PtvId_Mt_Rjt_Idc
1153 { OSCL_FUNCTION_PTR(TSC_324m::Status08Event25) , PhaseE_Comm , 25 }, //E_PtvId_Rme_Send_Idc
1154 { OSCL_FUNCTION_PTR(TSC_324m::Status08Event26) , PhaseE_Comm , 26 }, //E_PtvId_Rme_Send_Cfm
1155 { OSCL_FUNCTION_PTR(TSC_324m::Status08Event27) , PhaseE_Comm , 27 }, //E_PtvId_Rme_Rjt_Idc
1156 { OSCL_FUNCTION_PTR(TSC_324m::ModeRequestIndication) , PhaseE_Comm , 28 }, //E_PtvId_Mr_Trf_Idc
1157 { OSCL_FUNCTION_PTR(TSC_324m::Status08Event29) , PhaseE_Comm , 29 }, //E_PtvId_Mr_Trf_Cfm
1158 { OSCL_FUNCTION_PTR(TSC_324m::Status08Event30) , PhaseE_Comm , 30 }, //E_PtvId_Mr_Rjt_Idc
1159 { OSCL_FUNCTION_PTR(TSC_324m::Status08Event31) , PhaseE_Comm , 31 }, //E_PtvId_Rtd_Trf_Cfm
1160 { OSCL_FUNCTION_PTR(TSC_324m::Status08Event32) , PhaseE_Comm , 32 }, //E_PtvId_Rtd_Exp_Idc
1161 { OSCL_FUNCTION_PTR(TSC_324m::FunctionNotSupportedIndicationReceived) , PhaseE_Comm , 49}, //E_PtvId_Idc_Fns_Cfm
1162 { OSCL_FUNCTION_PTR(TSC_324m::SendTerminalCapabilitySet) , PhaseE_Comm , 52 }, //E_PtvId_Cmd_Stcs_Cfm
1163 { OSCL_FUNCTION_PTR(TSC_324m::FlowControlCommandReceived) , PhaseE_Comm , 53 }, //E_PtvId_Cmd_Fc_Cfm
1164 { OSCL_FUNCTION_PTR(TSC_324m::MiscCmdRecv) , PhaseE_Comm , 54 }, //E_PtvId_Cmd_Mscl_Cfm
1165 { OSCL_FUNCTION_PTR(TSC_324m::Status08Event55) , PhaseE_Comm , 55 }, //E_PtvId_Cmd_Hmr_Cfm
1166 { OSCL_FUNCTION_PTR(TSC_324m::EndSessionRecv) , PhaseE_Comm , 37 }, //E_PtvId_Cmd_Es_Cfm
1167 { OSCL_FUNCTION_PTR(TSC_324m::VendorIdRecv) , PhaseE_Comm , 56},
1168 { OSCL_FUNCTION_PTR(TSC_324m::UserInputIndicationRecv), PhaseE_Comm, 57}, //E_PtvId_Idc_Ui_Cfm
1169 { OSCL_FUNCTION_PTR(TSC_324m::MiscIndicationRecv), PhaseE_Comm, 58}, //E_PtvId_Idc_Mscl_Cfm
1170 { OSCL_FUNCTION_PTR(TSC_324m::SkewIndicationRecv), PhaseE_Comm, 59}, //E_PtvId_Idc_H223skw_Cfm
1171 { OSCL_FUNCTION_PTR(TSC_324m::FlowControlIndicationReceived) , PhaseE_Comm, 60 }, //E_PtvId_Cmd_Fc
1172 /* ----------------------------------------- */
1173 /* --------- CLOSE and END EVENTS ---------- */
1174 /* ----------------------------------------- */
1175 { OSCL_FUNCTION_PTR(TSC_324m::EndSessionRecv) , PhaseF_End , 37 }, //E_PtvId_Cmd_Es_Cfm
1176
1177 { NULL , 0 , 0 }
1178 };
1179
1180 for (int n = 0; n < sizeofDispatchTable; n++)
1181 {
1182 iDispatchTable[n] = aDispatchTable[n];
1183 }
1184 }
1185
SetVendorIdInfo(TPVH245Vendor * vendor,const uint8 * pn,uint16 pn_len,const uint8 * vn,uint16 vn_len)1186 OSCL_EXPORT_REF TPVStatusCode TSC_324m::SetVendorIdInfo(TPVH245Vendor* vendor,
1187 const uint8* pn,
1188 uint16 pn_len,
1189 const uint8* vn,
1190 uint16 vn_len)
1191 {
1192 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1193 (0, "TSC_324m::SetVendorIdInfo vendor(%x), pn_len(%d), vn_len(%d)", vendor, pn_len, vn_len));
1194 if (pn && pn_len && (pn[pn_len-1] == '\0'))
1195 {
1196 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1197 (0, "TSC_324m::SetVendorIdInfo pn(%s)", pn));
1198 }
1199 if (vn && vn_len && (vn[vn_len-1] == '\0'))
1200 {
1201 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1202 (0, "TSC_324m::SetVendorIdInfo vn(%s)", vn));
1203 }
1204
1205 if (iVendor)
1206 {
1207 OSCL_DELETE(iVendor);
1208 iVendor = NULL;
1209 }
1210 if (iProductNumber)
1211 {
1212 OSCL_DEFAULT_FREE(iProductNumber);
1213 iProductNumber = NULL;
1214 }
1215 if (iVersionNumber)
1216 {
1217 OSCL_DEFAULT_FREE(iVersionNumber);
1218 iVersionNumber = NULL;
1219 }
1220 iProductNumberLen = pn_len;
1221 iVersionNumberLen = vn_len;
1222
1223 if (vendor)
1224 {
1225 iVendor = vendor->Copy();
1226 }
1227
1228 if (iProductNumberLen)
1229 {
1230 iProductNumber = (uint8*)OSCL_DEFAULT_MALLOC(iProductNumberLen);
1231 oscl_memcpy(iProductNumber, pn, iProductNumberLen);
1232 }
1233
1234 if (iVersionNumberLen)
1235 {
1236 iVersionNumber = (uint8*)OSCL_DEFAULT_MALLOC(iVersionNumberLen);
1237 oscl_memcpy(iVersionNumber, vn, iVersionNumberLen);
1238 }
1239 return EPVT_Success;
1240 }
1241
Allocate324mTSC(TPVLoopbackMode aLoopbackMode)1242 OSCL_EXPORT_REF TSC* Allocate324mTSC(TPVLoopbackMode aLoopbackMode)
1243 {
1244 return OSCL_NEW(TSC_324m, (aLoopbackMode));
1245 }
1246
Deallocate324mTSC(TSC * tsc)1247 OSCL_EXPORT_REF void Deallocate324mTSC(TSC* tsc)
1248 {
1249 TSC_324m* tsc_324m = (TSC_324m*)tsc;
1250 OSCL_DELETE(tsc_324m);
1251 }
1252
1253
TimeoutOccurred(int32 timerID,int32 timeoutInfo)1254 void TSC_324m::TimeoutOccurred(int32 timerID, int32 timeoutInfo)
1255 {
1256 OSCL_UNUSED_ARG(timeoutInfo);
1257 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1258 (0, "TSC_324m::TimeoutOccurred"));
1259
1260 if (timerID == PV_TSC_RTD_TIMER_ID)
1261 {
1262 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1263 (0, "TSC_324m::TimeoutOccurred - Sending RTD"));
1264 iTscSrpBuffer->EnableBuffering(false);
1265 RtdTrfReq();
1266 }
1267 else if (timerID == PV_TSC_LEVEL_SETUP_TIMER_ID)
1268 {
1269 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1270 (0, "TSC_324m::TimeoutOccurred Level setup timeout out, timeoutInfo=%d",
1271 timeoutInfo));
1272 if (!timeoutInfo)
1273 {
1274 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1275 (0, "TSC_324m::TimeoutOccurred Level Setup Failed."));
1276 SignalCsupComplete(PVMFErrTimeout);
1277 }
1278 else
1279 {
1280 /* We timed out waiting for TCS. */
1281 iTSCcomponent->Timeout();
1282 /* Start timer to receive TCS */
1283 iTimer->Request(PV_TSC_TCS_RECEIVE_TIMER_ID, PV_TSC_TCS_RECEIVE_TIMER_ID,
1284 DEFAULT_TCS_RECEIVE_TIMEOUT_SECONDS, this);
1285 iH223->EnableStuffing(true);
1286 iH223->SetInterleavingMultiplexFlags(0, NULL);
1287 iH223->SetMuxLevel(TSC_H223_LEVEL_DEFAULT);
1288 /* Start timer to receive TCS */
1289 iTimer->Request(PV_TSC_LEVEL_SETUP_TIMER_ID, 0,
1290 DEFAULT_TCS_LEVEL_SETUP_TIMEOUT_SECONDS, this);
1291 }
1292 }
1293 else if (timerID == PV_TSC_TCS_RECEIVE_TIMER_ID)
1294 {
1295 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1296 (0, "TSC_324m::TimeoutOccurred Timed out on TCS receive. Connect failed."));
1297 SignalCsupComplete(PVMFErrTimeout);
1298 }
1299 else
1300 {
1301 iTSCcomponent->TimeoutOccurred(timerID, timeoutInfo);
1302 }
1303 }
1304
1305
ResetStats()1306 void TSC_324m::ResetStats()
1307 {
1308 iH223->ResetStats();
1309 }
LogStats(TPVDirection dir)1310 void TSC_324m::LogStats(TPVDirection dir)
1311 {
1312 if (iH223)
1313 iH223->LogStats(dir);
1314 }
1315
1316 // Node virtuals
1317 // Node virtuals
1318 // Sync requests that will NOT trigger callback events
1319
GetCapability(PVMFNodeCapability & aNodeCapability)1320 OSCL_EXPORT_REF PVMFStatus TSC_324m::GetCapability(PVMFNodeCapability& aNodeCapability)
1321 {
1322 aNodeCapability.iCanSupportMultipleInputPorts = true;
1323 aNodeCapability.iCanSupportMultipleOutputPorts = true;
1324 aNodeCapability.iHasMaxNumberOfPorts = true;
1325 aNodeCapability.iMaxNumberOfPorts = 5;
1326 aNodeCapability.iInputFormatCapability.push_back(PVMF_MIME_H223);
1327 aNodeCapability.iInputFormatCapability.push_back(PVMF_MIME_M4V);
1328 aNodeCapability.iInputFormatCapability.push_back(PVMF_MIME_H2631998);
1329 aNodeCapability.iInputFormatCapability.push_back(PVMF_MIME_H2632000);
1330 aNodeCapability.iOutputFormatCapability.push_back(PVMF_MIME_H223);
1331 aNodeCapability.iOutputFormatCapability.push_back(PVMF_MIME_M4V);
1332 aNodeCapability.iOutputFormatCapability.push_back(PVMF_MIME_H2631998);
1333 aNodeCapability.iOutputFormatCapability.push_back(PVMF_MIME_H2632000);
1334 return PVMFSuccess;
1335 }
1336
Init(PVMFSessionId aSession,const OsclAny * aContext)1337 OSCL_EXPORT_REF PVMFCommandId TSC_324m::Init(PVMFSessionId aSession, const OsclAny* aContext)
1338 {
1339 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1340 (0, "TSC_324m::Init(%x)", aContext));
1341
1342 if (iInterfaceState != EPVMFNodeIdle)
1343 {
1344 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
1345 (0, "TSC_324m::Init Invalid state(%d)", iInterfaceState));
1346 OSCL_LEAVE(PVMFErrInvalidState);
1347 }
1348 // Add command to queue
1349 Tsc324mNodeCommand cmd;
1350 cmd.Construct(aSession, PVMF_GENERIC_NODE_INIT, aContext);
1351 return QueueCommandL(cmd);
1352 }
1353
1354 // Async requests that will trigger callback events
1355 /**
1356 This should establish the comm server session. Thread specific initialization happens here */
DoInit(Tsc324mNodeCommand & cmd)1357 void TSC_324m::DoInit(Tsc324mNodeCommand& cmd)
1358 {
1359 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
1360 (0, "TSC_324m::DoInit(%x)", cmd.iId));
1361
1362 PVMFStatus pvmfStatus = PVMFSuccess;
1363 // Initialize TSC
1364 int leave_status = 0;
1365 OSCL_TRY(leave_status, InitTsc());
1366 OSCL_FIRST_CATCH_ANY(leave_status, void());
1367
1368 if (leave_status == 0)
1369 {
1370 iInterfaceState = EPVMFNodeInitialized;
1371 }
1372 else
1373 {
1374 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
1375 (0, "TSC_324m::Init - failed to initialize"));
1376 pvmfStatus = PVMFFailure;
1377 iInterfaceState = EPVMFNodeError;
1378 }
1379
1380 CommandComplete(iCmdQueue, cmd, pvmfStatus, NULL);
1381 }
1382
Prepare(PVMFSessionId aSession,const OsclAny * aContext)1383 PVMFCommandId TSC_324m::Prepare(PVMFSessionId aSession
1384 , const OsclAny* aContext)
1385 {
1386 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1387 (0, "TSC_324m::Prepare aSession=%x, aContext=%x",
1388 aSession, aContext));
1389 if (iInterfaceState != EPVMFNodeInitialized)
1390 {
1391 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
1392 (0, "TSC_324m::Prepare Invalid state(%d)", iInterfaceState));
1393 OSCL_LEAVE(PVMFErrInvalidState);
1394 }
1395 // Add command to queue
1396 Tsc324mNodeCommand cmd;
1397 cmd.Construct(aSession, PVMF_GENERIC_NODE_PREPARE, aContext);
1398 return QueueCommandL(cmd);
1399 }
1400
DoPrepare(Tsc324mNodeCommand & cmd)1401 void TSC_324m::DoPrepare(Tsc324mNodeCommand& cmd)
1402 {
1403 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1404 (0, "TSC_324m::DoPrepare"));
1405 iInterfaceState = EPVMFNodePrepared;
1406 CommandComplete(iCmdQueue, cmd, PVMFSuccess);
1407 }
1408
Start(PVMFSessionId aSession,const OsclAny * aContext)1409 OSCL_EXPORT_REF PVMFCommandId TSC_324m::Start(PVMFSessionId aSession, const OsclAny* aContext)
1410 {
1411 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1412 (0, "TSC_324m::Start aSession=%x, aContext=%x", aSession, aContext));
1413
1414 iTSCcomponent->Start();
1415
1416 if (iInterfaceState != EPVMFNodePrepared || iTerminalStatus != Phase0_Idle)
1417 {
1418 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
1419 (0, "TSC_324m::Start Init Invalid state iInterfaceState=%d, iTerminalStatus=%d",
1420 iInterfaceState, iTerminalStatus));
1421 OSCL_LEAVE(PVMFErrInvalidState);
1422 }
1423
1424 // Add command to queue
1425 Tsc324mNodeCommand cmd;
1426 cmd.Construct(aSession, PVMF_GENERIC_NODE_START, aContext);
1427 return QueueCommandL(cmd);
1428 }
1429
DoStart(Tsc324mNodeCommand & cmd)1430 void TSC_324m::DoStart(Tsc324mNodeCommand& cmd)
1431 {
1432 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1433 (0, "TSC_324m::DoStart"));
1434 TPVStatusCode stat = EPVT_Failed;
1435 int leave_status = 0;
1436 PVMFStatus pvmfStatus = PVMFFailure;
1437
1438 OSCL_TRY(leave_status, stat = Connect());
1439 OSCL_FIRST_CATCH_ANY(leave_status, Disconnect());
1440 if (stat == EPVT_Success || stat == EPVT_Pending)
1441 {
1442 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1443 (0, "TSC_324m::DoStart Connect complete"));
1444 pvmfStatus = PVMFSuccess;
1445 iInterfaceState = EPVMFNodeStarted;
1446 }
1447 else
1448 {
1449 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1450 (0, "TSC_324m::DoStart Connect failed leave_status=%d",
1451 leave_status));
1452 iInterfaceState = EPVMFNodePrepared;
1453 }
1454
1455 CommandComplete(iCmdQueue, cmd, pvmfStatus);
1456 return;
1457
1458 }
1459
1460 /**
1461 * Causes the node to stop servicing one or all disconnected ports.
1462 * TBD: Should we add an API or modify this to take an arbitrary subset of ports ?
1463 * @exception port_connected leaves if any of the ports are not disconnected.
1464 **/
Stop(PVMFSessionId aSession,const OsclAny * aContext)1465 OSCL_EXPORT_REF PVMFCommandId TSC_324m::Stop(PVMFSessionId aSession,
1466 const OsclAny* aContext)
1467 {
1468 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1469 (0, "TSC_324m::Stop aSession=%x, aContext=%x",
1470 aSession, aContext));
1471 switch (iInterfaceState)
1472 {
1473 case EPVMFNodeInitialized:
1474 case EPVMFNodePrepared:
1475 case EPVMFNodeStarted:
1476 case EPVMFNodePaused:
1477 // ok to call stop
1478 break;
1479 default:
1480 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
1481 (0, "TSC_324m::Stop Invalid state(%d)", iInterfaceState));
1482 OSCL_LEAVE(PVMFErrInvalidState);
1483 }
1484
1485 while (!iCmdQueue.empty())
1486 {
1487 CommandComplete(iCmdQueue, iCmdQueue.front(), PVMFErrCancelled);
1488 iCmdQueue.Erase(&iCmdQueue.front());
1489 }
1490
1491 iPendingCmdQueue.clear();
1492 // Add command to queue
1493 Tsc324mNodeCommand cmd;
1494 cmd.Construct(aSession, PVMF_GENERIC_NODE_STOP, aContext);
1495 return QueueCommandL(cmd);
1496 }
1497
1498
1499
DoStop(Tsc324mNodeCommand & cmd)1500 void TSC_324m::DoStop(Tsc324mNodeCommand& cmd)
1501 {
1502 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1503 (0, "TSC_324m::DoStop"));
1504
1505 switch (iInterfaceState)
1506 {
1507 case EPVMFNodeInitialized:
1508 case EPVMFNodePrepared:
1509 case EPVMFNodeStarted:
1510 case EPVMFNodePaused:
1511 break;
1512 default:
1513 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1514 (0, "TSC_324m::DoStop Ignoring stop due to invalid state(%d)",
1515 iInterfaceState));
1516 CommandComplete(iCmdQueue, cmd, PVMFErrInvalidState);
1517 return;
1518 }
1519
1520 if (iTSCcomponent)
1521 {
1522 iTSCcomponent->StartDisconnect(true);
1523 }
1524
1525 iTerminalStatus = PhaseF_Clc;
1526 Disconnect();
1527
1528 if (iNumRtdRequests)
1529 {
1530 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1531 (0, "TSC_324m::DoStop iNumRtdRequests=%d, iRtdMin=%d, iRtdmax=%d, iRtdAve=%d",
1532 iNumRtdRequests, iRtdMin, iRtdMax, iRtdAve / iNumRtdRequests));
1533 }
1534 else
1535 {
1536 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1537 (0, "TSC_324m::DoStop No RTD requests issued"));
1538 }
1539
1540 iInterfaceState = EPVMFNodePrepared;
1541 CommandComplete(iCmdQueue, cmd, PVMFSuccess);
1542 }
1543
1544 /**
1545 * Causes the node to pause servicing one or all connected and started ports.
1546 * Ports are to be resumed using the Start command ?
1547 * TBD: Should we add an API or modify this to take an arbitrary subset of ports ?
1548 * @exception port_disconnected leaves if any of the ports are not connected.
1549 **/
Pause(PVMFSessionId aSession,const OsclAny * aContext)1550 OSCL_EXPORT_REF PVMFCommandId TSC_324m::Pause(PVMFSessionId aSession,
1551 const OsclAny* aContext)
1552 {
1553 OSCL_UNUSED_ARG(aSession);
1554 OSCL_UNUSED_ARG(aContext);
1555 OSCL_LEAVE(PVMFErrNotSupported);
1556 return -1;
1557 }
1558
1559 /**
1560 * Resets the node. The node should relinquish all resources that is has acquired as part of the
1561 * initialization process and should be ready to be deleted when this completes.
1562 * @exception port_disconnected leaves if any of the ports are not connected.
1563
1564 **/
Reset(PVMFSessionId aSession,const OsclAny * aContext)1565 OSCL_EXPORT_REF PVMFCommandId TSC_324m::Reset(PVMFSessionId aSession,
1566 const OsclAny* aContext)
1567 {
1568 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1569 (0, "TSC_324m::Reset(%d)", iInterfaceState));
1570
1571 switch (iInterfaceState)
1572 {
1573 case EPVMFNodeInitialized:
1574 case EPVMFNodePrepared:
1575 case EPVMFNodeError:
1576 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1577 (0, "TSC_324m::Reset Ok to reset"));
1578 break;
1579 default:
1580 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1581 (0, "TSC_324m::Reset Invalid state for Reset"));
1582 OSCL_LEAVE(PVMFErrInvalidState);
1583 break;
1584 }
1585
1586 while (!iCmdQueue.empty())
1587 {
1588 CommandComplete(iCmdQueue, iCmdQueue.front(), PVMFErrCancelled);
1589 iCmdQueue.Erase(&iCmdQueue.front());
1590 }
1591 iPendingCmdQueue.clear();
1592 // Add command to queue
1593 Tsc324mNodeCommand cmd;
1594 cmd.Construct(aSession, PVMF_GENERIC_NODE_RESET, aContext);
1595 return QueueCommandL(cmd);
1596 }
1597
DoReset(Tsc324mNodeCommand & cmd)1598 void TSC_324m::DoReset(Tsc324mNodeCommand& cmd)
1599 {
1600 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1601 (0, "TSC_324m::DoReset"));
1602 iInterfaceState = EPVMFNodeIdle;
1603 ResetTsc();
1604 CommandComplete(iCmdQueue, cmd, PVMFSuccess);
1605 }
1606
RequestPort(PVMFSessionId aSession,int32 aPortTag,const PvmfMimeString * aPortConfig,const OsclAny * aContext)1607 OSCL_EXPORT_REF PVMFCommandId TSC_324m::RequestPort(PVMFSessionId aSession
1608 , int32 aPortTag
1609 , const PvmfMimeString* aPortConfig
1610 , const OsclAny* aContext)
1611 {
1612 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1613 (0, "TSC_324m::RequestPort"));
1614
1615 // Add command to queue
1616 Tsc324mNodeCommand cmd;
1617 cmd.Construct(aSession, PVMF_GENERIC_NODE_REQUESTPORT, aPortTag,
1618 aPortConfig, aContext);
1619 return QueueCommandL(cmd);
1620 }
1621
FindOutgoingPort(TPVMediaType_t mediaType)1622 PVMFPortInterface* TSC_324m::FindOutgoingPort(TPVMediaType_t mediaType)
1623 {
1624 PVMFPortInterface* port = NULL;
1625 OlcParam* param = iTSCcomponent->FindOlc(OUTGOING,
1626 mediaType, OLC_ESTABLISHED | OLC_PENDING);
1627 if (param)
1628 {
1629 uint32 channelID = param->GetChannelId();
1630 H223OutgoingChannelPtr outgoing_lcn;
1631 PVMFStatus pvmfStatus = iH223->GetOutgoingChannel(channelID,
1632 outgoing_lcn);
1633 if (pvmfStatus == PVMFSuccess)
1634 {
1635 port = outgoing_lcn;
1636 iRequestedOutgoingChannels[port] = outgoing_lcn;
1637 }
1638 }
1639 return port;
1640 }
1641
DoRequestPort(Tsc324mNodeCommand & cmd)1642 void TSC_324m::DoRequestPort(Tsc324mNodeCommand& cmd)
1643 {
1644 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1645 (0, "TSC_324m::DoRequestPort"));
1646 PVMFStatus pvmfStatus = PVMFSuccess;
1647 int32 aPortTag = (int32)cmd.iParam1;
1648
1649 PvmfMimeString* aPortConfig = (PvmfMimeString*)cmd.iParam2;
1650 PVMFPortInterface* port = NULL;
1651 if (aPortConfig)
1652 {
1653 PVMFFormatType formatType(aPortConfig->get_str());
1654 if (formatType.isFile())
1655 {
1656
1657 // Multiplexed PV_MULTIPLEXED
1658 // x-pvmf/multiplexed: to identify the lowerlayer port
1659 // Is the port already requested ?
1660 if (iH223->GetLowerLayer()->IsConnected())
1661 {
1662 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1663 (0, "TSC_324m::RequestPort - Port is in use"));
1664 pvmfStatus = PVMFErrBusy;
1665 }
1666 else
1667 {
1668 port = iH223->GetLowerLayer();
1669 }
1670 }
1671 else if (*aPortConfig == PVMF_AUDIO_OUTGOING_MIMETYPE)
1672 {
1673 // Audio x-pvmf/audio;dir=outgoing to identify the outgoing audio channel
1674 port = FindOutgoingPort(PV_AUDIO);
1675 if (port == NULL)
1676 {
1677 pvmfStatus = PVMFFailure;
1678 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
1679 (0, "TSC_324m::DoRequestPort Error - Failed to lookup outgoing channel %d",
1680 aPortTag));
1681 }
1682 }
1683 else if (*aPortConfig == PVMF_VIDEO_OUTGOING_MIMETYPE)
1684 {
1685 // Video x-pvmf/video;dir=outgoing to identify the outgoing video channel
1686 port = FindOutgoingPort(PV_VIDEO);
1687 if (port == NULL)
1688 {
1689 pvmfStatus = PVMFFailure;
1690 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
1691 (0, "TSC_324m::DoRequestPort Error - Failed to lookup outgoing channel %d",
1692 aPortTag));
1693 }
1694 }
1695
1696 else if (*aPortConfig == PVMF_INCOMING_MIMETYPE || (aPortTag < 0))
1697 {
1698 if (aPortTag < 0)
1699 {
1700 aPortTag = -aPortTag;
1701 }
1702 // just use the channel id
1703 //x-pvmf/dir=incoming
1704 // Incoming
1705 H223IncomingChannelPtr incoming_lcn;
1706 pvmfStatus = iH223->GetIncomingChannel(aPortTag, incoming_lcn);
1707 if (pvmfStatus == PVMFSuccess)
1708 {
1709 port = incoming_lcn;
1710 iRequestedIncomingChannels[port] = incoming_lcn;
1711 }
1712 else
1713 {
1714 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
1715 (0, "TSC_324m::DoRequestPort Error - Failed to lookup incoming channel %d",
1716 aPortTag));
1717 }
1718 }
1719
1720 else //if (*aPortConfig == PVMF_OUTGOING_MIMETYPE || aPortTag >=0)
1721 {
1722 //x-pvmf/dir=outgoing
1723 // Outgoing
1724 H223OutgoingChannelPtr outgoing_lcn;
1725 pvmfStatus = iH223->GetOutgoingChannel(aPortTag, outgoing_lcn);
1726 if (pvmfStatus == PVMFSuccess)
1727 {
1728 port = outgoing_lcn;
1729 iRequestedOutgoingChannels[port] = outgoing_lcn;
1730 }
1731 else
1732 {
1733 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
1734 (0, "TSC_324m::DoRequestPort Error - Failed to lookup outgoing channel %d",
1735 aPortTag));
1736 }
1737 }
1738
1739 }
1740
1741 if (pvmfStatus != PVMFPending)
1742 {
1743 CommandComplete(iCmdQueue, cmd, pvmfStatus, port);
1744 return;
1745 }
1746 // queue up the command in the pending queue
1747 iPendingCmdQueue.StoreL(cmd);
1748 iCmdQueue.Erase(&cmd);
1749 }
1750
1751
ReleasePort(PVMFSessionId aSession,PVMFPortInterface & aPort,const OsclAny * aContext)1752 OSCL_EXPORT_REF PVMFCommandId TSC_324m::ReleasePort(PVMFSessionId aSession,
1753 PVMFPortInterface& aPort,
1754 const OsclAny* aContext)
1755 {
1756 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1757 (0, "TSC_324m::ReleasePort"));
1758 // Add command to queue
1759 Tsc324mNodeCommand cmd;
1760 cmd.Construct(aSession, PVMF_GENERIC_NODE_RELEASEPORT, aPort, aContext);
1761 return QueueCommandL(cmd);
1762 }
1763
DoReleasePort(Tsc324mNodeCommand & cmd)1764 void TSC_324m::DoReleasePort(Tsc324mNodeCommand& cmd)
1765 {
1766 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1767 (0, "TSC_324m::DoReleasePort"));
1768
1769 PVMFPortInterface* port = (PVMFPortInterface*)cmd.iParam1;
1770 if (port->GetPortTag() == PV_MULTIPLEXED)
1771 {
1772 CommandComplete(iCmdQueue, cmd, PVMFSuccess, port);
1773 return;
1774 }
1775
1776 H223LogicalChannel* lcn = OSCL_STATIC_CAST(H223LogicalChannel*, port);
1777 if (lcn)
1778 {
1779 TPVDirection aDirection = port->GetPortTag() < 0 ? INCOMING : OUTGOING;
1780 if (aDirection == INCOMING)
1781 {
1782 Oscl_Map<PVMFPortInterface*, H223IncomingChannelPtr, OsclMemAllocator>::iterator iter;
1783 iter = iRequestedIncomingChannels.find(port);
1784 if (iter != iRequestedIncomingChannels.end())
1785 {
1786 iRequestedIncomingChannels[port]->Flush();
1787 iH223->CloseChannel(INCOMING,
1788 iRequestedIncomingChannels[port]->GetLogicalChannelNumber());
1789
1790
1791 iRequestedIncomingChannels.erase(iter);
1792 }
1793 else
1794 {
1795 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1796 (0, "TSC_324m::DoReleasePort - Incoming channel not requested"));
1797
1798 }
1799 }
1800 else
1801 {
1802 Oscl_Map<PVMFPortInterface*, H223OutgoingChannelPtr, OsclMemAllocator>::iterator iter;
1803 iter = iRequestedOutgoingChannels.find(port);
1804 if (iter != iRequestedOutgoingChannels.end())
1805 {
1806 iH223->FlushChannel(OUTGOING,
1807 iRequestedOutgoingChannels[port]->GetLogicalChannelNumber());
1808 iH223->CloseChannel(OUTGOING,
1809 iRequestedOutgoingChannels[port]->GetLogicalChannelNumber());
1810 iRequestedOutgoingChannels.erase(iter);
1811 }
1812 }
1813 }
1814
1815 CommandComplete(iCmdQueue, cmd, PVMFSuccess, port);
1816 return;
1817 }
1818
1819 /**
1820 * Returns a list of ports currently available in the node that meet the filter criteria
1821 * We can add fancier iterators and filters as needed. For now we return all the ports.
1822 **/
GetPorts(const PVMFPortFilter * aFilter)1823 OSCL_EXPORT_REF PVMFPortIter* TSC_324m::GetPorts(const PVMFPortFilter* aFilter)
1824 {
1825 OSCL_UNUSED_ARG(aFilter);
1826 return NULL;
1827 }
1828
DoCancel()1829 void TSC_324m::DoCancel()
1830 {
1831 }
1832
Run()1833 void TSC_324m::Run()
1834 {
1835 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1836 (0, " TSC_324m::Run()"));
1837 if (!iCmdQueue.empty())
1838 {
1839 ProcessCommand(iCmdQueue.front());
1840 }
1841
1842 if (!iCmdQueue.empty())
1843 {
1844 // Run again if there are more things to process
1845 RunIfNotReady();
1846 }
1847
1848 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1849 (0, " TSC_324m::Run() - done"));
1850 }
1851
ProcessCommand(Tsc324mNodeCommand & aCmd)1852 bool TSC_324m::ProcessCommand(Tsc324mNodeCommand& aCmd)
1853 {
1854 switch (aCmd.iCmd)
1855 {
1856 case PVMF_GENERIC_NODE_QUERYUUID:
1857 DoQueryUuid(aCmd);
1858 break;
1859
1860 case PVMF_GENERIC_NODE_QUERYINTERFACE:
1861 DoQueryInterface(aCmd);
1862 break;
1863
1864 case PVMF_GENERIC_NODE_REQUESTPORT:
1865 DoRequestPort(aCmd);
1866 break;
1867
1868 case PVMF_GENERIC_NODE_RELEASEPORT:
1869 DoReleasePort(aCmd);
1870 break;
1871
1872 case PVMF_GENERIC_NODE_INIT:
1873 DoInit(aCmd);
1874 break;
1875
1876 case PVMF_GENERIC_NODE_PREPARE:
1877 DoPrepare(aCmd);
1878 break;
1879
1880 case PVMF_GENERIC_NODE_START:
1881 DoStart(aCmd);
1882 break;
1883
1884 case PVMF_GENERIC_NODE_STOP:
1885 DoStop(aCmd);
1886 break;
1887
1888 case PVMF_GENERIC_NODE_FLUSH:
1889 DoFlush(aCmd);
1890 break;
1891
1892 case PVMF_GENERIC_NODE_PAUSE:
1893 DoPause(aCmd);
1894 break;
1895
1896 case PVMF_GENERIC_NODE_RESET:
1897 DoReset(aCmd);
1898 break;
1899
1900 case PVMF_GENERIC_NODE_CANCELALLCOMMANDS:
1901 DoCancelAllCommands(aCmd);
1902 break;
1903
1904 case PVMF_GENERIC_NODE_CANCELCOMMAND:
1905 DoCancelCommand(aCmd);
1906 break;
1907
1908 default://unknown command type
1909 if (iTSCcomponent->ProcessCommand(aCmd))
1910 {
1911 CommandComplete(iCmdQueue, aCmd, PVMFSuccess);
1912 }
1913 else
1914 {
1915 CommandComplete(iCmdQueue, aCmd, PVMFFailure);
1916 }
1917 break;
1918 }
1919
1920 return true;
1921 }
1922
FindPendingPortCmd(TPVMFGenericNodeCommand aCmdType,int32 aPortTag,Tsc324mNodeCommand & cmd)1923 int32 TSC_324m::FindPendingPortCmd(TPVMFGenericNodeCommand aCmdType,
1924 int32 aPortTag,
1925 Tsc324mNodeCommand& cmd)
1926 {
1927 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1928 (0, "TSC_324m::FindPendingRequestPortCmd aCmdType=%d, aPortTag=%d",
1929 aCmdType, aPortTag));
1930
1931 int32 cmdIndex = -1;
1932
1933 for (uint32 i = 0; i < iPendingCmdQueue.size(); i++)
1934 {
1935 if ((TPVMFGenericNodeCommand)iPendingCmdQueue[i].iCmd == aCmdType)
1936 {
1937 if (aPortTag == (int32)iPendingCmdQueue[i].iParam1)
1938 {
1939 cmd = iPendingCmdQueue[i];
1940 cmdIndex = i;
1941 break;
1942 }
1943 }
1944 }
1945
1946 if (cmdIndex < 0)
1947 {
1948 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1949 (0, "TSC_324m::FindPendingPortCmd Error - command not found"));
1950 return 0;
1951 }
1952
1953 // Destroy command object
1954 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1955 (0, "TSC_324m::FindPendingPortCmd : Deleting cmd from iPendingQueue. cmdIndex=%d",
1956 cmdIndex));
1957 iPendingCmdQueue.Erase(&iPendingCmdQueue[cmdIndex]);
1958 return cmdIndex;
1959 }
1960
SetMultiplexLevel(TPVH223Level muxLevel)1961 OSCL_EXPORT_REF void TSC_324m::SetMultiplexLevel(TPVH223Level muxLevel)
1962 {
1963 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1964 (0, "TSC_324m::SetMultiplexLevel level(%d)\n", muxLevel));
1965 iH223Level = muxLevel;
1966
1967 if (iH223)
1968 {
1969 iH223->SetMultiplexLevel(muxLevel);
1970 }
1971 }
1972
SetSduSize(TPVDirection direction,uint16 size,TPVAdaptationLayer al)1973 OSCL_EXPORT_REF void TSC_324m::SetSduSize(TPVDirection direction,
1974 uint16 size,
1975 TPVAdaptationLayer al)
1976 {
1977 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1978 (0, "TSC_324m::SetSduSize direction(%d), size(%d), al(%d)\n",
1979 direction, size, al));
1980 if (iH223)
1981 {
1982 iH223->SetSduSize(direction, size, EplForAdaptationLayer(al));
1983 }
1984 }
1985
SetAl2Sn(int width)1986 OSCL_EXPORT_REF void TSC_324m::SetAl2Sn(int width)
1987 {
1988 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1989 (0, "TSC_324m::SetAl2Sn on/off(%d)\n", width));
1990 iTSCcomponent->SetAl2Sn(width);
1991 }
1992
SetAl3ControlFieldOctets(unsigned cfo)1993 OSCL_EXPORT_REF void TSC_324m::SetAl3ControlFieldOctets(unsigned cfo)
1994 {
1995 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
1996 (0, "TSC_324m::SetAl3ControlFieldOctets cfo(%d)\n", cfo));
1997 iTSCcomponent->SetAl3ControlFieldOctets(cfo);
1998 }
1999
SetMaxOutgoingPduSize(uint16 size)2000 OSCL_EXPORT_REF void TSC_324m::SetMaxOutgoingPduSize(uint16 size)
2001 {
2002 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2003 (0, "TSC_324m::SetMaxOutgoingPduSize size(%d)\n", size));
2004 if (iH223)
2005 {
2006 iH223->SetMaxOutgoingPduSize(size);
2007 }
2008 }
2009
SetMaxMuxPduSize(uint16 size)2010 OSCL_EXPORT_REF void TSC_324m::SetMaxMuxPduSize(uint16 size)
2011 {
2012 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2013 (0, "TSC_324m::SetMaxMuxPduSize size(%d)\n", size));
2014 iRequestMaxMuxPduSize = size;
2015 }
2016
SetMaxCcsrlSduSize(int size)2017 OSCL_EXPORT_REF void TSC_324m::SetMaxCcsrlSduSize(int size)
2018 {
2019 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2020 (0, "TSC_324m::SetMaxCcsrlSduSize size(%d)\n", size));
2021 if (iSrp)
2022 {
2023 iSrp->SetCCSRLSduSize(size);
2024 }
2025 else
2026 {
2027 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2028 (0, "TSC_324m::SetMaxCcsrlSduSize - Invalid state: SRP == NULL"));
2029 }
2030 }
2031
SetOutgoingMuxPduType(TPVH223MuxPduType outgoingPduType)2032 OSCL_EXPORT_REF void TSC_324m::SetOutgoingMuxPduType(TPVH223MuxPduType outgoingPduType)
2033 {
2034 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2035 (0, "TSC_324m::SetOutgoingMuxPduType type(%d)\n",
2036 outgoingPduType));
2037 iOutgoingPduType = outgoingPduType;
2038 }
2039
SetOutgoingChannelConfig(Oscl_Vector<H324ChannelParameters,PVMFTscAlloc> & out_channel_config)2040 OSCL_EXPORT_REF void TSC_324m::SetOutgoingChannelConfig(
2041 Oscl_Vector<H324ChannelParameters, PVMFTscAlloc>& out_channel_config)
2042 {
2043 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2044 (0, "TSC_324m::SetOutgoingChannelConfig size(%d)\n",
2045 out_channel_config.size()));
2046 if (iInterfaceState != EPVMFNodeInitialized)
2047 {
2048 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2049 (0, "TSC_324m::SetOutgoingChannelConfig Error: Invalid state."));
2050 OSCL_LEAVE(PVMFErrInvalidState);
2051 }
2052 iTSCcomponent->SetOutgoingChannelConfig(out_channel_config);
2053 }
2054
SetIncomingChannelConfig(Oscl_Vector<H324ChannelParameters,PVMFTscAlloc> & in_channel_config)2055 OSCL_EXPORT_REF void TSC_324m::SetIncomingChannelConfig(
2056 Oscl_Vector<H324ChannelParameters, PVMFTscAlloc>& in_channel_config)
2057 {
2058 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2059 (0, "TSC_324m::SetIncomingChannelConfig size(%d)\n",
2060 in_channel_config.size()));
2061 iTSCcomponent->SetIncomingChannelConfig(in_channel_config);
2062 }
2063
SetAlConfig(PV2WayMediaType media_type,TPVAdaptationLayer layer,bool allow)2064 OSCL_EXPORT_REF void TSC_324m::SetAlConfig(PV2WayMediaType media_type,
2065 TPVAdaptationLayer layer,
2066 bool allow)
2067 {
2068 iTSCcomponent->SetAlConfig(media_type, layer, allow);
2069 }
2070
QueryUUID(PVMFSessionId aSession,const PvmfMimeString & aMimeType,Oscl_Vector<PVUuid,OsclMemAllocator> & aUuids,bool aExactUuidsOnly,const OsclAny * aContext)2071 PVMFCommandId TSC_324m::QueryUUID(PVMFSessionId aSession,
2072 const PvmfMimeString& aMimeType,
2073 Oscl_Vector<PVUuid, OsclMemAllocator>& aUuids,
2074 bool aExactUuidsOnly,
2075 const OsclAny* aContext)
2076 {
2077 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2078 (0, "TSC_324m::QueryUUID"));
2079 // create message to be completed later - depending on what it is...
2080 Tsc324mNodeCommand cmd;
2081 cmd.Construct(aSession, PVMF_GENERIC_NODE_QUERYUUID, aMimeType,
2082 aUuids, aExactUuidsOnly, aContext);
2083 iComponentRegistry.QueryRegistry(cmd);
2084 //return QueueCommandL(cmd);
2085 return 0;
2086 }
2087
QueryInterface(PVMFSessionId aSession,const PVUuid & aUuid,PVInterface * & aInterfacePtr,const OsclAny * aContext)2088 PVMFCommandId TSC_324m::QueryInterface(PVMFSessionId aSession,
2089 const PVUuid& aUuid,
2090 PVInterface*& aInterfacePtr,
2091 const OsclAny* aContext)
2092 {
2093 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2094 (0, "TSC_324m::QueryInterface()"));
2095
2096 if (aUuid == PVH324MConfigUuid)
2097 {
2098 aInterfacePtr = OSCL_NEW(H324MConfig, (this, true));
2099 }
2100 else if (aUuid == PVUidProxiedInterface)
2101 {
2102 H324MProxiedInterface* proxied_interface_ptr = NULL;
2103 proxied_interface_ptr = OSCL_NEW(H324MProxiedInterface, ());
2104 proxied_interface_ptr->SetH324M(this);
2105 aInterfacePtr = proxied_interface_ptr;
2106 }
2107 else
2108 {
2109 TSC_component* backup = iTSCcomponent;
2110
2111 // send onto TSCComponentRegistry::Create to let it finish
2112 iTSCcomponent = iComponentRegistry.Create(aSession, aUuid,
2113 aInterfacePtr, aContext);
2114 if (iTSCcomponent)
2115 {
2116 InitComponent();
2117 if (backup)
2118 {
2119 OSCL_DELETE(backup);
2120 }
2121 }
2122 }
2123
2124 // Add command to queue
2125 /*Tsc324mNodeCommand cmd;
2126 cmd.Construct(aSession, PVMF_GENERIC_NODE_QUERYINTERFACE, aUuid, aInterfacePtr, aContext) ;
2127 return QueueCommandL(cmd);
2128 */
2129 return 0;
2130 }
2131
DoQueryInterface(Tsc324mNodeCommand & cmd)2132 void TSC_324m::DoQueryInterface(Tsc324mNodeCommand& cmd)
2133 {
2134 OSCL_UNUSED_ARG(cmd);
2135 //CommandComplete(iCmdQueue, cmd, PVMFSuccess);
2136 }
2137
DoQueryUuid(Tsc324mNodeCommand & cmd)2138 void TSC_324m::DoQueryUuid(Tsc324mNodeCommand& cmd)
2139 {
2140 OSCL_UNUSED_ARG(cmd);
2141 //CommandComplete(iCmdQueue, cmd, PVMFSuccess);
2142 }
2143
CancelAllCommands(PVMFSessionId aSession,const OsclAny * aContext)2144 PVMFCommandId TSC_324m::CancelAllCommands(PVMFSessionId aSession,
2145 const OsclAny* aContext)
2146 {
2147 OSCL_UNUSED_ARG(aSession);
2148 OSCL_UNUSED_ARG(aContext);
2149 OSCL_LEAVE(PVMFErrNotSupported);
2150 return -1;
2151 }
2152
2153
CancelCommand(PVMFSessionId aSession,PVMFCommandId aCommandId,const OsclAny * aContext)2154 OSCL_EXPORT_REF PVMFCommandId TSC_324m::CancelCommand(PVMFSessionId aSession,
2155 PVMFCommandId aCommandId,
2156 const OsclAny* aContext)
2157 {
2158 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2159 (0, "TSC_324m::CancelCommand id(%d)", aCommandId));
2160 // Add command to queue
2161 Tsc324mNodeCommand cmd;
2162 cmd.Construct(aSession, PVMF_GENERIC_NODE_CANCELCOMMAND, aCommandId, aContext);
2163 return QueueCommandL(cmd);
2164 }
2165
DoCancelCommand(Tsc324mNodeCommand & cmd)2166 void TSC_324m::DoCancelCommand(Tsc324mNodeCommand& cmd)
2167 {
2168 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2169 (0, "TSC_324m::DoCancelCommand cmd(%x)", &cmd));
2170 PVMFStatus status = PVMFSuccess;
2171 int cmdIndex = FindPendingCmd((PVMFCommandId)cmd.iParam1);
2172
2173 if (cmdIndex < 0)
2174 {
2175 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2176 (0, "TSC_324m::DoCancelCommand Failed to lookup command(%d)",
2177 (PVMFCommandId)cmd.iParam1));
2178 Tsc324mNodeCommand* found_cmd = iCmdQueue.FindById((PVMFCommandId)cmd.iParam1);
2179 if (found_cmd)
2180 {
2181 iCmdQueue.Erase(found_cmd);
2182 }
2183 else
2184 status = PVMFErrArgument;
2185 }
2186 else
2187 {
2188 // Destroy command object
2189 Tsc324mNodeCommand to_be_deleted_cmd = iPendingCmdQueue[cmdIndex];
2190 iPendingCmdQueue.Erase(&iPendingCmdQueue[cmdIndex]);
2191 }
2192 CommandComplete(iCmdQueue, cmd, status);
2193 }
2194
FindPendingCmd(PVMFCommandId aCommandId)2195 int TSC_324m::FindPendingCmd(PVMFCommandId aCommandId)
2196 {
2197 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2198 (0, "TSC_324m::FindPendingCmd id(%d)", aCommandId));
2199 int32 cmdIndex = -1;
2200 for (uint32 i = 0; i < iPendingCmdQueue.size(); i++)
2201 {
2202 if (iPendingCmdQueue[i].iId == aCommandId)
2203 {
2204 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2205 (0, "TSC_324m::FindPendingCmd - command found in iPendingCmdQueue"));
2206 cmdIndex = i;
2207 break;
2208 }
2209 }
2210 return cmdIndex;
2211 }
2212
GetFormatSpecificInfo(PVMFPortInterface * port,uint32 * len)2213 const uint8* TSC_324m::GetFormatSpecificInfo(PVMFPortInterface* port,
2214 uint32* len)
2215 {
2216 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2217 (0, "TSC_324m::GetFormatSpecificInfo port(%x)", port));
2218 return ((H223LogicalChannel*)port)->GetFormatSpecificInfo(len);
2219 }
2220
GetLogicalChannelInfo(PVMFPortInterface & port)2221 LogicalChannelInfo* TSC_324m::GetLogicalChannelInfo(PVMFPortInterface& port)
2222 {
2223 return iTSCcomponent->GetLogicalChannelInfo(port);
2224 }
2225
IsEstablishedLogicalChannel(TPVDirection aDir,TPVChannelId aChannelId)2226 bool TSC_324m::IsEstablishedLogicalChannel(TPVDirection aDir,
2227 TPVChannelId aChannelId)
2228 {
2229 return iTSCcomponent->IsEstablishedLogicalChannel(aDir, aChannelId);
2230 }
2231
SetSkewReference(PVMFPortInterface * aPort,PVMFPortInterface * aReferencePort)2232 void TSC_324m::SetSkewReference(PVMFPortInterface* aPort,
2233 PVMFPortInterface* aReferencePort)
2234 {
2235 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2236 (0, "TSC_324m::SetSkewReference"));
2237 H223OutgoingChannel* lcn2 = OSCL_STATIC_CAST(H223OutgoingChannel*,
2238 aPort);
2239 H223OutgoingChannel* lcn1 = OSCL_STATIC_CAST(H223OutgoingChannel*,
2240 aReferencePort);
2241 lcn2->SetSkewReference(lcn1);
2242 }
2243
SendVideoTemporalSpatialTradeoffCommand(TPVChannelId aLogicalChannel,uint8 aTradeoff)2244 void TSC_324m::SendVideoTemporalSpatialTradeoffCommand(TPVChannelId aLogicalChannel,
2245 uint8 aTradeoff)
2246 {
2247 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2248 (0, "TSC_324m::SendVideoTemporalSpatialTradeoffCommand aLogicalChannel=%d, aTradeoff=%d", aLogicalChannel, aTradeoff));
2249 if (iTerminalStatus != PhaseE_Comm)
2250 {
2251 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2252 (0, "TSC_324m::SendVideoTemporalSpatialTradeoffCommand Ignoring due to invalid state."));
2253 return;
2254 }
2255 CmdMisc(EVideoTemporalSpatialTradeOff, aLogicalChannel, aTradeoff);
2256 }
2257
SendVideoTemporalSpatialTradeoffIndication(TPVChannelId aLogicalChannel,uint8 aTradeoff)2258 void TSC_324m::SendVideoTemporalSpatialTradeoffIndication(TPVChannelId aLogicalChannel,
2259 uint8 aTradeoff)
2260 {
2261 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2262 (0, "TSC_324m::SendVideoTemporalSpatialTradeoffIndication aLogicalChannel=%d, aTradeoff=%d", aLogicalChannel, aTradeoff));
2263 if (iTerminalStatus != PhaseE_Comm)
2264 {
2265 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2266 (0, "TSC_324m::SendVideoTemporalSpatialTradeoffIndication Ignoring due to invalid state."));
2267 return;
2268 }
2269 IndicationMisc(EVideoTemporalSpatialTradeOffIdc, aLogicalChannel,
2270 aTradeoff);
2271 }
2272
SetDatapathLatency(TPVDirection aDir,PVMFPortInterface * aPort,uint32 aLatency)2273 void TSC_324m::SetDatapathLatency(TPVDirection aDir, PVMFPortInterface* aPort,
2274 uint32 aLatency)
2275 {
2276 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2277 (0, "TSC_324m::SetDatapathLatency aDir=%d, aPort=%x, aLatency=%d", aDir, aPort, aLatency));
2278 OSCL_UNUSED_ARG(aDir);
2279 H223LogicalChannel* lcn = OSCL_STATIC_CAST(H223LogicalChannel* , aPort);
2280 if (lcn == NULL)
2281 {
2282 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
2283 (0, "TSC_324m::SetDatapathLatency WARNING lcn==NULL"));
2284 return;
2285 }
2286
2287 lcn->SetDatapathLatency(aLatency);
2288 }
2289
SendSkewIndication(TPVChannelId aLogicalChannel1,TPVChannelId aLogicalChannel2,uint16 aSkew)2290 void TSC_324m::SendSkewIndication(TPVChannelId aLogicalChannel1,
2291 TPVChannelId aLogicalChannel2,
2292 uint16 aSkew)
2293 {
2294 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2295 (0, "TSC_324m::SendSkewIndication aLogicalChannel1=%d, aLogicalChannel2=%d, aSkew=%d",
2296 aLogicalChannel1, aLogicalChannel2, aSkew));
2297 if (iTerminalStatus != PhaseE_Comm)
2298 {
2299 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2300 (0, "TSC_324m::SendSkewIndication Ignoring due to invalid state."));
2301 return;
2302 }
2303 Tsc_IdcSkew(aLogicalChannel1, aLogicalChannel2, aSkew);
2304 }
2305
SetMultiplexingDelayMs(uint16 aDelay)2306 OSCL_EXPORT_REF void TSC_324m::SetMultiplexingDelayMs(uint16 aDelay)
2307 {
2308 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2309 (0, "TSC_324m::SetMultiplexingDelayMs,aDelay=%d", aDelay));
2310 iMultiplexingDelayMs = aDelay;
2311 if (iH223)
2312 iH223->SetMultiplexingDelayMs((uint16)iMultiplexingDelayMs);
2313 }
2314
ConfigureSrp(TPVH223Level aLevel)2315 void TSC_324m::ConfigureSrp(TPVH223Level aLevel)
2316 {
2317 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2318 (0, "TSC_324m::ConfigureSrp aLevel=%d", aLevel));
2319 iTscSrpBuffer->Stop();
2320
2321 iSrp->SrpStop();
2322 iSrp->SrpReset();
2323 iSrp->SrpInitL();
2324 iSrp->SetSRPTimeoutValue(iT401);
2325 iSrp->SetNumSRPRetries(iN401);
2326
2327 /* We will enable NSRP for level 0 if the remote terminal signals capability */
2328 if (aLevel == H223_LEVEL0)
2329 {
2330 iSrp->SetCCSRLSduSize(0);
2331 iSrp->UseNSRP(false);
2332 }
2333 else
2334 {
2335 iSrp->UseNSRP(true);
2336 }
2337
2338 if (!iEnableWnsrp || aLevel == H223_LEVEL0)
2339 {
2340 iSrp->DisableWNSRPSupport();
2341 }
2342
2343 H223IncomingChannelPtr incoming_control_channel;
2344 PVMFStatus aStatus = iH223->GetIncomingChannel((TPVChannelId)0,
2345 incoming_control_channel);
2346 if (aStatus == PVMFSuccess)
2347 {
2348 incoming_control_channel->Disconnect();
2349 }
2350 else
2351 {
2352 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
2353 (0, "TSC_324m::ConfigureSrp Error - Failed to lookup incoming logical channel %d", 0));
2354 return;
2355 }
2356
2357 H223OutgoingChannelPtr outgoing_control_channel;
2358 aStatus = iH223->GetOutgoingChannel((TPVChannelId)0,
2359 outgoing_control_channel);
2360 if (aStatus == PVMFSuccess)
2361 {
2362 outgoing_control_channel->Disconnect();
2363 }
2364 else
2365 {
2366 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
2367 (0, "TSC_324m::ConfigureSrp Error - Failed to lookup outgoing logical channel %d", 0));
2368 return;
2369 }
2370
2371 PVMFPortInterface *port;
2372
2373 port = iSrp->RequestULPort(SRP_INPUT_PORT_TAG);
2374 iTscSrpBuffer->GetLLPort(TSCSRPBUFFER_OUTPUT_PORT_TAG)->Connect(port);
2375
2376 port = iSrp->RequestULPort(SRP_OUTPUT_PORT_TAG);
2377 port->Connect(iTscSrpBuffer->GetLLPort(TSCSRPBUFFER_INPUT_PORT_TAG));
2378
2379 iTscSrpBuffer->GetUpperLayer()->Bind(iH245);
2380
2381 iOutgoingSrpPort = iSrp->RequestLLPort(SRP_INPUT_PORT_TAG);
2382 iIncomingSrpPort = iSrp->RequestLLPort(SRP_OUTPUT_PORT_TAG);
2383 iOutgoingSrpPort->Connect(incoming_control_channel);
2384 // incoming_control_channel->Connect(iOutgoingSrpPort);
2385 iIncomingSrpPort->Connect(outgoing_control_channel);
2386 // outgoing_control_channel->Connect(iIncomingSrpPort);
2387
2388 iTscSrpBuffer->Start();
2389 iSrp->SrpStart();
2390 }
2391
StopSrp()2392 void TSC_324m::StopSrp()
2393 {
2394 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2395 (0, "TSC_324m::StopSrp "));
2396 iSrp->SrpStop();
2397 iTscSrpBuffer->Stop();
2398
2399 H223IncomingChannelPtr incoming_control_channel;
2400 PVMFStatus aStatus = iH223->GetIncomingChannel((TPVChannelId)0,
2401 incoming_control_channel);
2402 if (aStatus == PVMFSuccess)
2403 {
2404 incoming_control_channel->Disconnect();
2405 }
2406 else
2407 {
2408 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
2409 (0, "TSC_324m::ConfigureSrp Error - Failed to lookup incoming logical channel %d", 0));
2410 }
2411
2412 H223OutgoingChannelPtr outgoing_control_channel;
2413 aStatus = iH223->GetOutgoingChannel((TPVChannelId)0,
2414 outgoing_control_channel);
2415 if (aStatus == PVMFSuccess)
2416 {
2417 outgoing_control_channel->Disconnect();
2418 }
2419 else
2420 {
2421 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_WARNING,
2422 (0, "TSC_324m::ConfigureSrp Error - Failed to lookup outgoing logical channel %d", 0));
2423 }
2424
2425 PVMFPortInterface *port = NULL;
2426
2427 port = iSrp->RequestULPort(SRP_INPUT_PORT_TAG);
2428 if (port)
2429 port->Disconnect();
2430
2431 port = iTscSrpBuffer->GetLLPort(TSCSRPBUFFER_OUTPUT_PORT_TAG);
2432 if (port)
2433 port->Disconnect();
2434
2435 port = iSrp->RequestULPort(SRP_OUTPUT_PORT_TAG);
2436 if (port)
2437 port->Disconnect();
2438
2439 port = iTscSrpBuffer->GetLLPort(TSCSRPBUFFER_INPUT_PORT_TAG);
2440 if (port)
2441 port->Disconnect();
2442
2443 iTscSrpBuffer->GetUpperLayer()->UnBind();
2444
2445 if (iOutgoingSrpPort)
2446 iOutgoingSrpPort->Disconnect();
2447 if (iIncomingSrpPort)
2448 iIncomingSrpPort->Disconnect();
2449 }
2450
2451
GetChannelFormatAndCapabilities(TPVDirection dir,Oscl_Vector<FormatCapabilityInfo,OsclMemAllocator> & formats)2452 OSCL_EXPORT_REF void TSC_324m::GetChannelFormatAndCapabilities(TPVDirection dir,
2453 Oscl_Vector<FormatCapabilityInfo, OsclMemAllocator>& formats)
2454 {
2455 iTSCcomponent->GetChannelFormatAndCapabilities(dir, formats);
2456 }
2457
SetLogicalChannelBufferingMs(uint32 aInBufferingMs,uint32 aOutBufferingMs)2458 OSCL_EXPORT_REF void TSC_324m::SetLogicalChannelBufferingMs(uint32 aInBufferingMs,
2459 uint32 aOutBufferingMs)
2460 {
2461 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2462 (0, "TSC_324m::SetLogicalChannelBufferingMs aInBufferingMs=%d, aOutBufferingMs=%d",
2463 aInBufferingMs, aOutBufferingMs));
2464 iInLogicalChannelBufferingMs = aInBufferingMs;
2465 iOutLogicalChannelBufferingMs = aOutBufferingMs;
2466 }
2467
UseWNSRP(bool aUse)2468 void TSC_324m::UseWNSRP(bool aUse)
2469 {
2470 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2471 (0, "TSC_324m::UseWNSRP %d", aUse));
2472 SetWnsrp(aUse);
2473
2474 PS_MultiplexEntryDescriptor desc = iH223->GetIncomingMuxDescriptor(TSC_WNSRP_MUX_ENTRY_NUMBER);
2475 if (desc &&
2476 desc->size_of_elementList &&
2477 desc->elementList->muxType.index == 0 &&
2478 desc->elementList->muxType.logicalChannelNumber == 0)
2479 {
2480 PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2481 (0, "TSC_324m::UseWNSRP Deleting incoming descriptor for WNSRP"));
2482 iH223->RemoveIncomingMuxDescriptor(TSC_WNSRP_MUX_ENTRY_NUMBER);
2483 }
2484 }
2485
2486
SetTSC_324mObserver(TSC_324mObserver * aObserver)2487 void TSC_324m::SetTSC_324mObserver(TSC_324mObserver* aObserver)
2488 {
2489 if (aObserver == NULL)
2490 return;
2491 iTSC_324mObserver = aObserver;
2492 }
2493
QueueCommandL(Tsc324mNodeCommand & aCmd)2494 PVMFCommandId TSC_324m::QueueCommandL(Tsc324mNodeCommand& aCmd)
2495 {
2496 PVMFCommandId id;
2497
2498 id = iCmdQueue.AddL(aCmd);
2499
2500 //wakeup the AO
2501 RunIfNotReady();
2502
2503 return id;
2504 }
2505
CommandComplete(Tsc324mNodeCmdQ & aCmdQ,Tsc324mNodeCommand & aCmd,PVMFStatus aStatus,OsclAny * aEventData)2506 void TSC_324m::CommandComplete(Tsc324mNodeCmdQ& aCmdQ, Tsc324mNodeCommand& aCmd,
2507 PVMFStatus aStatus, OsclAny* aEventData)
2508 {
2509 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE,
2510 (0, "TSC_324m:CommandComplete Id %d Cmd %d Status %d Context %d Data %d",
2511 aCmd.iId, aCmd.iCmd, aStatus, aCmd.iContext, aEventData));
2512
2513 //create response
2514 PVMFCmdResp resp(aCmd.iId, aCmd.iContext, aStatus, aEventData);
2515 PVMFSessionId session = aCmd.iSession;
2516
2517 //Erase the command from the queue.
2518 aCmdQ.Erase(&aCmd);
2519
2520 //Report completion to the session observer.
2521 ReportCmdCompleteEvent(session, resp);
2522 }
2523
GetPortTagForLcn(TPVDirection aDir,TPVChannelId aId,PVCodecType_t aCodecType)2524 int32 TSC_324m::GetPortTagForLcn(TPVDirection aDir, TPVChannelId aId,
2525 PVCodecType_t aCodecType)
2526 {
2527 if (aDir == INCOMING)
2528 return -aId;
2529 return GetMediaType(aCodecType);
2530 }
2531
ThreadLogon()2532 PVMFStatus TSC_324m::ThreadLogon()
2533 {
2534 AddToScheduler();
2535
2536 SetState(EPVMFNodeIdle);
2537 return PVMFSuccess;
2538 }
2539
ThreadLogoff()2540 PVMFStatus TSC_324m::ThreadLogoff()
2541 {
2542 SetState(EPVMFNodeCreated);
2543 RemoveFromScheduler();
2544 return PVMFSuccess;
2545 }
2546
HandlePortActivity(const PVMFPortActivity & aActivity)2547 void TSC_324m::HandlePortActivity(const PVMFPortActivity& aActivity)
2548 {
2549 OSCL_UNUSED_ARG(aActivity);
2550 }
2551
Flush(PVMFSessionId aSession,const OsclAny * aContext)2552 PVMFCommandId TSC_324m::Flush(PVMFSessionId aSession,
2553 const OsclAny* aContext)
2554 {
2555 OSCL_UNUSED_ARG(aSession);
2556 OSCL_UNUSED_ARG(aContext);
2557
2558 OSCL_LEAVE(PVMFErrNotSupported);
2559 return 0;
2560 }
2561
SetMioLatency(int32 aLatency,bool aAudio)2562 void TSC_324m::SetMioLatency(int32 aLatency, bool aAudio)
2563 {
2564 iH223->SetMioLatency(aLatency, aAudio);
2565 }
2566
2567 #ifdef MEM_TRACK
MemStats()2568 void TSC_324m::MemStats()
2569 {
2570 #if !(OSCL_BYPASS_MEMMGT)
2571
2572 OsclAuditCB auditCB;
2573 OsclMemInit(auditCB);
2574 if (auditCB.pAudit)
2575 {
2576 MM_Stats_t* stats = auditCB.pAudit->MM_GetStats("");
2577 if (stats)
2578 {
2579 printf("\n###################Memory Stats Start#################\n");
2580 printf(" numBytes %d\n", stats->numBytes);
2581 printf(" peakNumBytes %d\n", stats->peakNumBytes);
2582 printf(" numAllocs %d\n", stats->numAllocs);
2583 printf(" peakNumAllocs %d\n", stats->peakNumAllocs);
2584 printf(" numAllocFails %d\n", stats->numAllocFails);
2585 printf(" totalNumAllocs %d\n", stats->totalNumAllocs);
2586 printf(" totalNumBytes %d\n", stats->totalNumBytes);
2587 printf("\n###################Memory Stats End###################\n");
2588 }
2589
2590 }
2591 #endif
2592 }
2593 #endif
2594
2595