1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef IINTELL_VOICE_ENGINE_H 17 #define IINTELL_VOICE_ENGINE_H 18 #include "iremote_broker.h" 19 #include "i_intell_voice_engine_callback.h" 20 21 namespace OHOS { 22 namespace IntellVoiceEngine { 23 enum IntellVoiceEngineType { 24 INTELL_VOICE_ENROLL = 0, 25 INTELL_VOICE_WAKEUP, 26 INTELL_VOICE_UPDATE, 27 ENGINE_TYPE_BUT 28 }; 29 30 struct IntellVoiceEngineInfo { 31 std::string wakeupPhrase; 32 bool isPcmFromExternal { false }; 33 int32_t minBufSize { 0 }; 34 int32_t sampleChannels { 0 }; 35 int32_t bitsPerSample { 0 }; 36 int32_t sampleRate { 0 }; 37 }; 38 39 class IIntellVoiceEngine : public IRemoteBroker { 40 public: 41 DECLARE_INTERFACE_DESCRIPTOR(u"HDI.IntellVoice.Engine"); 42 43 enum { 44 INTELL_VOICE_ENGINE_SET_CALLBACK = 0, 45 INTELL_VOICE_ENGINE_ATTACH, 46 INTELL_VOICE_ENGINE_DETACH, 47 INTELL_VOICE_ENGINE_SET_PARAMETER, 48 INTELL_VOICE_ENGINE_GET_PARAMETER, 49 INTELL_VOICE_ENGINE_START, 50 INTELL_VOICE_ENGINE_STOP, 51 INTELL_VOICE_ENGINE_WRITE_AUDIO 52 }; 53 54 virtual void SetCallback(sptr<IRemoteObject> IntellVoiceEngineStub) = 0; 55 virtual int32_t Attach(const IntellVoiceEngineInfo &info) = 0; 56 virtual int32_t Detach(void) = 0; 57 virtual int32_t SetParameter(const std::string &keyValueList) = 0; 58 virtual std::string GetParameter(const std::string &key) = 0; 59 virtual int32_t Start(bool isLast) = 0; 60 virtual int32_t Stop(void) = 0; 61 virtual int32_t WriteAudio(const uint8_t *buffer, uint32_t size) = 0; 62 }; 63 } 64 } 65 66 #endif 67