1 /** 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef TEXT_SOURCE_NODE_H_INCLUDED 18 #define TEXT_SOURCE_NODE_H_INCLUDED 19 20 #include <BaseNode.h> 21 #include <mutex> 22 23 /** 24 * @brief This class describes an interface between depacketization module 25 */ 26 class TextSourceNode : public BaseNode 27 { 28 public: 29 TextSourceNode(BaseSessionCallback* callback = nullptr); 30 virtual ~TextSourceNode(); 31 virtual kBaseNodeId GetNodeId(); 32 virtual ImsMediaResult Start(); 33 virtual void Stop(); 34 virtual bool IsRunTime(); 35 virtual bool IsSourceNode(); 36 virtual void SetConfig(void* config); 37 virtual bool IsSameConfig(void* config); 38 virtual void ProcessData(); 39 40 /** 41 * @brief Send real time text message 42 * 43 * @param text Text string to send 44 */ 45 void SendRtt(const android::String8* text); 46 47 private: 48 void SendBom(); 49 50 int32_t mCodecType; 51 int8_t mRedundantLevel; 52 int32_t mRedundantCount; 53 int32_t mTimeLastSent; 54 int32_t mBitrate; 55 bool mSentBOM; 56 std::mutex mMutex; 57 /* set the max payload to send one time, 10 character per one buffing time */ 58 uint8_t mPayload[MAX_RTT_LEN / 3]; 59 }; 60 61 #endif 62