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