/// <summary> /// Add binary feed /// </summary> public ReViewFeedBinaryData RegisterBinaryDataFeed() { try { lock (operationLock) { IReView_Tool RPCToolProxy = RPC_Manager.Instance.Get_Client_Proxy <RPC_Client_Proxy_IReView_Tool>(); if (RPCToolProxy != null) { ReViewFeedBinaryData newDataFeed = new ReViewFeedBinaryData(); long id = GetUniqueID(); newDataFeed.DebugID = id; lock (binaryDataFeedsLock) { binaryDataFeedMap.Add(newDataFeed.DebugID, newDataFeed); } return(newDataFeed); } } } catch (Exception) { Disconnect(); } return(null); }
/// <summary> /// Send debug toggle changed /// </summary> public void DebugToggleChanged(string name, bool state) { IReView_Tool RPCToolProxy = RPC_Manager.Instance.Get_Client_Proxy <RPC_Client_Proxy_IReView_Tool>(); if (RPCToolProxy != null) { RPCToolProxy.DebugToggleChanged(name, state); } }
/// <summary> /// Connect to storage server /// </summary> /// <param name="address">Address to connect to (IP or name, will try to resolve)</param> /// <param name="port">Port to conenct to</param> /// <returns>true if succeeded, false if not. Also returns false if already connected (check with IsConnected).</returns> public bool Connect(string ipAddress, int port) { lock (operationLock) { IReView_Tool RPCToolProxy = RPC_Manager.Instance.Get_Client_Proxy <RPC_Client_Proxy_IReView_Tool>(); if (RPCToolProxy != null) { return(false); } IPAddress resolvedAddress = null; if (!IPAddress.TryParse(ipAddress, out resolvedAddress)) { IPHostEntry hostEntry = Dns.GetHostEntry(ipAddress); if (hostEntry != null && hostEntry.AddressList != null && hostEntry.AddressList.Length > 0) { foreach (IPAddress address in hostEntry.AddressList) { if (address.AddressFamily == AddressFamily.InterNetwork) { resolvedAddress = address; break; } } } } IPEndPoint endpoint = new IPEndPoint(resolvedAddress, port); NetworkStream stream = Network.Create_Stream_To(endpoint); RPC_Manager.Instance.Bind(stream); RPC_Manager.Instance.Create_Server_Proxy <RPC_Server_Proxy_IReView_Feed, IReView_Feed>(this); RPC_Manager.Instance.Create_Client_Proxy <RPC_Client_Proxy_IReView_Tool>(); RPC_Manager.Instance.Create_Client_Proxy <RPC_Client_Proxy_IReView_HierarchicalTimelineLog>(); RPC_Manager.Instance.Create_Client_Proxy <RPC_Client_Proxy_IReView_RemoteDebugRenderer>(); RPC_Manager.Instance.Start_Receiver(); return(true); } }
public bool Update(int currentTimeMillis, int inDeltaMillis) { IReView_Tool RPCToolProxy = RPC_Manager.Instance.Get_Client_Proxy <RPC_Client_Proxy_IReView_Tool>(); if (RPCToolProxy == null) { return(false); } keepAliveTimer += inDeltaMillis; if (keepAliveTimer >= keepAliveDelay) { keepAliveTimer = 0; // Reset instead of decrementing by 'keepAliveDelay' not to choke either end with messages // Send heartbeat if connection is still alive RPCToolProxy.Heartbeat(currentTimeMillis); } return(true); }
/// <summary> /// Store arbitrary binary data to the storage server. /// </summary> /// <param name="id">Positive id for the binary feed</param> /// <param name="time">Time for the data</param> /// <param name="data">Data itself</param> public void StoreBinaryData(long id, int time, ref byte[] data) { if (id < 0) { return; } try { lock (operationLock) { IReView_Tool RPCToolProxy = RPC_Manager.Instance.Get_Client_Proxy <RPC_Client_Proxy_IReView_Tool>(); if (RPCToolProxy != null) { RPCToolProxy.StoreBinaryData(id, time, data); } } } catch (Exception) { Disconnect(); } }