Esempio n. 1
0
 /// <summary>
 /// The create subscription message.
 /// </summary>
 /// <param name="SID">
 /// The sid.
 /// </param>
 /// <param name="SubscriptionID">
 /// The subscription id.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <param name="dataCount">
 /// The data count.
 /// </param>
 /// <param name="mask">
 /// The mask.
 /// </param>
 /// <returns>
 /// </returns>
 internal byte[] createSubscriptionMessage(
     uint SID, uint SubscriptionID, Type type, ushort dataCount, MonitorMask mask)
 {
     if (type.IsArray)
     {
         if (CTypeTranslator.ContainsKey(type.GetElementType()))
         {
             return(this.createSubscriptionMessage(SID, SubscriptionID, CTypeTranslator[type.GetElementType()], dataCount, mask));
         }
         else
         {
             this.client.ExceptionContainer.Add(new Exception("Requested datatype which is not accepted by Epics"));
             return(this.createSubscriptionMessage(SID, SubscriptionID, EpicsType.String, dataCount, mask));
         }
     }
     else if (CTypeTranslator.ContainsKey(type))
     {
         return(this.createSubscriptionMessage(SID, SubscriptionID, CTypeTranslator[type], dataCount, mask));
     }
     else
     {
         this.client.ExceptionContainer.Add(new Exception("Requested datatype which is not accepted by Epics"));
         return(this.createSubscriptionMessage(SID, SubscriptionID, EpicsType.String, dataCount, mask));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// The set message.
 /// </summary>
 /// <param name="values">
 /// The values.
 /// </param>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <param name="SID">
 /// The sid.
 /// </param>
 /// <param name="CID">
 /// The cid.
 /// </param>
 /// <param name="callBack">
 /// The call back.
 /// </param>
 /// <typeparam name="dataType">
 /// </typeparam>
 /// <returns>
 /// </returns>
 internal byte[] setMessage <dataType>(dataType[] values, Type type, uint SID, uint CID, bool callBack)
 {
     if (type.IsArray)
     {
         if (CTypeTranslator.ContainsKey(type.GetElementType()))
         {
             return(this.setMessage(values, CTypeTranslator[type.GetElementType()], SID, CID));
         }
         else
         {
             this.client.ExceptionContainer.Add(new Exception("Requested datatype which is not accepted by Epics"));
             return(this.setMessage(values, EpicsType.String, SID, CID));
         }
     }
     else if (CTypeTranslator.ContainsKey(type))
     {
         return(this.setMessage(values, CTypeTranslator[type], SID, CID));
     }
     else
     {
         this.client.ExceptionContainer.Add(new Exception("Requested datatype which is not accepted by Epics"));
         return(this.setMessage(values, EpicsType.String, SID, CID));
     }
 }
Esempio n. 3
0
 /// <summary>
 /// The get message.
 /// </summary>
 /// <param name="type">
 /// The type.
 /// </param>
 /// <param name="count">
 /// The count.
 /// </param>
 /// <param name="SID">
 /// The sid.
 /// </param>
 /// <param name="CID">
 /// The cid.
 /// </param>
 /// <returns>
 /// </returns>
 internal byte[] getMessage(Type type, ushort count, uint SID, uint CID)
 {
     if (type.IsArray)
     {
         if (CTypeTranslator.ContainsKey(type.GetElementType()))
         {
             return(this.getMessage(CTypeTranslator[type.GetElementType()], count, SID, CID));
         }
         else
         {
             this.client.ExceptionContainer.Add(new Exception("Requested datatype which is not accepted by Epics"));
             return(this.getMessage(EpicsType.String, count, SID, CID));
         }
     }
     else if (CTypeTranslator.ContainsKey(type))
     {
         return(this.getMessage(CTypeTranslator[type], count, SID, CID));
     }
     else
     {
         this.client.ExceptionContainer.Add(new Exception("Requested datatype which is not accepted by Epics"));
         return(this.getMessage(EpicsType.String, count, SID, CID));
     }
 }