使用 ToneController 获取多于一位数
Using ToneController to get more than one digit
我是 UCMA 的新手,我阅读了 UCMA sdk 4.0 中的音调控制器示例。
我知道这是记录用户播放的音调的方式:
void toneController_ToneReceived(object sender, ToneControllerEventArgs e)
{
Console.WriteLine("Tone Received: " + (ToneId)e.Tone + " (" + e.Tone + ")");
if ((ToneId)e.Tone == ToneId.Tone0)
{
_waitForToneReceivedEventCompleted.Set();
}
else
{
ToneController tc = (ToneController)sender;
tc.Send(e.Tone);
}
}
我想知道是否有办法找到从用户那里收到的一系列提示音,而不仅仅是一个(例如 10 位数字),我想用它来直接拨号。
您可以简单地循环执行:
string tone_received = "";
int number_of_tone_received = 0;
while(number_of_tone_received++ < 10)
{
//Sync; wait for ToneReceivedEvent
_waitForToneReceivedEventCompleted.WaitOne();
_waitForToneReceivedEventCompleted.Reset();
}
_waitForToneReceivedEventCompleted.WaitOne();
void toneController_ToneReceived(object sender, ToneControllerEventArgs e)
{
tone_received = tone_received + e.Tone;
_waitForToneReceivedEventCompleted.Set();
}
我是 UCMA 的新手,我阅读了 UCMA sdk 4.0 中的音调控制器示例。 我知道这是记录用户播放的音调的方式:
void toneController_ToneReceived(object sender, ToneControllerEventArgs e)
{
Console.WriteLine("Tone Received: " + (ToneId)e.Tone + " (" + e.Tone + ")");
if ((ToneId)e.Tone == ToneId.Tone0)
{
_waitForToneReceivedEventCompleted.Set();
}
else
{
ToneController tc = (ToneController)sender;
tc.Send(e.Tone);
}
}
我想知道是否有办法找到从用户那里收到的一系列提示音,而不仅仅是一个(例如 10 位数字),我想用它来直接拨号。
您可以简单地循环执行:
string tone_received = "";
int number_of_tone_received = 0;
while(number_of_tone_received++ < 10)
{
//Sync; wait for ToneReceivedEvent
_waitForToneReceivedEventCompleted.WaitOne();
_waitForToneReceivedEventCompleted.Reset();
}
_waitForToneReceivedEventCompleted.WaitOne();
void toneController_ToneReceived(object sender, ToneControllerEventArgs e)
{
tone_received = tone_received + e.Tone;
_waitForToneReceivedEventCompleted.Set();
}