srsf/sicc/src/nsssispeechrecognitioncustomcommands.cpp
branchRCL_3
changeset 11 6347473a7bb2
parent 0 bf1d17376201
equal deleted inserted replaced
9:fc313e1df071 11:6347473a7bb2
   619 // -----------------------------------------------------------------------------
   619 // -----------------------------------------------------------------------------
   620 //
   620 //
   621 EXPORT_C void RSISpeechRecognitionCustomCommands::GetPronunciationIDArrayL(
   621 EXPORT_C void RSISpeechRecognitionCustomCommands::GetPronunciationIDArrayL(
   622 	RArray<TSIPronunciationID>& aPronunciationIDs)
   622 	RArray<TSIPronunciationID>& aPronunciationIDs)
   623 	{
   623 	{
       
   624 	CleanupClosePushL( aPronunciationIDs );
   624 	
   625 	
   625 	TPckgBuf<TInt> pckgSize;
   626 	TPckgBuf<TInt> pckgSize;
   626 	
   627 	
   627 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   628 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   628 												ESrGetPronunciationIDArraySize, 
   629 												ESrGetPronunciationIDArraySize, 
   647 		{
   648 		{
   648 		User::LeaveIfError(aPronunciationIDs.Append(stream.ReadUint32L()));
   649 		User::LeaveIfError(aPronunciationIDs.Append(stream.ReadUint32L()));
   649 		}
   650 		}
   650 
   651 
   651 	CleanupStack::PopAndDestroy(2);//stream, buf
   652 	CleanupStack::PopAndDestroy(2);//stream, buf
   652 		
   653 	CleanupStack::Pop();
   653 	}
   654 	}
   654 
   655 
   655 // -----------------------------------------------------------------------------
   656 // -----------------------------------------------------------------------------
   656 // RSISpeechRecognitionCustomCommands::GetRuleIDArrayL
   657 // RSISpeechRecognitionCustomCommands::GetRuleIDArrayL
   657 // Sends a command to get the rule ID array.
   658 // Sends a command to get the rule ID array.
   658 // -----------------------------------------------------------------------------
   659 // -----------------------------------------------------------------------------
   659 //
   660 //
   660 EXPORT_C void RSISpeechRecognitionCustomCommands::GetRuleIDArrayL(
   661 EXPORT_C void RSISpeechRecognitionCustomCommands::GetRuleIDArrayL(
   661 	RArray<TSIRuleID>& aRuleIDs)
   662 	RArray<TSIRuleID>& aRuleIDs)
   662 	{
   663 	{
       
   664 	CleanupClosePushL( aRuleIDs );
   663 
   665 
   664 	TPckgBuf<TInt> pckgSize;
   666 	TPckgBuf<TInt> pckgSize;
   665 	
   667 	
   666 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   668 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   667 												ESrGetRuleIDArraySize, 
   669 												ESrGetRuleIDArraySize, 
   685 		{
   687 		{
   686 		User::LeaveIfError(aRuleIDs.Append(stream.ReadUint32L()));
   688 		User::LeaveIfError(aRuleIDs.Append(stream.ReadUint32L()));
   687 		}
   689 		}
   688 
   690 
   689 	CleanupStack::PopAndDestroy(2);//stream, buf
   691 	CleanupStack::PopAndDestroy(2);//stream, buf
   690 	
   692 	CleanupStack::Pop();
   691 	}
   693 	}
   692 
   694 
   693 // -----------------------------------------------------------------------------
   695 // -----------------------------------------------------------------------------
   694 // RSISpeechRecognitionCustomCommands::GetModelIDArrayL
   696 // RSISpeechRecognitionCustomCommands::GetModelIDArrayL
   695 // Sends a command to get the model ID array.
   697 // Sends a command to get the model ID array.
   696 // -----------------------------------------------------------------------------
   698 // -----------------------------------------------------------------------------
   697 //	
   699 //	
   698 EXPORT_C void RSISpeechRecognitionCustomCommands::GetModelIDArrayL(
   700 EXPORT_C void RSISpeechRecognitionCustomCommands::GetModelIDArrayL(
   699 	RArray<TSIModelID>& aModelIDs)
   701 	RArray<TSIModelID>& aModelIDs)
   700 	{
   702 	{
       
   703 	CleanupClosePushL( aModelIDs );
   701 
   704 
   702 	TPckgBuf<TInt> pckgSize;
   705 	TPckgBuf<TInt> pckgSize;
   703 	
   706 	
   704 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   707 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   705 												ESrGetModelIDArraySize, 
   708 												ESrGetModelIDArraySize, 
   723 		{
   726 		{
   724 		User::LeaveIfError( aModelIDs.Append( (TSIModelID)stream.ReadUint32L() ) );
   727 		User::LeaveIfError( aModelIDs.Append( (TSIModelID)stream.ReadUint32L() ) );
   725 		}
   728 		}
   726 
   729 
   727 	CleanupStack::PopAndDestroy( 2 );//stream, buf
   730 	CleanupStack::PopAndDestroy( 2 );//stream, buf
   728 	
   731 	CleanupStack::Pop();
   729 	}
   732 	}
   730 
   733 
   731 // -----------------------------------------------------------------------------
   734 // -----------------------------------------------------------------------------
   732 // RSISpeechRecognitionCustomCommands::GetGrammarIDArrayL
   735 // RSISpeechRecognitionCustomCommands::GetGrammarIDArrayL
   733 // Sends a command to get the grammar ID array.
   736 // Sends a command to get the grammar ID array.
   734 // -----------------------------------------------------------------------------
   737 // -----------------------------------------------------------------------------
   735 //
   738 //
   736 EXPORT_C void RSISpeechRecognitionCustomCommands::GetGrammarIDArrayL(
   739 EXPORT_C void RSISpeechRecognitionCustomCommands::GetGrammarIDArrayL(
   737 	RArray<TSIGrammarID>& aGrammarIDs)
   740 	RArray<TSIGrammarID>& aGrammarIDs)
   738 	{
   741 	{
   739 
   742 	CleanupClosePushL( aGrammarIDs );
       
   743 	
   740 	TPckgBuf<TInt> pckgSize;
   744 	TPckgBuf<TInt> pckgSize;
   741 	
   745 	
   742 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   746 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   743 												ESrGetGrammarIDArraySize, 
   747 												ESrGetGrammarIDArraySize, 
   744 												KNullDesC8,
   748 												KNullDesC8,
   761 		{
   765 		{
   762 		User::LeaveIfError( aGrammarIDs.Append( (TSIGrammarID)stream.ReadUint32L() ) );
   766 		User::LeaveIfError( aGrammarIDs.Append( (TSIGrammarID)stream.ReadUint32L() ) );
   763 		}
   767 		}
   764 
   768 
   765 	CleanupStack::PopAndDestroy( 2 );//stream, buf
   769 	CleanupStack::PopAndDestroy( 2 );//stream, buf
   766 	
   770 	CleanupStack::Pop();//aGrammarIDs
   767 	}
   771 	}
   768 
   772 
   769 // -----------------------------------------------------------------------------
   773 // -----------------------------------------------------------------------------
   770 // RSISpeechRecognitionCustomCommands::GetLexiconIDArrayL
   774 // RSISpeechRecognitionCustomCommands::GetLexiconIDArrayL
   771 // Sends a command to get the lexicon ID array.
   775 // Sends a command to get the lexicon ID array.
   772 // -----------------------------------------------------------------------------
   776 // -----------------------------------------------------------------------------
   773 //
   777 //
   774 EXPORT_C void RSISpeechRecognitionCustomCommands::GetLexiconIDArrayL(
   778 EXPORT_C void RSISpeechRecognitionCustomCommands::GetLexiconIDArrayL(
   775 	RArray<TSILexiconID>& aLexiconIDs)
   779 	RArray<TSILexiconID>& aLexiconIDs)
   776 	{
   780 	{
       
   781 	CleanupClosePushL( aLexiconIDs );
   777 
   782 
   778 	TPckgBuf<TInt> pckgSize;
   783 	TPckgBuf<TInt> pckgSize;
   779 
   784 
   780 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   785 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   781 												ESrGetLexiconIDArraySize, 
   786 												ESrGetLexiconIDArraySize, 
   800 		{
   805 		{
   801 		User::LeaveIfError( aLexiconIDs.Append( (TSILexiconID)stream.ReadUint32L() ) );
   806 		User::LeaveIfError( aLexiconIDs.Append( (TSILexiconID)stream.ReadUint32L() ) );
   802 		}
   807 		}
   803 
   808 
   804 	CleanupStack::PopAndDestroy(2);//stream, buf
   809 	CleanupStack::PopAndDestroy(2);//stream, buf
   805 	
   810 	CleanupStack::Pop();
   806 	}
   811 	}
   807 
   812 
   808 // -----------------------------------------------------------------------------
   813 // -----------------------------------------------------------------------------
   809 // RSISpeechRecognitionCustomCommands::GetLexiconIDArrayL
   814 // RSISpeechRecognitionCustomCommands::GetLexiconIDArrayL
   810 // Sends a command to get the lexicon ID array.
   815 // Sends a command to get the lexicon ID array.
   811 // -----------------------------------------------------------------------------
   816 // -----------------------------------------------------------------------------
   812 //
   817 //
   813 EXPORT_C void RSISpeechRecognitionCustomCommands::GetModelBankIDArrayL(
   818 EXPORT_C void RSISpeechRecognitionCustomCommands::GetModelBankIDArrayL(
   814 	RArray<TSIModelBankID>& aModelBankIDs)
   819 	RArray<TSIModelBankID>& aModelBankIDs)
   815 	{
   820 	{
       
   821 	CleanupClosePushL( aModelBankIDs );
   816 
   822 
   817 	TPckgBuf<TInt> pckgSize;
   823 	TPckgBuf<TInt> pckgSize;
   818 	
   824 	
   819 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   825 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
   820 												ESrGetModelBankIDArraySize, 
   826 												ESrGetModelBankIDArraySize, 
   838 		{
   844 		{
   839 		User::LeaveIfError( aModelBankIDs.Append( (TSIModelBankID)stream.ReadUint32L() ) );
   845 		User::LeaveIfError( aModelBankIDs.Append( (TSIModelBankID)stream.ReadUint32L() ) );
   840 		}
   846 		}
   841 
   847 
   842 	CleanupStack::PopAndDestroy(2);//stream, buf
   848 	CleanupStack::PopAndDestroy(2);//stream, buf
   843 	
   849 	CleanupStack::Pop();
   844 	}
   850 	}
   845 
   851 
   846 // -----------------------------------------------------------------------------
   852 // -----------------------------------------------------------------------------
   847 // RSISpeechRecognitionCustomCommands::GetSIResultSetL
   853 // RSISpeechRecognitionCustomCommands::GetSIResultSetL
   848 // Sends a command to get the speaker independent recognition result set.
   854 // Sends a command to get the speaker independent recognition result set.
   999 void RSISpeechRecognitionCustomCommands::InternalizeIntArrayL(
  1005 void RSISpeechRecognitionCustomCommands::InternalizeIntArrayL(
  1000 	TDes8& aDes, 
  1006 	TDes8& aDes, 
  1001 	TInt aNumberElements, 
  1007 	TInt aNumberElements, 
  1002 	RArray<TInt>& aArray)
  1008 	RArray<TInt>& aArray)
  1003 	{
  1009 	{
       
  1010 	CleanupClosePushL( aArray );
  1004 
  1011 
  1005 	RDesReadStream stream(aDes);
  1012 	RDesReadStream stream(aDes);
  1006 	CleanupClosePushL(stream);
  1013 	CleanupClosePushL(stream);
  1007 
  1014 
  1008 	for (TInt i=0; i<aNumberElements; i++)
  1015 	for (TInt i=0; i<aNumberElements; i++)
  1009 		{
  1016 		{
  1010 		User::LeaveIfError(aArray.Append(stream.ReadInt32L()));
  1017 		User::LeaveIfError(aArray.Append(stream.ReadInt32L()));
  1011 		}
  1018 		}
  1012 
  1019 
  1013 	CleanupStack::PopAndDestroy();//stream
  1020 	CleanupStack::PopAndDestroy();//stream
  1014 
  1021 	CleanupStack::Pop();
  1015 	}
  1022 	}
  1016 
  1023 
  1017 /************************** New SI functions start here ***********************/
  1024 /************************** New SI functions start here ***********************/
  1018 
  1025 
  1019 // -----------------------------------------------------------------------------
  1026 // -----------------------------------------------------------------------------