zdk.net
Account.h
1 //
2 // Account.h
3 // ZDK
4 //
5 
6 #ifndef ZDK_NET_Account_h
7 #define ZDK_NET_Account_h
8 
9 #include "native_shared_ptr.h"
10 #include "PublicInterfaces.h"
11 #include "AccountConfig.h"
12 #include "AccountStatus.h"
13 #include "AudioVideoCodecs.h"
14 #include "AccountEventsHandler.h"
15 #include "MessageType.h"
16 #include "ContactStateType.h"
17 #include "Call.h"
18 #include "SIPProbeEventsHandler.h"
19 #include "SecureUserConfigType.h"
20 #include "Result.h"
21 #include "Message.h"
22 #include "ZHandle.h"
23 
24 using namespace System::Collections::Generic;
25 
26 namespace ZDK_NET
27 {
28  ref class AccountConfig;
29  ref class AccountEventsHandler;
30  ref class Call;
31  ref class SIPProbeEventsHandler;
32  ref class Result;
33  ref class Message;
34 
37  public ref class Account : ZHandle
38  {
39  private:
40  //LISTENERS:
41  static GeneralStatusEventListener *AccountEventsHandler_Listener = nullptr;
42  static GeneralStatusEventListener *SIPProbeEventsHandler_Listener = nullptr;
43 
44  static bool RegisterEventListeners()
45  {
46  std::shared_ptr<GeneralStatusEventListener> AccountEventsHandler_Listener_tmp = std::make_shared<GeneralStatusEventListener>();
47  AccountEventsHandler_Listener = AccountEventsHandler_Listener_tmp.get();
48  listenersMap->try_emplace(reinterpret_cast<intptr_t>(AccountEventsHandler_Listener), std::move(AccountEventsHandler_Listener_tmp));
49  std::shared_ptr<GeneralStatusEventListener> SIPProbeEventsHandler_Listener_tmp = std::make_shared<GeneralStatusEventListener>();
50  SIPProbeEventsHandler_Listener = SIPProbeEventsHandler_Listener_tmp.get();
51  listenersMap->try_emplace(reinterpret_cast<intptr_t>(SIPProbeEventsHandler_Listener), std::move(SIPProbeEventsHandler_Listener_tmp));
52  return true;
53  }
54 
55  static bool RegisteredEventListeners = RegisterEventListeners();
56  public:
57  ZDK::IAccount* cppRef = nullptr;
58 
59  Account(ZDK::Shared::Account src);
60  ~Account();
61  !Account();
62 
69  property long long UserHandle
70  {
71  long long get();
72  }
73 
82  property ZDK_NET::AccountConfig^ Configuration
83  {
85  void set(ZDK_NET::AccountConfig^ value);
86  }
87 
92  property long long AccountID
93  {
94  long long get();
95  }
96 
101  property System::String^ AccountName
102  {
103  System::String^ get();
104  void set(System::String^ value);
105  }
106 
113  property ZDK_NET::AccountStatus RegistrationStatus
114  {
115  ZDK_NET::AccountStatus get();
116  }
117 
127  property List<ZDK_NET::AudioVideoCodecs>^ MediaCodecs
128  {
129  List<ZDK_NET::AudioVideoCodecs>^ get();
130  void set(List<ZDK_NET::AudioVideoCodecs>^ value);
131  }
132 
133  property int ActualRegistrationExpiry
134  {
135  int get();
136  }
137 
148 
160 
172 
185 
193 
203 
213 
228  ZDK_NET::Call^ CreateCall(System::String^ calleeNumber, bool handlingVoipPhoneCallEvents, bool video);
229 
236  List<Call^>^ GetActiveCalls();
237 
248  ZDK_NET::Message^ CreateMessage(ZDK_NET::MessageType type);
249 
260  ZDK_NET::Result^ ChatSessionEnd(System::String^ pPeer);
261 
274  ZDK_NET::Result^ SetPresenceStatus(ZDK_NET::ContactStateType status, System::String^ message);
275 
276  ZDK_NET::Result^ StopPushAndUnregister(bool shouldRegister);
277 
278  ZDK_NET::Result^ RelinquishCallOwnership(ZDK_NET::Call^ call);
279 
304  System::String^ GenerateUUID(bool noPrefix, int bufLen);
305 
329 
339 
349 
389  ZDK_NET::Result^ ProbeSipTransport(System::String^ domain, System::String^ outboundProxy, System::String^ username, System::String^ authUsername, System::String^ password);
390 
401 
440  ZDK_NET::Result^ SetTlsConfig(ZDK_NET::SecureUserConfigType userConf, System::String^ fileName, System::String^ passPhrase);
441 
442  virtual long long Handle() override;
443 
444  virtual void Initialize() override;
445 
446  virtual void ReleaseReference() override;
447 
448  };
449 }
450 
451 #endif
ZDK_NET::Result
API invocation status result.
Definition: Result.h:24
ZDK_NET::Account::GenerateUUID
System::String ^ GenerateUUID(bool noPrefix, int bufLen)
Generate a random UUID.
ZDK_NET::SIPProbeEventsHandler
Definition: SIPProbeEventsHandler.h:74
ZDK_NET::Account::RegisterAccount
ZDK_NET::Result ^ RegisterAccount()
Registers the user to the configured service.
ZDK_NET::Account::ChatSessionEnd
ZDK_NET::Result ^ ChatSessionEnd(System::String^ pPeer)
End a chat session.
ZDK_NET::Message
Definition: Message.h:24
ZDK_NET::Account::DropProbeEventListener
void DropProbeEventListener(ZDK_NET::SIPProbeEventsHandler^ value)
Removes a specific already added SIP probe event listener.
ZDK_NET::Account::SetStatusEventListener
void SetStatusEventListener(ZDK_NET::AccountEventsHandler^ value)
Adds a new account event listener.
ZDK_NET::Account::CreateUser
ZDK_NET::Result ^ CreateUser()
Creates a new user account.
ZDK_NET::Account::CreateMessage
ZDK_NET::Message ^ CreateMessage(ZDK_NET::MessageType type)
Creates a new EMPTY chat message with the given type.
ZDK_NET::AccountConfig
General account configuration.
Definition: AccountConfig.h:29
ZDK_NET::Account::ClearMediaCodecs
void ClearMediaCodecs()
Clears the account's codec list.
GeneralStatusEventListener
Definition: GeneralStatusEventListener.h:90
ZDK_NET::Account
The main account class.
Definition: Account.h:38
ZDK_NET::Account::SetPresenceStatus
ZDK_NET::Result ^ SetPresenceStatus(ZDK_NET::ContactStateType status, System::String^ message)
Start a presence publication for the user.
ZDK_NET::Account::ProbeSipTransport
ZDK_NET::Result ^ ProbeSipTransport(System::String^ domain, System::String^ outboundProxy, System::String^ username, System::String^ authUsername, System::String^ password)
Probes for available transports for the given SIP settings.
ZDK_NET::AccountEventsHandler
Definition: AccountEventsHandler.h:162
ZDK_NET::Account::SetProbeEventListener
void SetProbeEventListener(ZDK_NET::SIPProbeEventsHandler^ value)
Adds a new SIP probe event listener.
ZDK_NET::Call
Definition: Call.h:40
ZDK_NET::Account::UnRegister
ZDK_NET::Result ^ UnRegister()
Cancels registration and/or unregisters the user.
ZDK_NET::Account::ReplaceUserRegistration
ZDK_NET::Result ^ ReplaceUserRegistration()
Replace user registration.
ZDK_NET::Account::CreateCall
ZDK_NET::Call ^ CreateCall(System::String^ calleeNumber, bool handlingVoipPhoneCallEvents, bool video)
Creates and starts an outgoing call.
ZDK_NET::Account::GetActiveCalls
List< Call^> ^ GetActiveCalls()
Gets a list with all account's active/ongoing calls.
ZDK_NET::Account::DropStatusEventListener
void DropStatusEventListener(ZDK_NET::AccountEventsHandler^ value)
Removes a specific already added account event listener.
ZDK_NET::Account::RemoveUser
ZDK_NET::Result ^ RemoveUser()
Destroys an user account object.
ZDK_NET::Account::SetTlsConfig
ZDK_NET::Result ^ SetTlsConfig(ZDK_NET::SecureUserConfigType userConf, System::String^ fileName, System::String^ passPhrase)
Configure TLS for a user.
ZDK_NET::ZHandle
Definition: ZHandle.h:18
ZDK_NET::Account::TerminateConnection
ZDK_NET::Result ^ TerminateConnection()
Terminates user's TCP-based connection.