public void ConnectData(int TopicID, string[] Strings) { try { string myReqType = Strings.GetValue(0) as string; string subjectID = Strings.GetValue(1) as string; string headerName = Strings.GetValue(2) as string; //m_Log.Info("ConnectData:In"+myReqType+":"+subjectID+":"+headerName); DataConnectionRequest ds = new DataConnectionRequest(m_CorrelationID, TopicID, subjectID, headerName, Strings); if (isUpdateRequest(myReqType)) { if (headerName == "K2RTDStatus") { this.StatusID = TopicID; updateCommState(); } m_Subscriptions.Add(ds); } m_PendingDataConnect.Add(ds); if (Client.State == CommunicationState.Opened) { if (m_PendingDataConnect.Count > 0) { ReplayRequests(m_PendingDataConnect); m_PendingDataConnect.Clear(); } } //m_Log.Info("PendingSize:" + m_PendingDataConnect.Count.ToString()); } catch (Exception myE) { //m_Log.Error("ConnectData", myE); } }
/// <summary> /// Handle the connect data request - this is the primary way /// we make requests from Excel /// </summary> /// <param name="TopicID"></param> /// <param name="Strings"></param> public void ConnectData(int TopicID, string[] Strings) { lock (s_RequestLock) { try { string myReqType = Strings.GetValue(0) as string; string subjectID = Strings.GetValue(1) as string; string headerName = Strings.GetValue(2) as string; ////m_Log.Info("ConnectData:In" + myReqType + ":" + subjectID + ":" + headerName); m_RTDForm.LastRequest = "ConnectData:In" + myReqType + ":" + subjectID + ":" + headerName; DataConnectionRequest ds = new DataConnectionRequest(m_CorrelationID, TopicID, subjectID, headerName, Strings); // We keep track for any request to published streams // one off requests are not resent or rerequested if (isUpdateRequest(myReqType)) { if (headerName == "K2RTDStatus") { //this.StatusID = TopicID; //updateCommState(); } m_Subscriptions.Add(ds); } if (m_PendingDataConnect == null) { m_PendingDataConnect = new List<DataConnectionRequest>(); } m_PendingDataConnect.Add(ds); if (m_DefaultClientGW.State == K2Gateway.State.open) { if (m_PendingDataConnect.Count > 0) { ReplayRequests(m_PendingDataConnect); m_PendingDataConnect.Clear(); } } } catch (Exception myE) { ////m_Log.Error("ConnectData", myE); } } }
public void ConnectData(int TopicID, string[] Strings) { try { string myReqType = Strings.GetValue(0) as string; string subjectID = Strings.GetValue(1) as string; string headerName = Strings.GetValue(2) as string; m_Log.Info("ConnectData:In" + myReqType + ":" + subjectID + ":" + headerName); DataConnectionRequest ds = new DataConnectionRequest(m_CorrelationID, TopicID, subjectID, headerName, Strings); string data = ""; m_Socket.Send(Encoding.ASCII.GetBytes(m_CorrelationID.ToCharArray()), 2); m_Socket.Send(Encoding.ASCII.GetBytes(TopicID.ToString().ToCharArray()), 2); m_Socket.Send(Encoding.ASCII.GetBytes(subjectID.ToCharArray()), 2); m_Socket.Send(Encoding.ASCII.GetBytes(headerName.ToCharArray()), 2); m_Socket.Send(Encoding.ASCII.GetBytes(data.ToCharArray())); //m_Socket.Send(Encoding.ASCII.GetBytes(data.ToCharArray())); m_Log.Info("PendingSize:" + m_PendingDataConnect.Count.ToString()); } catch (Exception myE) { m_Log.Error("ConnectData", myE); } }
private void sendDataReq(DataConnectionRequest ds) { try { // frame up a request to md sent over the channel to the tool kit K2Gateway.KaiMessageWrap myWrap = new K2Gateway.KaiMessageWrap(); myWrap.Label = "ConnectData"; string[] env = new string[2]; env[0] = ds.AccessID.ToString(); env[1] = ds.TopicID.ToString(); string myData = K2Gateway.StreamHelper.GetAsString(env); myData += "\t"; myData += K2Gateway.StreamHelper.GetAsString(ds.Strings); myWrap.Data = myData; sendRequest(m_DefaultFeedName, myWrap); } catch (Exception myE) { } }