}
};
+ListenerManager.prototype.removeAllListeners = function () {
+ this.native.removeListener(this.listenerName);
+ this.listeners = {};
+ this.nativeSet = false;
+};
+
var VcResultListener = new ListenerManager(native_, 'onresult', function(result, listener) {
listener(result.event, result.list, result.results);
});
if (native_.isFailure(result)) {
throw native_.getErrorObject(result);
}
+ VcLangListener.removeAllListeners();
+ VcResultListener.removeAllListeners();
};
// Constructor of VoiceControlCommand
namespace voicecontrol {
VoiceControlClient::VoiceControlClient() : is_result_cb_set(false), is_lang_cb_set(false) {
+ ScopeLogger();
}
VoiceControlClient::~VoiceControlClient() {
+ ScopeLogger();
}
common::PlatformResult VoiceControlClient::GetCurrentLanguage(std::string* language) {
using namespace extension::voicecontrol;
VoiceControlInstance::VoiceControlInstance() : voice_control_client() {
+ ScopeLogger();
using namespace std::placeholders;
#define REGISTER_SYNC(c, x) \
RegisterSyncHandler(c, std::bind(&VoiceControlInstance::x, this, _1, _2));
}
VoiceControlInstance::~VoiceControlInstance() {
+ ScopeLogger();
int ret = VC_ERROR_NONE;
ret = vc_deinitialize();
if (VC_ERROR_NONE != ret && VC_ERROR_INVALID_STATE != ret) {
namespace voicecontrol {
const std::string& MakeErrorMessage(const int ret) {
+ ScopeLogger();
switch (ret) {
case VC_ERROR_NONE:
return NO_ERROR;
}
common::PlatformResult MakeErrorObject(const int ret) {
+ ScopeLogger();
std::string message = MakeErrorMessage(ret);
switch (ret) {
case VC_ERROR_NONE:
}
int VcConvertCmdType(const std::string& type) {
+ ScopeLogger("%s", type.c_str());
// TODO add switch here when also other types of command will be also supported.
// For now, only foreground is supported, we return it as the default value.
return VC_COMMAND_TYPE_FOREGROUND;