• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // ----------------------------------------------------------------------
19 //
20 // This Software is an original work of authorship of PacketVideo Corporation.
21 // Portions of the Software were developed in collaboration with NTT  DoCoMo,
22 // Inc. or were derived from the public domain or materials licensed from
23 // third parties.  Title and ownership, including all intellectual property
24 // rights in and to the Software shall remain with PacketVideo Corporation
25 // and NTT DoCoMo, Inc.
26 //
27 // -----------------------------------------------------------------------
28 /*****************************************************************************/
29 /*  file name            : tsc_command.c                                     */
30 /*  file contents        : Terminal State Control routine                    */
31 /*  draw                 : '96.10.04                                         */
32 /*---------------------------------------------------------------------------*/
33 /*  amendment                                                                */
34 /*              Copyright (C) 1996 NTT DoCoMo                                */
35 /*****************************************************************************/
36 #include    "oscl_base.h"
37 #include    "h245def.h"
38 #include    "tsc_sub.h"         /* Sub Routine Information Header            */
39 #include    "tscmain.h"
40 
41 /*****************************************************************************/
42 /*  function name        : Tsc_EndSessionCommand                             */
43 /*  function outline     : Command (Change or EndSession) procedure          */
44 /*  function discription : Tsc_EndSessionCommand( void )                     */
45 /*  input data           : None                                              */
46 /*  output data          : None                                              */
47 /*  draw time            : '96.10.09                                         */
48 /*---------------------------------------------------------------------------*/
49 /*  amendent career      :                                                   */
50 /*                                                                           */
51 /*              Copyright (C) 1996 NTT DoCoMo                                */
52 /*****************************************************************************/
EndSessionCommand()53 void TSC_324m::EndSessionCommand()
54 {
55     PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
56                     (0, "TSC_324m::EndSessionCommand"));
57     S_ControlMsgHeader infHeader;
58     S_EndSessionCommand endSessionCommand;
59 
60     oscl_memset(&endSessionCommand, 0, sizeof(S_EndSessionCommand));
61     endSessionCommand.index = 1;  // disconnect
62 
63     Tsc_SendDataSet(&infHeader,
64                     H245_PRIMITIVE,
65                     E_PtvId_Cmd_Es,
66                     0,
67                     0,
68                     (uint8*)&endSessionCommand,
69                     sizeof(S_EndSessionCommand));
70     iH245->DispatchControlMessage(&infHeader);
71 }
72 
73 /*****************************************************************************/
74 /*  function name        : Tsc_CmdStcs                                       */
75 /*  function outline     : Command (SendTerminalCapabilitySet) procedure     */
76 /*  function discription : Tsc_CmdStcs( void )                               */
77 /*  input data           : None                                              */
78 /*  output data          : None                                              */
79 /*  draw time            : '96.10.09                                         */
80 /*---------------------------------------------------------------------------*/
81 /*  amendent career      :                                                   */
82 /*                                                                           */
83 /*              Copyright (C) 1996 NTT DoCoMo                                */
84 /*****************************************************************************/
SendTerminalCapabilitySetCommand()85 OSCL_EXPORT_REF void TSC_324m::SendTerminalCapabilitySetCommand()
86 {
87     S_ControlMsgHeader infHeader;
88     S_SendTerminalCapabilitySet sendTerminalCapabilitySet;
89 
90     oscl_memset(&sendTerminalCapabilitySet, 0,
91                 sizeof(S_SendTerminalCapabilitySet));
92 
93     sendTerminalCapabilitySet.index = 1; // genericRequest
94 
95     Tsc_SendDataSet(&infHeader,
96                     H245_PRIMITIVE,
97                     E_PtvId_Cmd_Stcs,
98                     0,
99                     0,
100                     (uint8*)&sendTerminalCapabilitySet,
101                     sizeof(S_SendTerminalCapabilitySet));
102     iH245->DispatchControlMessage(&infHeader);
103 }
104 
105 
106 /*****************************************************************************/
107 /*  function name        : Tsc_CmdEcrpt                                      */
108 /*  function outline     : Command (Encryption) procedure                    */
109 /*  function discription : Tsc_CmdEcrpt( void )                              */
110 /*  input data           : None                                              */
111 /*  output data          : None                                              */
112 /*  draw time            : '96.10.09                                         */
113 /*---------------------------------------------------------------------------*/
114 /*  amendent career      :                                                   */
115 /*                                                                           */
116 /*              Copyright (C) 1996 NTT DoCoMo                                */
117 /*****************************************************************************/
CmdEcrpt()118 void TSC_324m::CmdEcrpt()
119 {
120     S_ControlMsgHeader infHeader;
121     S_EncryptionCommand encryptionCommand;
122 
123     oscl_memset(&encryptionCommand, 0, sizeof(S_EncryptionCommand));
124 
125     encryptionCommand.index = 1; // encryptionIVRequest
126 
127     Tsc_SendDataSet(&infHeader,
128                     H245_PRIMITIVE,
129                     E_PtvId_Cmd_Ecrpt,
130                     0,
131                     0,
132                     (uint8*)&encryptionCommand,
133                     sizeof(S_EncryptionCommand));
134     iH245->DispatchControlMessage(&infHeader);
135 }
136 
137 /*****************************************************************************/
138 /*  function name        : Tsc_CmdFc                                         */
139 /*  function outline     : Command (FlowControl) procedure                   */
140 /*  function discription : Tsc_CmdFc( void )                                 */
141 /*  input data           : None                                              */
142 /*  output data          : None                                              */
143 /*  draw time            : '96.10.09                                         */
144 /*---------------------------------------------------------------------------*/
145 /*  amendent career      :                                                   */
146 /*                                                                           */
147 /*              Copyright (C) 1996 NTT DoCoMo                                */
148 /*****************************************************************************/
CmdFc()149 void TSC_324m::CmdFc()
150 {
151     S_ControlMsgHeader infHeader;
152     S_FlowControlCommand flowControlCommand;
153 
154     oscl_memset(&flowControlCommand, 0, sizeof(S_FlowControlCommand));
155 
156     /// ORIGINAL CODEWORD : {wholeMultiplex, noRestriction}
157     //pFlowControlCommand->fccScope.index = 2;  // wholeMultiplex
158     //pFlowControlCommand->fccRestriction.index = 1; // noRestriction
159 
160     // ALTERNATE CODEWORD: {logicalChannelNumber=3,maximumBitRate=1000}
161     flowControlCommand.fccScope.index = 0;  // logicalChannelNumber
162     flowControlCommand.fccScope.logicalChannelNumber = 3;
163     flowControlCommand.fccRestriction.index = 0; // maximumBitRate
164     flowControlCommand.fccRestriction.maximumBitRate = 1000;
165 
166     Tsc_SendDataSet(&infHeader,
167                     H245_PRIMITIVE,
168                     E_PtvId_Cmd_Fc,
169                     0,
170                     0,
171                     (uint8*)&flowControlCommand,
172                     sizeof(S_FlowControlCommand));
173     iH245->DispatchControlMessage(&infHeader);
174 }
175 
176 /*****************************************************************************/
177 /*  function name        : Tsc_CmdHmr                                  (RAN) */
178 /*  function outline     : H223MultiplexReconfiguration procedure            */
179 /*---------------------------------------------------------------------------*/
180 /*  This routine initiates transmission of H223MultiplexReconfiguration.     */
181 /*  The option argument is in [0...5] corresponding to:                      */
182 /*    {toLevel0, toLevel1, toLevel2, toLevel2Hdr, dFlagStart, dFlagStop}     */
183 /*****************************************************************************/
CmdHmr(int32 option)184 void TSC_324m::CmdHmr(int32 option)
185 {
186     S_ControlMsgHeader infHeader;
187     S_H223MultiplexReconfiguration hmr;
188     S_H223ModeChange modeChange;
189     S_H223AnnexADoubleFlag doubleFlag;
190 
191     oscl_memset(&hmr, 0, sizeof(S_H223MultiplexReconfiguration));
192 
193     if (option < 4)
194     {
195         hmr.index = 0; // h223ModeChange
196         hmr.h223ModeChange = &modeChange;
197         hmr.h223ModeChange->index = (uint16)option;
198     }
199     else
200     {
201         hmr.index = 1; // h223AnnexADoubleFlag
202         hmr.h223AnnexADoubleFlag = &doubleFlag;
203         hmr.h223AnnexADoubleFlag->index = (uint16)(option - 4);
204     }
205 
206     Tsc_SendDataSet(&infHeader,
207                     H245_PRIMITIVE,
208                     E_PtvId_Cmd_Hmr,
209                     0,
210                     0,
211                     (uint8*)&hmr,
212                     sizeof(S_H223MultiplexReconfiguration));
213     iH245->DispatchControlMessage(&infHeader);
214 }
215 
216 /*****************************************************************************/
217 /*  function name        : Tsc_CmdMscl                                       */
218 /*  function outline     : Command (MiscellaneousCommands) procedure         */
219 /*  function discription : Tsc_CmdMscl( int32 )                                */
220 /*  input data           : None                                              */
221 /*  output data          : None                                              */
222 /*  draw time            : '96.10.09                                         */
223 /*---------------------------------------------------------------------------*/
224 /*  NOTE: Input CommandIndex specifies one of the sample commands to transmit*/
225 /*        Currently these are:                                               */
226 /*          0 --> videoFastUpdatePicture for Lcn=3                           */
227 /*          1 --> videoTemporalSpatialTradeOff=29 for Lcn=3                  */
228 /*          2 --> maxH223MUXPDUsize=256 for Lcn=3                            */
229 /*****************************************************************************/
CmdMisc(TCmdMisc type,TPVChannelId channelId,uint32 param)230 void TSC_324m::CmdMisc(TCmdMisc type, TPVChannelId channelId, uint32 param)
231 {
232     S_ControlMsgHeader infHeader;
233     S_MiscellaneousCommand miscellaneousCommand;
234 
235     oscl_memset(&miscellaneousCommand, 0, sizeof(S_MiscellaneousCommand));
236 
237     switch (type)
238     {
239         case EVideoFastUpdatePicture:
240             miscellaneousCommand.logicalChannelNumber = (uint16)channelId;
241             miscellaneousCommand.mcType.index = 5; // videoFastUpdatePicture
242             break;
243         case EVideoTemporalSpatialTradeOff:
244             miscellaneousCommand.logicalChannelNumber = (uint16)channelId;
245             miscellaneousCommand.mcType.index = 7; // videoTemporalSpatialTradeOff
246             miscellaneousCommand.mcType.videoTemporalSpatialTradeOff = (uint8)param;
247             break;
248         case EMaxH223MUXPDUsize:
249             miscellaneousCommand.logicalChannelNumber = (uint16)channelId;
250             miscellaneousCommand.mcType.index = 11; // maxH223MUXPDUsize
251             miscellaneousCommand.mcType.maxH223MUXPDUsize = (uint16)param;
252             break;
253         default:
254             break;
255     }
256 
257     Tsc_SendDataSet(&infHeader,
258                     H245_PRIMITIVE,
259                     E_PtvId_Cmd_Mscl,
260                     0,
261                     0,
262                     (uint8*)&miscellaneousCommand,
263                     sizeof(S_MiscellaneousCommand));
264     iH245->DispatchControlMessage(&infHeader);
265 }
266 
267 /*****************************************************************************/
268 /*  function name        : Tsc_RtdTrfReq                                     */
269 /*  function outline     : Tsc_RtdTrfReq                                     */
270 /*  function discription : Tsc_RtdTrfReq( void )                             */
271 /*  input data           : None                                              */
272 /*  output data          : None                                              */
273 /*  draw time            : '96.10.09                                         */
274 /*---------------------------------------------------------------------------*/
275 /*  amendent career      :                                                   */
276 /*                                                                           */
277 /*              Copyright (C) 1996 NTT DoCoMo                                */
278 /*****************************************************************************/
RtdTrfReq()279 void TSC_324m::RtdTrfReq()
280 {
281     S_ControlMsgHeader infHeader;
282 
283     Tsc_SendDataSet(&infHeader,
284                     H245_PRIMITIVE,
285                     E_PtvId_Rtd_Trf_Req,
286                     0, 0, NULL, 0);
287 
288     // Primitive Send
289     iH245->DispatchControlMessage(&infHeader);
290 
291     return;
292 }
293 
SendModeRequestCommand()294 OSCL_EXPORT_REF void TSC_324m::SendModeRequestCommand()
295 {
296     S_ControlMsgHeader infHeader;
297     PS_RequestMode          pParameter;
298     PS_ModeDescription      pModeDescription;
299     PS_ModeElement          pModeElement, pModeElement2;
300     PS_VideoMode            pVideoMode; /* RAN */
301     PS_AudioMode            pAudioMode; /* WWURM */
302     PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
303                     (0, "TSC_324m::SendModeRequestCommand"));
304 
305     // Buffer Allocate
306     pParameter = (PS_RequestMode)OSCL_DEFAULT_MALLOC(sizeof(S_RequestMode));
307 
308     // TRANSFER.request primitive - Parameter[MODE-ELEMENT]
309     pParameter->size_of_requestedModes = 1;
310 
311     // Buffer Allocate
312     pModeDescription = (PS_ModeDescription)OSCL_DEFAULT_MALLOC(
313                            sizeof(S_ModeDescription));
314 
315     // ModeDescription
316     pModeDescription->size = 2;
317 
318     // Buffer Allocate
319     pModeElement = (PS_ModeElement)OSCL_DEFAULT_MALLOC(
320                        pModeDescription->size * sizeof(S_ModeElement));
321 
322 
323     pModeElement->option_of_h223ModeParameters = false;
324     pModeElement->option_of_v76ModeParameters = false;
325     pModeElement->option_of_h2250ModeParameters = false;
326     pModeElement->option_of_genericModeParameters = false;
327     pModeElement->modeType.index = 1;  // videoMode
328     pModeElement->modeType.videoMode =
329         pVideoMode = (PS_VideoMode) OSCL_DEFAULT_MALLOC(sizeof(S_VideoMode));
330 
331     pVideoMode->index = 3;   // H.263 Video
332     pVideoMode->h263VideoMode = (PS_H263VideoMode) OSCL_DEFAULT_MALLOC(sizeof(S_H263VideoMode));
333     pVideoMode->h263VideoMode->h263Resolution.index = 1; // QCIF
334     pVideoMode->h263VideoMode->bitRate = 480;       // 48000 bits/sec
335     pVideoMode->h263VideoMode->unrestrictedVector = false;
336     pVideoMode->h263VideoMode->arithmeticCoding = false;
337     pVideoMode->h263VideoMode->advancedPrediction = false;
338     pVideoMode->h263VideoMode->pbFrames = false;
339     pVideoMode->h263VideoMode->option_of_errorCompensation = false;
340     pVideoMode->h263VideoMode->option_of_enhancementLayerInfo = false;
341     pVideoMode->h263VideoMode->option_of_h263Options = false;
342 
343     pModeElement2 = &pModeElement[1];
344     pModeElement2->option_of_h223ModeParameters = false;
345     pModeElement2->option_of_v76ModeParameters = false;
346     pModeElement2->option_of_h2250ModeParameters = false;
347     pModeElement2->option_of_genericModeParameters = false;
348     pModeElement2->modeType.index = 2;  // audioMode
349     pModeElement2->modeType.audioMode =
350 
351         pAudioMode = (PS_AudioMode) OSCL_DEFAULT_MALLOC(sizeof(S_AudioMode));
352     PS_GenericCapability    genericCap;
353     pAudioMode->index = 20;
354     pAudioMode->genericAudioMode = genericCap =
355                                        (PS_GenericCapability) OSCL_DEFAULT_MALLOC(sizeof(S_GenericCapability));
356     genericCap->capabilityIdentifier.index = 0;
357     genericCap->capabilityIdentifier.standard =
358         (PS_OBJECTIDENT) OSCL_DEFAULT_MALLOC(sizeof(S_OBJECTIDENT));
359     genericCap->capabilityIdentifier.standard->size = 7;
360     genericCap->capabilityIdentifier.standard->data =
361         (uint8*) OSCL_DEFAULT_MALLOC(7 * sizeof(uint8));
362     genericCap->capabilityIdentifier.standard->data[0] = 0x00;
363     genericCap->capabilityIdentifier.standard->data[1] = 0x08;
364     genericCap->capabilityIdentifier.standard->data[2] = 0x81;
365     genericCap->capabilityIdentifier.standard->data[3] = 0x75;
366     genericCap->capabilityIdentifier.standard->data[4] = 0x01;
367     genericCap->capabilityIdentifier.standard->data[5] = 0x01;
368     genericCap->capabilityIdentifier.standard->data[6] = 0x01;
369     genericCap->option_of_maxBitRate = true;
370     genericCap->maxBitRate = 122;
371     genericCap->option_of_collapsing = true;
372     genericCap->size_of_collapsing = 1;
373     genericCap->collapsing =
374         (PS_GenericParameter) OSCL_DEFAULT_MALLOC(sizeof(S_GenericParameter));
375     genericCap->collapsing[0].parameterIdentifier.index = 0;
376     genericCap->collapsing[0].parameterIdentifier.standard = 0;
377     genericCap->collapsing[0].parameterValue.index = 2;
378     genericCap->collapsing[0].parameterValue.unsignedMin = 1;
379     genericCap->collapsing[0].option_of_supersedes = false;
380     genericCap->option_of_nonCollapsing = true;
381     genericCap->size_of_nonCollapsing = 1;
382     genericCap->nonCollapsing =
383         (PS_GenericParameter) OSCL_DEFAULT_MALLOC(sizeof(S_GenericParameter));
384     genericCap->nonCollapsing[0].parameterIdentifier.index = 0;
385     genericCap->nonCollapsing[0].parameterIdentifier.standard = 1;
386     genericCap->nonCollapsing[0].parameterValue.index = 2;
387     genericCap->nonCollapsing[0].parameterValue.unsignedMin = 1;
388     genericCap->nonCollapsing[0].option_of_supersedes = false;
389 
390     genericCap->option_of_nonCollapsingRaw = false;
391     genericCap->option_of_transport = false;
392 
393 
394     // Link the sub-objects together
395     pModeDescription->item = pModeElement;
396     pParameter->requestedModes = pModeDescription;
397 
398     Tsc_SendDataSet(&infHeader,
399                     H245_PRIMITIVE,
400                     E_PtvId_Mr_Trf_Req,
401                     0,
402                     0,
403                     (uint8*)pParameter,
404                     sizeof(S_RequestMode));
405 
406     // Primitive Send
407     iH245->DispatchControlMessage(&infHeader);
408 
409     Delete_RequestMode(pParameter);
410     OSCL_DEFAULT_FREE(pParameter);
411 
412     return;
413 }
414 
415 /*****************************************************************************/
416 /*  function name        : MrRjtReq                                     */
417 /*  function outline     : MrRjtReq                                     */
418 /*  function discription : MrRjtReq( void )                             */
419 /*  input data           : None                                              */
420 /*  output data          : None                                              */
421 /*  draw time            : '96.10.09                                         */
422 /*---------------------------------------------------------------------------*/
423 /*  amendent career      :                                                   */
424 /*                                                                           */
425 /*              Copyright (C) 1996 NTT DoCoMo                                */
426 /*****************************************************************************/
MrRjtReq()427 void TSC_324m::MrRjtReq()
428 {
429     PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_STACK_TRACE,
430                     (0, "TSC_324m::MrRjtReq"));
431     S_ControlMsgHeader infHeader;
432     S_RmRejectCause     parameter;
433     oscl_memset(&parameter, 0, sizeof(S_RmRejectCause));
434 
435     // REJECT.request primitive - Parameter[CAUSE]
436     parameter.index = 2; // requestDenied
437     Tsc_SendDataSet(&infHeader,
438                     H245_PRIMITIVE,
439                     E_PtvId_Mr_Rjt_Req,
440                     0,
441                     0,
442                     (uint8*)&parameter,
443                     sizeof(S_RmRejectCause));
444 
445     // Primitive Send
446     iH245->DispatchControlMessage(&infHeader);
447 
448     return;
449 
450 }
451 
452