/** * Set the object's metadata */ public override void setMetadata(Metadata mdata) { if ( mobj != null ) { mobj.setData(mdata); } }
/** * Create a Metadata object filled with default values for this object * @return Metadata object with default values */ public override Metadata getDefaultMetadata() { Metadata metadata = new Metadata(); metadata.flags = (int)AccessMode.ACCESS_READWRITE << Metadata.UAVOBJ_ACCESS_SHIFT | (int)AccessMode.ACCESS_READWRITE << Metadata.UAVOBJ_GCS_ACCESS_SHIFT | 0 << Metadata.UAVOBJ_TELEMETRY_ACKED_SHIFT | 0 << Metadata.UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT | (int)UPDATEMODE.UPDATEMODE_ONCHANGE << Metadata.UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT | (int)UPDATEMODE.UPDATEMODE_MANUAL << Metadata.UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT; metadata.flightTelemetryUpdatePeriod = 0; metadata.gcsTelemetryUpdatePeriod = 0; metadata.loggingUpdatePeriod = 1000; return metadata; }
public UAVMetaObject(long objID, String name, UAVDataObject parent) : base(objID, true, name) { this.parent = parent; ownMetadata = new Metadata(); ownMetadata.flags = 0; // TODO: Fix flags ownMetadata.gcsTelemetryUpdatePeriod = 0; ownMetadata.loggingUpdatePeriod = 0; List<String> modesBitField = new List<String>(); modesBitField.Add("FlightReadOnly"); modesBitField.Add("GCSReadOnly"); modesBitField.Add("FlightTelemetryAcked"); modesBitField.Add("GCSTelemetryAcked"); modesBitField.Add("FlightUpdatePeriodic"); modesBitField.Add("FlightUpdateOnChange"); modesBitField.Add("GCSUpdatePeriodic"); modesBitField.Add("GCSUpdateOnChange"); List<UAVObjectField> fields = new List<UAVObjectField>(); fields.Add( new UAVObjectField<bool>("Modes", "", 1, modesBitField, parent) ); fields.Add(new UAVObjectField<UInt16>("Flight Telemetry Update Period", "ms", 1, null, parent)); fields.Add(new UAVObjectField<UInt16>("GCS Telemetry Update Period", "ms", 1, null, parent)); fields.Add(new UAVObjectField<UInt16>("Logging Update Period", "ms", 1, null, parent)); int numBytes = fields.Sum(j=>j.getNumBytes()); // Initialize object // Initialize parent base.initialize(0); initializeFields(fields, new ByteBuffer(numBytes), numBytes); // Setup metadata of parent parentMetadata = parent.getDefaultMetadata(); }
/** * Set the UAVObject metadata GCS access member * \param[in] mode The access mode */ public void SetGcsAccess(Metadata metadata, AccessMode mode) { // Need to convert java enums which have no numeric value to bits SET_BITS(UAVOBJ_GCS_ACCESS_SHIFT, AccessModeNum(mode), 1); }
/** * Abstract functions */ public abstract void setMetadata(Metadata mdata);
/** * Set the metadata held by the metaobject */ public void setData(Metadata mdata) { //QMutexLocker locker(mutex); parentMetadata = mdata; // TODO: Callbacks // emit objectUpdatedAuto(this); // trigger object updated event // emit objectUpdated(this); }
/** * Set the metadata of the metaobject, this function will * do nothing since metaobjects have read-only metadata. */ public override void setMetadata(Metadata mdata) { return; // can not update metaobject's metadata }