BDRecognizerViewDelegate.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //
  2. // BDRecognizerViewDelegate.h
  3. // BDVoiceRecognitionClient
  4. //
  5. // Created by baidu on 13-9-23.
  6. // Copyright (c) 2013年 baidu. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @class BDRecognizerViewController;
  10. /**
  11. * @brief - 语音弹窗UI的委托接口
  12. */
  13. @protocol BDRecognizerViewDelegate <NSObject>
  14. /**
  15. * @brief 语音识别结果返回,搜索和输入模式结果返回的结构不相同
  16. *
  17. * @param aBDRecognizerView 弹窗UI
  18. * @param aResults 返回结果,原始Json结果
  19. */
  20. - (void)onEndWithViews:(BDRecognizerViewController *)aBDRecognizerViewController withResult:(id)aResult;
  21. @optional
  22. /**
  23. * @brief 录音数据返回
  24. *
  25. * @param recordData 录音数据
  26. * @param sampleRate 采样率
  27. */
  28. - (void)onRecordDataArrived:(NSData *)recordData sampleRate:(int)sampleRate;
  29. /**
  30. * @brief 录音结束
  31. */
  32. - (void)onRecordEnded;
  33. /**
  34. * @brief 返回中间识别结果
  35. *
  36. * @param results: 原始Json结果
  37. */
  38. - (void)onPartialResult:(id)result;
  39. /**
  40. * @brief 发生错误
  41. *
  42. * @param errorClass: 错误类别 (TVoiceRecognitionClientErrorStatusClass)
  43. * @param errorCode: 错误码 (TVoiceRecognitionClientErrorStatus)
  44. * @param errDescription: 错误描述
  45. */
  46. - (void)onError:(int)errClass errCode:(int)errCode errDescription:(NSString *)errDescription;
  47. /**
  48. * @brief 提示语出现
  49. */
  50. - (void)onTipsShow;
  51. /**
  52. * @brief 开始录音
  53. */
  54. - (void)onRecordStart;
  55. /**
  56. * @brief 检测到用户开始说话
  57. */
  58. - (void)onSpeakStart;
  59. /**
  60. * @brief 检测到用户说话结束
  61. */
  62. - (void)onSpeakFinish;
  63. /**
  64. * @brief 识别结束
  65. */
  66. - (void)onRecogFinish;
  67. /**
  68. * @brief 用户点击重试
  69. */
  70. - (void)onClickRetry;
  71. /**
  72. * @brief 弹窗关闭
  73. */
  74. - (void)onDialogClose;
  75. @end
  76. /**
  77. * @brief 语音输入弹窗按钮的委托接口,开发者不需要关心
  78. */
  79. @protocol BDRecognizerDialogDelegate <NSObject>
  80. @required
  81. - (void)voiceRecognitionDialogHelp; // 出现帮助界面
  82. - (void)voiceRecognitionDialogClosed; // 对话框关闭
  83. - (void)voiceRecognitionDialogRetry; // 用户重试
  84. - (void)voiceRecognitionDialogSpeekFinish; // 说完了
  85. - (NSInteger)currentMeterLevel; // 得到当前音量
  86. @end // BDRecognizerDialogDelegate