1 /* 2 * Copyright (C) 2021 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 MMS_BUFFER_H 17 #define MMS_BUFFER_H 18 19 #include <string> 20 #include <vector> 21 #include <memory> 22 23 namespace OHOS { 24 namespace Telephony { 25 class MmsBuffer { 26 public: 27 MmsBuffer(); 28 virtual ~MmsBuffer(); 29 virtual std::unique_ptr<char[]> ReadDataBuffer(uint32_t desLen); 30 virtual std::unique_ptr<char[]> ReadDataBuffer(uint32_t offset, uint32_t desLen); 31 virtual bool WriteDataBuffer(std::unique_ptr<char[]> inBuff, uint32_t len); 32 virtual bool WriteBufferFromFile(std::string &strPathName); 33 virtual uint32_t GetCurPosition() const; 34 virtual uint32_t GetSize() const; 35 protected: 36 std::unique_ptr<char[]> pduBuffer_; 37 uint32_t curPosition_ = 0; 38 uint32_t totolLength_ = 0; 39 uint32_t savePosition_ = 0; 40 const uint32_t CODE_BUFFER_MAX_SIZE = 300 * 1024; 41 }; 42 } // namespace Telephony 43 } // namespace OHOS 44 #endif