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 #ifndef INTELL_VOICE_TRIGGER_MODEL_H 16 #define INTELL_VOICE_TRIGGER_MODEL_H 17 18 #include <cstdint> 19 #include <memory> 20 #include <vector> 21 #include "intell_voice_definitions.h" 22 23 namespace OHOS { 24 namespace IntellVoiceTrigger { 25 class TriggerModel { 26 public: 27 enum TriggerModelVersion { 28 MODLE_VERSION_1 = 1, 29 MODLE_VERSION_2 = 2, 30 }; 31 32 TriggerModel(int32_t uuid, int32_t version, TriggerModelType type); 33 virtual ~TriggerModel(); 34 35 bool SetData(const uint8_t *data, uint32_t size); 36 bool SetData(std::vector<uint8_t> &data); 37 void Print(); 38 GetUuid()39 int32_t GetUuid() const 40 { 41 return uuid_; 42 } 43 GetType()44 int32_t GetType() const 45 { 46 return type_; 47 } 48 GetVendorUuid()49 int32_t GetVendorUuid() const 50 { 51 return vendorUuid_; 52 } 53 GetVersion()54 int32_t GetVersion() const 55 { 56 return version_; 57 } 58 GetData()59 std::vector<uint8_t> GetData() const 60 { 61 return data_; 62 } 63 64 protected: 65 int32_t uuid_ = -1; 66 int32_t vendorUuid_ = -1; 67 int32_t version_ = -1; 68 TriggerModelType type_ = UNKNOWN_TYPE; 69 70 private: 71 std::vector<uint8_t> data_; 72 }; 73 74 class GenericTriggerModel : public TriggerModel { 75 public: GenericTriggerModel(int32_t uuid,int32_t version,TriggerModelType type)76 GenericTriggerModel(int32_t uuid, int32_t version, TriggerModelType type) 77 : TriggerModel(uuid, version, type) 78 {} ~GenericTriggerModel()79 ~GenericTriggerModel() override 80 {} 81 }; 82 } // namespace IntellVoiceTrigger 83 } // namespace OHOS 84 85 #endif