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 GSM_CB_PDU_DECODE_BUFFER_H 17 #define GSM_CB_PDU_DECODE_BUFFER_H 18 19 #include <memory> 20 21 namespace OHOS { 22 namespace Telephony { 23 class GsmCbPduDecodeBuffer { 24 public: 25 explicit GsmCbPduDecodeBuffer(uint32_t len); 26 virtual ~GsmCbPduDecodeBuffer(); 27 bool GetOneByte(uint8_t &oneByte); 28 uint32_t GetCurPosition(); 29 uint32_t GetSize(); 30 void IncreasePointer(uint32_t offset); 31 bool PickOneByte(uint8_t &oneByte); 32 void SetPointer(uint32_t offset); 33 34 public: 35 std::unique_ptr<char[]> pduBuffer_ { nullptr }; 36 37 private: 38 uint32_t curPosition_ = 0; 39 uint32_t totolLength_ = 0; 40 }; 41 } // namespace Telephony 42 } // namespace OHOS 43 #endif 44