SetUInt16() 공개 메소드

Writes an UInt16 at a given position
public SetUInt16 ( int position, UInt16 value ) : void
position int
value System.UInt16
리턴 void
        public static DataPacket Create(int size)
        {
            DataPacket p = new DataPacket();

            p.Data = new byte[size];
            p.SetUInt16(2, (ushort)(size - 16));
            return(p);
        }
        internal virtual void Disconnect()
        {
            if (Disposed)
            {
                return;
            }
            if (ioc != null)
            {
                ioc.RemoveChannel(this);
            }
            lock (ConnectionLock)
            {
                if (Status != ChannelStatus.CONNECTED)
                {
                    return;
                }
                Status          = ChannelStatus.DISCONNECTED;
                StartSearchTime = DateTime.Now;
                ioc             = null;
                SID             = 0;

                if (PrivMonitorChanged != null)
                {
                    AfterConnect(action =>
                    {
                        if (MonitoredType == null)
                        {
                            return;
                        }
                        DataPacket p = DataPacket.Create(16 + 16);
                        p.Command    = (ushort)CommandID.CA_PROTO_EVENT_ADD;
                        p.DataType   = (ushort)TypeHandling.Lookup[MonitoredType];
                        p.DataCount  = ChannelDataCount;
                        p.Parameter1 = SID;
                        p.Parameter2 = CID;

                        p.SetUInt16(12 + 16, (ushort)MonitorMask);

                        if (ioc != null)
                        {
                            ioc.Send(p);
                        }
                        else
                        {
                            Disconnect();
                        }
                    });
                }
            }
        }
        void SendMonitor(EpicsChannel action)
        {
            if (ChannelDataCount == 0)
            {
                return;
            }

            //Console.WriteLine("Sending new event add");
            DataPacket p = DataPacket.Create(16 + 16);

            p.Command = (ushort)CommandID.CA_PROTO_EVENT_ADD;
            Type t = typeof(TType);

            if (t.IsArray)
            {
                t = t.GetElementType();
            }
            else if (t.IsGenericType)
            {
                if (t.GetGenericArguments().First() == typeof(object))
                {
                    t = t.GetGenericTypeDefinition().MakeGenericType(new Type[] { channelDefinedType });
                }
            }
            p.DataType   = (ushort)TypeHandling.Lookup[t];
            p.DataCount  = ChannelDataCount;
            p.Parameter1 = SID;
            p.Parameter2 = CID;

            p.SetUInt16(12 + 16, (ushort)MonitorMask);

            if (ioc != null)
            {
                ioc.Send(p);
            }
        }
 public static DataPacket Create(int size)
 {
     DataPacket p = new DataPacket();
     p.Data = new byte[size];
     p.SetUInt16(2, (ushort)(size - 16));
     return p;
 }