7 #ifndef _NIM_SDK_CPP_RTS_H_
8 #define _NIM_SDK_CPP_RTS_H_
13 #include "nim_define_include.h"
14 #include "nim_wrapper_util/nim_json_util.h"
15 #include "public_defines.h"
51 std::string GetJsonStr() {
53 nim_cpp_wrapper_util::Json::Value values_temp;
54 values_temp[nim::kNIMRtsVChatCustomAudio] =
custom_audio_ ? 1 : 0;
55 values_temp[nim::kNIMRtsVChatCustomVideo] =
custom_video_ ? 1 : 0;
56 values_temp[nim::kNIMRtsDataRecord] =
data_record_ ? 1 : 0;
58 values_temp[nim::kNIMRtsApnsText] =
apns_;
59 values_temp[nim::kNIMRtsCreateCustomInfo] =
custom_info_;
60 values_temp[nim::kNIMRtsPushEnable] =
push_enable_ ? 1 : 0;
61 values_temp[nim::kNIMRtsNeedBadge] =
need_badge_ ? 1 : 0;
62 values_temp[nim::kNIMRtsNeedFromNick] =
need_nick_ ? 1 : 0;
63 values_temp[nim::kNIMRtsApnsPayload] =
payload_;
64 values_temp[nim::kNIMRtsSound] =
sound_;
65 values_temp[nim::kNIMRtsKeepCalling] =
keepcalling_ ? 1 : 0;
66 values_temp[nim::kNIMRtsWebRtc] =
webrtc_ ? 1 : 0;
68 nim_cpp_wrapper_util::Json::FastWriter fs;
69 json = fs.write(values_temp);
77 class NIM_SDK_CPPWRAPPER_DLL_API
Rts {
79 typedef std::function<void(nim::NIMResCode res_code,
const std::string& session_id,
int channel_type,
const std::string& uid)>
81 typedef std::function<void(
const std::string& session_id,
int channel_type,
const std::string& uid,
const std::string& custom_info)>
83 typedef std::function<void(nim::NIMResCode res_code)> CreateConfCallback;
84 typedef std::function<void(nim::NIMResCode res_code,
const std::string& session_id, int64_t channel_id,
const std::string& custom_info)>
86 typedef std::function<void(nim::NIMResCode res_code,
const std::string& session_id,
int channel_type,
bool accept)> AckCallback;
87 typedef std::function<void(
const std::string& session_id,
int channel_type,
bool accept,
const std::string& uid)> AckNotifyCallback;
88 typedef std::function<void(
const std::string& session_id,
int channel_type,
bool accept)> SyncAckNotifyCallback;
89 typedef std::function<void(
const std::string& session_id,
int channel_type,
int code,
const std::string& json)> ConnectNotifyCallback;
90 typedef std::function<void(
const std::string& session_id,
int channel_type,
const std::string& uid,
int code,
int leave_type)>
92 typedef std::function<void(nim::NIMResCode res_code,
const std::string& session_id)> HangupCallback;
93 typedef std::function<void(
const std::string& session_id,
const std::string& uid)> HangupNotifyCallback;
94 typedef std::function<void(nim::NIMResCode res_code,
const std::string& session_id,
const std::string& info)> ControlCallback;
95 typedef std::function<void(
const std::string& session_id,
const std::string& info,
const std::string& uid)> ControlNotifyCallback;
96 typedef std::function<void(
const std::string& session_id,
int channel_type,
const std::string& uid,
const std::string& data)> RecDataCallback;
97 typedef std::function<void(nim::NIMResCode res_code,
const std::string& session_id,
int channel_type,
const std::string& json)> OptCallback;
108 static void SetProxy(NIMProxyType type,
const std::string& host,
int port,
const std::string& user,
const std::string& password);
125 static void StartChannel(
int channel_type,
const std::string& uid,
RtsStartInfo info,
const StartChannelCallback& cb);
135 static void SetStartNotifyCb(
const StartNotifyCallback& cb);
146 static void CreateConf(
const std::string& name,
const std::string& custom_info,
const CreateConfCallback& cb);
158 static void JoinConf(
const std::string& name,
const std::string& session_id,
bool record,
const JoinConfCallback& cb);
170 static void Ack(
const std::string& session_id,
int channel_type,
bool accept,
bool data_record,
bool audio_record,
const AckCallback& cb);
179 static void SetAckNotifyCb(
const AckNotifyCallback& cb);
186 static void SetSyncAckNotifyCb(
const SyncAckNotifyCallback& cb);
194 static void SetConnectNotifyCb(
const ConnectNotifyCallback& cb);
202 static void SetMemberChangeCb(
const MemberNotifyCallback& cb);
212 static void Control(
const std::string& session_id,
const std::string& info,
const ControlCallback& cb);
219 static void SetControlNotifyCb(
const ControlNotifyCallback& cb);
227 static void SetVChatMode(
const std::string& session_id,
int mode);
236 static void Hangup(
const std::string& session_id,
const HangupCallback& cb);
243 static void SetHangupNotifyCb(
const HangupNotifyCallback& cb);
252 static void Relogin(
const std::string& session_id,
int channel_type, OptCallback cb);
264 static void SendData(
const std::string& session_id,
int channel_type,
const std::string& data,
const std::string& uid =
"");
272 static void SetRecDataCb(
const RecDataCallback& cb);
277 #endif //_NIM_SDK_CPP_RTS_H_