本文整理汇总了C#中Port.open方法的典型用法代码示例。如果您正苦于以下问题:C# Port.open方法的具体用法?C# Port.open怎么用?C# Port.open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Port
的用法示例。
在下文中一共展示了Port.open方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: openSender
/// <summary>
///
/// </summary>
/// <param name="namePort"></param>
public void openSender(string namePort)
{
if (!String.IsNullOrEmpty(namePort))
{
Network.init();
outPort = new Port();
outPort.open(namePort);
}
}
示例2: SpeechRecognizerServer
public SpeechRecognizerServer(string moduleName)
{
System.Collections.ObjectModel.ReadOnlyCollection<RecognizerInfo> installedRecognizers = SpeechRecognitionEngine.InstalledRecognizers();
//Synchronous Recognition
m_reco = new System.Speech.Recognition.SpeechRecognitionEngine(myLanguage);
Network.init();
m_moduleName = moduleName;
//TTS
m_tts = new System.Speech.Synthesis.SpeechSynthesizer();
m_portISpeak = new Port();
m_portISpeak.open("/" + moduleName + "/tts/iSpeak:o");
Network.connect("/" + moduleName + "/tts/iSpeak:o", "/iSpeak");
//Grammars
GrammarBuilder dictation = new GrammarBuilder();
dictation.Culture = myLanguage;
dictation.AppendDictation();
m_grammar_dictation = new Grammar(dictation);
GrammarBuilder spelling = new GrammarBuilder();
spelling.Culture = myLanguage;
spelling.AppendDictation("spelling");
m_grammar_dictation_spelling = new Grammar(spelling);
m_grammar_continuous = new GrammarBuilder("For sure this non empty grammar will never be recognized.");
m_reco.SetInputToDefaultAudioDevice();
m_reco.LoadGrammar(m_grammar_dictation);
//Continuous Recognition
m_reco_continuous = new SpeechRecognitionEngine();
m_reco_continuous.SetInputToDefaultAudioDevice();
m_portContinuousRecognition = new Port();
m_portContinuousRecognition.open("/" + moduleName + "/recog/continuous:o");
m_reco_continuous.LoadGrammar(new Grammar(m_grammar_continuous));
m_reco_continuous.RecognizeCompleted += onContinuousRecognitionResult;
m_reco_continuous.RecognizeAsync();
m_grammarManager = new RobotGrammarManager();
m_grammarManager.InitialiseVocabulories();
SetLanguage("EN-us");
//SetLanguage("fr-fr");
Console.WriteLine("#########################");
Console.WriteLine("# Speech Recognizer #");
Console.WriteLine("#########################");
Network.init();
m_rpcPort = new Port();
m_rpcPort.open("/" + m_moduleName + "/rpc");
m_rpcThread = new System.Threading.Thread(HandleRPC);
m_rpcThread.Start();
}
示例3: openConnectionToDb
/// <summary>
///
/// </summary>
/// <param name="nameOutputPort"></param>
/// <param name="namePortDb"></param>
/// <returns></returns>
public bool openConnectionToDb(string nameOutputPort, string namePortDb)
{
if (!String.IsNullOrEmpty(namePortDb) && !String.IsNullOrEmpty(nameOutputPort))
{
Network.init();
outPort = new Port();
outPort.open(nameOutputPort);
style = new ContactStyle();
style.persistent = true;
if (PortExists(namePortDb))
{
//if (Network.isConnected(nameOutputPort, namePortDb, style))
Network.disconnect(nameOutputPort, namePortDb,style);
if (Network.connect(nameOutputPort, namePortDb, style))
{
Console.WriteLine(namePortDb + " port is connected to " + nameOutputPort);
return true;
}
else
return false;
}
else
return false;
}
else
return false;
}