public DisposableNotificationExHandleBag(IAdsConnection client, IDictionary <string, AnyTypeSpecifier> dict, NotificationSettings settings, object userData) : base(client)
 {
     if (dict == null)
     {
         throw new ArgumentNullException("dict");
     }
     if (dict.Count == 0)
     {
         throw new ArgumentOutOfRangeException("dict");
     }
     base.handleDict      = new SumHandleList();
     base.validHandleDict = new Dictionary <string, uint>();
     foreach (KeyValuePair <string, AnyTypeSpecifier> pair in dict)
     {
         uint             handle    = 0;
         AnyTypeSpecifier specifier = pair.Value;
         Type             tp        = null;
         int[]            args      = null;
         specifier.GetAnyTypeArgs(out tp, out args);
         AdsErrorCode errorCode = client.TryAddDeviceNotificationEx(pair.Key, settings, userData, tp, args, out handle);
         base.handleDict.Add(new SumHandleInstancePathEntry(pair.Key, handle, errorCode));
         if (errorCode == AdsErrorCode.NoError)
         {
             base.validHandleDict.Add(pair.Key, handle);
         }
     }
 }
예제 #2
0
        public HandleSumReadAnyEntity(uint handle, Type arrayType, AnyTypeSpecifier anyType, PrimitiveTypeConverter converter) : base(handle, -1, 0, converter)
        {
            this.TypeSpec = anyType;
            int size = 0;

            converter.TryGetArrayMarshalSize(this.TypeSpec, out size);
            base.readLength = size;
        }
예제 #3
0
        public static IObservable <object> WhenNotification(this IAdsConnection connection, string instancePath, Type type, NotificationSettings settings)
        {
            Dictionary <string, AnyTypeSpecifier> symbols = new Dictionary <string, AnyTypeSpecifier>();
            AnyTypeSpecifier specifier = new AnyTypeSpecifier(type);

            symbols.Add(instancePath, specifier);
            return(Observable.Select <NotificationEx, object>(connection.WhenNotificationEx(symbols, settings, null), n => n.Value));
        }
예제 #4
0
 public HandleSumReadAnyEntity(uint handle, Type tp, PrimitiveTypeConverter converter) : base(handle, converter)
 {
     base.readLength  = PrimitiveTypeConverter.MarshalSize(tp);
     base.writeLength = 0;
     this.TypeSpec    = new AnyTypeSpecifier(tp);
 }
예제 #5
0
 public HandleSumReadAnyEntity(uint handle, int strLen, PrimitiveTypeConverter converter) : base(handle, -1, 0, converter)
 {
     this.TypeSpec   = new AnyTypeSpecifier(typeof(string), strLen);
     base.readLength = converter.MarshalSize(strLen);
 }