private void sendCovNotification(ObjectCovSubscription sub, long now) { try { UnsignedInteger timeLeft = new UnsignedInteger(sub.GetTimeRemaining(now)); SequenceOf values = new SequenceOf(ObjectCovSubscription.GetValues(this)); if (sub.IsIssueConfirmedNotifications) { // Confirmed ConfirmedCovNotificationRequest req = new ConfirmedCovNotificationRequest( sub.SubscriberProcessIdentifier, localDevice.Configuration.Id, Id, timeLeft, values); RemoteDevice d = localDevice.getRemoteDevice(sub.Address); localDevice.send(d, req); } else { // Unconfirmed UnconfirmedCovNotificationRequest req = new UnconfirmedCovNotificationRequest( sub.SubscriberProcessIdentifier, localDevice.Configuration.Id, Id, timeLeft, values); localDevice.sendUnconfirmed(sub.Address, sub.LinkService, req); } } catch (BACnetException e) { throw e; //ExceptionDispatch.fireReceivedException(e); } }
public Encodable getProperty(PropertyIdentifier pid, UnsignedInteger propertyArrayIndex) { Encodable result = getProperty(pid); if (propertyArrayIndex == null) { return(result); } if (!(result is SequenceOf)) { throw new BACnetServiceException(ErrorClass.Property, ErrorCode.PropertyIsNotAnArray); } SequenceOf array = (SequenceOf )result; uint index = propertyArrayIndex.Value; if (index == 0) { return(new UnsignedInteger((uint)array.Count)); } if (index > array.getCount()) { throw new BACnetServiceException(ErrorClass.Property, ErrorCode.InvalidArrayIndex); } return(array.Get((int)index)); }
internal AtomicReadFileAck(ByteStream queue) { EndOfFile = (BBoolean)read(queue, typeof(BBoolean)); if (popStart(queue) == 0) { FileStartPosition = (SignedInteger)read(queue, typeof(SignedInteger)); FileData = (OctetString)read(queue, typeof(OctetString)); ReturnedRecordCount = null; FileRecordData = null; popEnd(queue, 0); } else { FileStartPosition = (SignedInteger)read(queue, typeof(SignedInteger)); ReturnedRecordCount = (UnsignedInteger)read(queue, typeof(UnsignedInteger)); FileData = null; IList records = new ArrayList(); for (int i = 0; i < ReturnedRecordCount.Value; i++) { records.Add(read(queue, typeof(OctetString))); } FileRecordData = new SequenceOf(records); popEnd(queue, 1); } }
// SELECT SMS_CARD.ULAZNA_PORUKA_ARHIVA_SEQ.NEXTVAL FROM dual; public static int GetNextSequenceValue(SequenceOf sequenceType /*, IHacEncDataContext context*/) { //try //{ // IList<decimal> sequence; // switch (sequenceType) // { // case SequenceOf.SMS_ULAZNA_PORUKA_ARHIVA: // sequence = // context.GetDatabase().SqlQuery<decimal>("SELECT " + // "SMS_CARD." + // "ULAZNA_PORUKA_ARHIVA_SEQ.NEXTVAL FROM DUAL") // .ToList(); // return Convert.ToInt32(sequence[0]); // case SequenceOf.SMS_ULAZNA_PORUKA: // sequence = // context.GetDatabase().SqlQuery<decimal>("SELECT " + // "SMS_CARD." + // "ULAZNA_PORUKA_SEQ.NEXTVAL FROM DUAL").ToList(); // return Convert.ToInt32(sequence[0]); // default: // throw new ArgumentException("Unknown sequence type: " + sequenceType); // } //} //catch (Exception seqEx) //{ // LogFactory.GetLogger().LogFatal(new object(), "Null sequence", seqEx); // throw new Exception("Null sequence"); //} return(1); }
public static ListBuilder <ContractSchedule, ContractScheduleBuilder> CreateDefaultList(int size = 3, bool isNew = true) { var builder = ContractScheduleBuilder.CreateListOfSize(size) .All() .Set(x => x.Id, SequenceOf.Keys(size, isNew).Next); return(builder.ListBuilder); }
public ChangeOfLifeSafety(UnsignedInteger timeDelay, SequenceOf listOfLifeSafetyAlarmValues, SequenceOf listOfAlarmValues, DeviceObjectPropertyReference modePropertyReference) { TimeDelay = timeDelay; ListOfLifeSafetyAlarmValues = listOfLifeSafetyAlarmValues; ListOfAlarmValues = listOfAlarmValues; ModePropertyReference = modePropertyReference; }
protected static SequenceOf readSequenceOf(ByteStream source, Type type, int contextId) { popStart(source, contextId); SequenceOf result = new SequenceOf(source, type, contextId); popEnd(source, contextId); return(result); }
public static ListBuilder <MasterTradingAgreement, MasterTradingAgreementBuilder> CreateDefaultList(int size = 3, bool isNew = true, bool persistRelatives = false) { var builder = CreateListOfSize(size) .All() .Set(x => x.Id, SequenceOf.Keys(size, isNew).Next) .Set(x => x.ContractSchedules, ContractScheduleBuilder.CreateDefaultList(size, isNew).BuildList().ToList()); return(builder.ListBuilder); }
// // // Get property // public Encodable getProperty(PropertyIdentifier pid) { if (pid.Value == PropertyIdentifier.ObjectIdentifier.Value) { return(Id); } if (pid.Value == PropertyIdentifier.ObjectType.Value) { return(Id.ObjectType); } // Check that the requested property is valid for the object. This will throw an exception if the // property doesn't belong. ObjectProperties.getPropertyTypeDefinitionRequired(Id.ObjectType, pid); // Do some property-specific checking here. if (pid.Value == PropertyIdentifier.LocalTime.Value) { return(new Time()); } if (pid.Value == PropertyIdentifier.LocalDate.Value) { return(new Date()); } // AdK - COV subscriptions if (pid.Value == PropertyIdentifier.ActiveCovSubscriptions.Value) { IList objs = localDevice.LocalObjects; SequenceOf covS = new SequenceOf(); // CovSubscriptions foreach (BACnetObject obj in objs) { foreach (ObjectCovSubscription s in obj.covSubscriptions) { RemoteDevice d = localDevice.getRemoteDevice(s.Address); Recipient r = null; if (d != null) { r = new Recipient(d.ObjectIdentifier); } else { r = new Recipient(s.Address); } covS.add(new CovSubscription(new RecipientProcess(r, s.SubscriberProcessIdentifier), new ObjectPropertyReference(obj.Id, PropertyIdentifier.PresentValue), new BBoolean(s.IsIssueConfirmedNotifications), new UnsignedInteger(s.GetTimeRemaining(System.DateTime.Now.Ticks)), obj.getCovIncrement() )); } } return(covS); } return((Encodable)properties[pid]); }
public AtomicReadFileAck(BBoolean endOfFile, SignedInteger fileStartPosition, UnsignedInteger returnedRecordCount, SequenceOf fileRecordData) : base() { EndOfFile = endOfFile; FileStartPosition = fileStartPosition; FileData = null; ReturnedRecordCount = returnedRecordCount; FileRecordData = fileRecordData; }
private readonly SequenceOf listOfValues; //<PropertyValue> public UnconfirmedCovNotificationRequest(UnsignedInteger subscriberProcessIdentifier, ObjectIdentifier initiatingDeviceIdentifier, ObjectIdentifier monitoredObjectIdentifier, UnsignedInteger timeRemaining, SequenceOf listOfValues) { this.subscriberProcessIdentifier = subscriberProcessIdentifier; this.initiatingDeviceIdentifier = initiatingDeviceIdentifier; this.monitoredObjectIdentifier = monitoredObjectIdentifier; this.timeRemaining = timeRemaining; this.listOfValues = listOfValues; }
public void setProperty(PropertyIdentifier pid, uint indexBase1, Encodable value) { ObjectProperties.validateSequenceValue(Id.ObjectType, pid, value); SequenceOf list = (SequenceOf)properties[pid]; if (list == null) { list = new SequenceOf(); setPropertyImpl(pid, list); } list.set((int)indexBase1, value); }
public ReadRangeAck(ObjectIdentifier objectIdentifier, PropertyIdentifier propertyIdentifier, UnsignedInteger propertyArrayIndex, ResultFlags resultFlags, UnsignedInteger itemCount, SequenceOf itemData, UnsignedInteger firstSequenceNumber) { ObjectIdentifier = objectIdentifier; PropertyIdentifier = propertyIdentifier; PropertyArrayIndex = propertyArrayIndex; ResultFlags = resultFlags; ItemCount = itemCount; ItemData = itemData; FirstSequenceNumber = firstSequenceNumber; }
// SequenceOf<Choice> protected static SequenceOf readSequenceOfChoice(ByteStream source, IList types, int contextId) { popStart(source, contextId); SequenceOf result = new SequenceOf(typeof(Choice)); while (readEnd(source) != contextId) { result.add(new Choice(source, types)); } popEnd(source, contextId); return(result); }
public void removeProperty(PropertyIdentifier pid, UnsignedInteger propertyArrayIndex) { PropertyTypeDefinition def = ObjectProperties.getPropertyTypeDefinitionRequired(Id.ObjectType, pid); if (!def.IsSequence) { throw new BACnetServiceException(ErrorClass.Property, ErrorCode.InvalidArrayIndex); } SequenceOf sequence = (SequenceOf)properties[pid]; if (sequence != null) { sequence.remove((int)propertyArrayIndex.Value); } }
internal UnconfirmedCovNotificationRequest(ByteStream queue) { subscriberProcessIdentifier = (UnsignedInteger)read(queue, typeof(UnsignedInteger), 0); initiatingDeviceIdentifier = (ObjectIdentifier)read(queue, typeof(ObjectIdentifier), 1); monitoredObjectIdentifier = (ObjectIdentifier)read(queue, typeof(ObjectIdentifier), 2); timeRemaining = (UnsignedInteger)read(queue, typeof(UnsignedInteger), 3); try { ThreadLocalObjectTypeStack.set(monitoredObjectIdentifier.ObjectType); listOfValues = readSequenceOf(queue, typeof(PropertyValue), 4); } finally { ThreadLocalObjectTypeStack.remove(); } }
internal VTCloseError(byte choice, ByteStream queue) : base(choice, queue, 0) { listOfVTSessionIdentifiers = readOptionalSequenceOf(queue, typeof(UnsignedInteger), 1); }
public ChangeOfBitString(UnsignedInteger timeDelay, BitString bitMask, SequenceOf listOfBitstringValues) { TimeDelay = timeDelay; BitMask = bitMask; ListOfBitstringValues = listOfBitstringValues; }
public ComplexEventType(SequenceOf values) { Values = values; }
public ReadPropertyConditionalAck(SequenceOf listOfReadAccessResults) { ListOfReadAccessResults = listOfReadAccessResults; }
public GetEventInformationAck(SequenceOf listOfEventSummaries, BBoolean moreEvents) { ListOfEventSummaries = listOfEventSummaries; MoreEvents = moreEvents; }
public GetAlarmSummaryAck(SequenceOf values) { Values = values; }
public ReadPropertyMultipleAck(SequenceOf listOfReadAccessResults) { ListOfReadAccessResults = listOfReadAccessResults; }
public ChangeOfState(UnsignedInteger timeDelay, SequenceOf listOfValues) { TimeDelay = timeDelay; ListOfValues = listOfValues; }
public Extended(UnsignedInteger vendorId, UnsignedInteger extendedEventType, SequenceOf parameters) { VendorId = vendorId; ExtendedEventType = extendedEventType; Parameters = parameters; }
public GetEnrollmentSummaryAck(SequenceOf values) { Values = values; }
private readonly SequenceOf listOfVTSessionIdentifiers; // UnsignedInteger public VTCloseError(byte choice, BACnetError error, SequenceOf listOfVTSessionIdentifiers) : base(choice, error) { this.listOfVTSessionIdentifiers = listOfVTSessionIdentifiers; }