/// <summary>Increase the data length and fill the new data with a given value</summary>
        /// <param name="data">The data object</param>
        /// <param name="extraLength">How much to extend the data length by</param>
        /// <param name="fillWith">The value to fill the new bytes with</param>
        /// <returns>`true` if successful</returns>
        public static bool ATDataIncreaseLength(Foundation.ATDataUnsafe data, ulong extraLength, byte fillWith)
        {
            var _arg0 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;
            var _ret  = _Internal.ATDataIncreaseLength(_arg0, extraLength, fillWith);

            return(_ret);
        }
        /// <summary>Determine if a data object owns its storage buffer</summary>
        /// <param name="data">The data object</param>
        /// <returns>`true` if the data object does own its storage</returns>
        public static bool ATDataOwnsStorage(Foundation.ATDataUnsafe data)
        {
            var _arg0 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;
            var _ret  = _Internal.ATDataOwnsStorage(_arg0);

            return(_ret);
        }
        /// <summary>Append bytes to the data</summary>
        /// <param name="data">The data object</param>
        /// <param name="bytesToAppend">A pointer to bytes to append</param>
        /// <param name="length">The length of the bytes to append</param>
        /// <returns>`true` if appending was successful</returns>
        /// <remarks>The bytes will be copied into the data object's storage buffer</remarks>
        public static bool ATDataAppendBytes(Foundation.ATDataUnsafe data, IntPtr bytesToAppend, ulong length)
        {
            var _arg0 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;
            var _ret  = _Internal.ATDataAppendBytes(_arg0, bytesToAppend, length);

            return(_ret);
        }
        /// <summary>Remove bytes from the data</summary>
        /// <param name="data">The data object</param>
        /// <param name="length">The length of data to remove</param>
        /// <param name="index">The index from which to remove the data</param>
        /// <returns>`true` if removal was successful</returns>
        /// <remarks>Will not zero out bytes above new length</remarks>
        public static bool ATDataRemoveBytes(Foundation.ATDataUnsafe data, ulong length, ulong index)
        {
            var _arg0 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;
            var _ret  = _Internal.ATDataRemoveBytes(_arg0, length, index);

            return(_ret);
        }
 public ATDataUnsafe(Foundation.ATDataUnsafe _0)
 {
     _Instance                     = Marshal.AllocHGlobal(sizeof(Foundation.ATDataUnsafe._Internal));
     _ownsNativeInstance           = true;
     NativeToManagedMap[_Instance] = this;
     *((Foundation.ATDataUnsafe._Internal *)_Instance) = *((Foundation.ATDataUnsafe._Internal *)_0._Instance);
 }
        /// <summary>Adopt a given storage buffer as the object's storage buffer</summary>
        /// <param name="data">The data object</param>
        /// <param name="storageToAdopt">The storage buffer to adopt</param>
        /// <param name="capacity">The capacity of the storage buffer</param>
        /// <param name="length">The length of data currently stored in the buffer</param>
        /// <param name="shouldOwnStorage">If this data object should assume ownership of the storage buffer</param>
        /// <returns>`true` if the storage was adopted successfully</returns>
        public static bool ATDataAdoptStorage(Foundation.ATDataUnsafe data, IntPtr storageToAdopt, ulong capacity, ulong length, bool shouldOwnStorage)
        {
            var _arg0 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;
            var _ret  = _Internal.ATDataAdoptStorage(_arg0, storageToAdopt, capacity, length, shouldOwnStorage);

            return(_ret);
        }
Пример #7
0
        /// <summary>Parse data into multiple config objects</summary>
        /// <param name="data">The data to parse</param>
        /// <param name="configStorage">An array of pointers to config objects, already initiated.</param>
        /// <param name="portsAvailable">The ports that are currently available. If a port is not available, no data will be parsed for that port and the config object's `available` property will be set to false</param>
        /// <returns>`true` if successful, otherwise `false`.</returns>
        public static bool ATAnalogInputConfigParseMultiple(Foundation.ATDataUnsafe data, DeviceConfiguration.ATAnalogInputConfigUnsafe[] configStorage, byte portsAvailable)
        {
            var _arg0 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;

            if (configStorage == null || configStorage.Length != 8)
            {
                throw new ArgumentOutOfRangeException("configStorage", "The dimensions of the provided array don't match the required size.");
            }
            IntPtr[] _configStorage;
            if (ReferenceEquals(configStorage, null))
            {
                _configStorage = null;
            }
            else
            {
                _configStorage = new IntPtr[configStorage.Length];
                for (int i = 0; i < _configStorage.Length; i++)
                {
                    var _element = configStorage[i];
                    _configStorage[i] = ReferenceEquals(_element, null) ? IntPtr.Zero : _element._Instance;
                }
            }
            var _arg1 = _configStorage;
            var _ret  = _Internal.ATAnalogInputConfigParseMultiple(_arg0, _arg1, portsAvailable);

            return(_ret);
        }
        /// <summary>Resize a data object's length</summary>
        /// <param name="data">The data object</param>
        /// <param name="newLength">The new length of the data object. If longer than current capacity, buffer resize will be attempted.</param>
        /// <returns>`true` if resize was successful. If not the buffer and data length will remain the same size</returns>
        /// <remarks>After resizing, the buffer pointer may change. If the data object does not own the data buffer then it cannot resize it so this will fail.</remarks>
        public static bool ATDataResize(Foundation.ATDataUnsafe data, ulong newLength)
        {
            var _arg0 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;
            var _ret  = _Internal.ATDataResize(_arg0, newLength);

            return(_ret);
        }
        /// <summary>Copy a data object into a new destination object</summary>
        /// <param name="destination">The destination object</param>
        /// <param name="source">The source object</param>
        /// <returns>`true` if the copy was successful</returns>
        /// <remarks>Will also copy the data buffer to the destination's buffer (as much as will fit in the destination capacity without resizing destination)</remarks>
        public static bool ATDataCopy(Foundation.ATDataUnsafe destination, Foundation.ATDataUnsafe source)
        {
            var _arg0 = ReferenceEquals(destination, null) ? IntPtr.Zero : destination._Instance;
            var _arg1 = ReferenceEquals(source, null) ? IntPtr.Zero : source._Instance;
            var _ret  = _Internal.ATDataCopy(_arg0, _arg1);

            return(_ret);
        }
        /// <summary>Determine if two data objects are equal</summary>
        /// <param name="data1">The first data object</param>
        /// <param name="data2">The second data object</param>
        /// <returns>`true` if the data objects are equal (the bytes in the data buffer are the same and the length is the same)</returns>
        public static bool ATDataIsEqual(Foundation.ATDataUnsafe data1, Foundation.ATDataUnsafe data2)
        {
            var _arg0 = ReferenceEquals(data1, null) ? IntPtr.Zero : data1._Instance;
            var _arg1 = ReferenceEquals(data2, null) ? IntPtr.Zero : data2._Instance;
            var _ret  = _Internal.ATDataIsEqual(_arg0, _arg1);

            return(_ret);
        }
        /// <summary>Adopt a range of data into the subData object without copying.</summary>
        /// <param name="data">The data object</param>
        /// <param name="subData">The subdata object to adopt the buffer into</param>
        /// <param name="offset">The offset to start copying from</param>
        /// <param name="length">The length of data to copy</param>
        /// <returns>`true` if adoption was successful</returns>
        /// <remarks>The subData object will simply hold a pointer to the original `data` object's buffer at `offset`.</remarks>
        public static bool ATDataSubdataNoCopyWithRange(Foundation.ATDataUnsafe data, Foundation.ATDataUnsafe subData, ulong offset, ulong length)
        {
            var _arg0 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;
            var _arg1 = ReferenceEquals(subData, null) ? IntPtr.Zero : subData._Instance;
            var _ret  = _Internal.ATDataSubdataNoCopyWithRange(_arg0, _arg1, offset, length);

            return(_ret);
        }
        /// <summary>Initialize a new data object with given bytes by storing a pointer to the data without copying it</summary>
        /// <param name="data">The object to initialize. Can be `NULL` so the result from `ATDataNew` can be passed directly, in which case it will simply return `NULL`</param>
        /// <param name="existingData">A pointer to some existing data to use in the new data object</param>
        /// <param name="length">The length of the existing data</param>
        /// <param name="capacity">The capacity of the buffer pointed to. This can be larger or the same as the length but not smaller.</param>
        /// <returns>The initialized data object with the existing data copied in or `NULL` if initialization failed</returns>
        public static Foundation.ATDataUnsafe ATDataInitWithBytesNoCopy(Foundation.ATDataUnsafe data, IntPtr existingData, ulong length, ulong capacity)
        {
            var _arg0 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;
            var _ret  = _Internal.ATDataInitWithBytesNoCopy(_arg0, existingData, length, capacity);

            Foundation.ATDataUnsafe _result0;
            if (_ret == IntPtr.Zero)
            {
                _result0 = null;
            }
            else if (Foundation.ATDataUnsafe.NativeToManagedMap.ContainsKey(_ret))
            {
                _result0 = (Foundation.ATDataUnsafe)Foundation.ATDataUnsafe.NativeToManagedMap[_ret];
            }
            else
            {
                _result0 = Foundation.ATDataUnsafe._CreateInstance(_ret);
            }
            return(_result0);
        }
        /// <summary>Initialize a new data object with empty bytes</summary>
        /// <param name="data">The object to initialize. Can be `NULL` so the result from `ATDataNew` can be passed directly, in which case it will simply return `NULL`</param>
        /// <returns>The initialized object or `NULL` if initialization failed</returns>
        public static Foundation.ATDataUnsafe ATDataInit(Foundation.ATDataUnsafe data)
        {
            var _arg0 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;
            var _ret  = _Internal.ATDataInit(_arg0);

            Foundation.ATDataUnsafe _result0;
            if (_ret == IntPtr.Zero)
            {
                _result0 = null;
            }
            else if (Foundation.ATDataUnsafe.NativeToManagedMap.ContainsKey(_ret))
            {
                _result0 = (Foundation.ATDataUnsafe)Foundation.ATDataUnsafe.NativeToManagedMap[_ret];
            }
            else
            {
                _result0 = Foundation.ATDataUnsafe._CreateInstance(_ret);
            }
            return(_result0);
        }
        /// <summary>Create a new data object, for use in subclasses</summary>
        /// <param name="optionalStorage">Optionally, a pointer to a struct or memory where the object can be stored</param>
        /// <param name="type">The type of object we are creating</param>
        /// <returns>A new object subclassing `ATData` of the type and size specified</returns>
        public static Foundation.ATDataUnsafe ATDataSubclassNew(Foundation.ATDataUnsafe optionalStorage, Foundation.ATObjectType type)
        {
            var _arg0 = ReferenceEquals(optionalStorage, null) ? IntPtr.Zero : optionalStorage._Instance;
            var _ret  = _Internal.ATDataSubclassNew(_arg0, type);

            Foundation.ATDataUnsafe _result0;
            if (_ret == IntPtr.Zero)
            {
                _result0 = null;
            }
            else if (Foundation.ATDataUnsafe.NativeToManagedMap.ContainsKey(_ret))
            {
                _result0 = (Foundation.ATDataUnsafe)Foundation.ATDataUnsafe.NativeToManagedMap[_ret];
            }
            else
            {
                _result0 = Foundation.ATDataUnsafe._CreateInstance(_ret);
            }
            return(_result0);
        }
Пример #15
0
        /// <summary>Get data for multiple configs</summary>
        /// <param name="optionalDataToFill">An optional data object to fill with the generated data</param>
        /// <param name="configStorage">An array of pointers to config objects, already initiated.</param>
        /// <param name="portsAvailable">The ports that are currently available. If a port is not available, no data will be generated for that port</param>
        /// <param name="includeLimits">If `true`, will include the limit values</param>
        /// <returns>The generated data. On failure, returns `NULL`. Otherwise, if `optionalDataToFill` is NULL, returns a data object owned by caller with retain count 1, otherwise returns `optionalDataToFill`</returns>
        public static Foundation.ATDataUnsafe ATAnalogInputConfigGetDataMultiple(Foundation.ATDataUnsafe optionalDataToFill, DeviceConfiguration.ATAnalogInputConfigUnsafe[] configStorage, byte portsAvailable, bool includeLimits)
        {
            var _arg0 = ReferenceEquals(optionalDataToFill, null) ? IntPtr.Zero : optionalDataToFill._Instance;

            if (configStorage == null || configStorage.Length != 8)
            {
                throw new ArgumentOutOfRangeException("configStorage", "The dimensions of the provided array don't match the required size.");
            }
            IntPtr[] _configStorage;
            if (ReferenceEquals(configStorage, null))
            {
                _configStorage = null;
            }
            else
            {
                _configStorage = new IntPtr[configStorage.Length];
                for (int i = 0; i < _configStorage.Length; i++)
                {
                    var _element = configStorage[i];
                    _configStorage[i] = ReferenceEquals(_element, null) ? IntPtr.Zero : _element._Instance;
                }
            }
            var _arg1 = _configStorage;
            var _ret  = _Internal.ATAnalogInputConfigGetDataMultiple(_arg0, _arg1, portsAvailable, includeLimits);

            Foundation.ATDataUnsafe _result0;
            if (_ret == IntPtr.Zero)
            {
                _result0 = null;
            }
            else if (Foundation.ATDataUnsafe.NativeToManagedMap.ContainsKey(_ret))
            {
                _result0 = (Foundation.ATDataUnsafe)Foundation.ATDataUnsafe.NativeToManagedMap[_ret];
            }
            else
            {
                _result0 = Foundation.ATDataUnsafe._CreateInstance(_ret);
            }
            return(_result0);
        }
Пример #16
0
        /// <summary>Parse data into multiple config objects</summary>
        /// <param name="inputConfigManager">The input config manager</param>
        /// <param name="data">The data to parse</param>
        /// <returns>`true` if successful, otherwise `false`.</returns>
        public static bool ATAnalogInputConfigManagerParseMultiple(DeviceConfiguration.ATAnalogInputConfigManagerUnsafe inputConfigManager, Foundation.ATDataUnsafe data)
        {
            var _arg0 = ReferenceEquals(inputConfigManager, null) ? IntPtr.Zero : inputConfigManager._Instance;
            var _arg1 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;
            var _ret  = _Internal.ATAnalogInputConfigManagerParseMultiple(_arg0, _arg1);

            return(_ret);
        }
Пример #17
0
        /// <summary>Get the analog analog input config data</summary>
        /// <param name="inputConfig">The analog input config</param>
        /// <param name="optionalDataToFill">An optional data object to fill with the generated data</param>
        /// <returns>The generated data. On failure, returns `NULL`. Otherwise, if `optionalDataToFill` is NULL, returns a data object owned by the analog input config object, otherwise returns `optionalDataToFill`</returns>
        public static Foundation.ATDataUnsafe ATAnalogInputConfigGetData(DeviceConfiguration.ATAnalogInputConfigUnsafe inputConfig, Foundation.ATDataUnsafe optionalDataToFill, bool includeLimits)
        {
            var _arg0 = ReferenceEquals(inputConfig, null) ? IntPtr.Zero : inputConfig._Instance;
            var _arg1 = ReferenceEquals(optionalDataToFill, null) ? IntPtr.Zero : optionalDataToFill._Instance;
            var _ret  = _Internal.ATAnalogInputConfigGetData(_arg0, _arg1, includeLimits);

            Foundation.ATDataUnsafe _result0;
            if (_ret == IntPtr.Zero)
            {
                _result0 = null;
            }
            else if (Foundation.ATDataUnsafe.NativeToManagedMap.ContainsKey(_ret))
            {
                _result0 = (Foundation.ATDataUnsafe)Foundation.ATDataUnsafe.NativeToManagedMap[_ret];
            }
            else
            {
                _result0 = Foundation.ATDataUnsafe._CreateInstance(_ret);
            }
            return(_result0);
        }
Пример #18
0
        /// <summary>Parse data into a analog input config object from its binary representation as received from an AirTurn</summary>
        /// <param name="inputConfig">The analog input config object</param>
        /// <param name="data">The data</param>
        /// <param name="lengthParsed">The length of the data</param>
        /// <returns>The initialized object or `NULL` if initialization failed</returns>
        public static bool ATAnalogInputConfigParseData(DeviceConfiguration.ATAnalogInputConfigUnsafe inputConfig, Foundation.ATDataUnsafe data, ref ulong lengthParsed)
        {
            var _arg0 = ReferenceEquals(inputConfig, null) ? IntPtr.Zero : inputConfig._Instance;
            var _arg1 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;

            fixed(ulong *_lengthParsed2 = &lengthParsed)
            {
                var _arg2 = _lengthParsed2;
                var _ret  = _Internal.ATAnalogInputConfigParseData(_arg0, _arg1, _arg2);

                return(_ret);
            }
        }
Пример #19
0
        /// <summary>Initialize a new analog input config object from its binary representation as received from an AirTurn</summary>
        /// <param name="inputConfig">The analog input config object</param>
        /// <param name="data">The data</param>
        /// <param name="lengthParsed">The length of the data</param>
        /// <returns>The initialized object or `NULL` if initialization failed</returns>
        public static DeviceConfiguration.ATAnalogInputConfigUnsafe ATAnalogInputConfigInitWithData(DeviceConfiguration.ATAnalogInputConfigUnsafe inputConfig, Foundation.ATDataUnsafe data, ref ulong lengthParsed)
        {
            var _arg0 = ReferenceEquals(inputConfig, null) ? IntPtr.Zero : inputConfig._Instance;
            var _arg1 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;

            fixed(ulong *_lengthParsed2 = &lengthParsed)
            {
                var _arg2 = _lengthParsed2;
                var _ret  = _Internal.ATAnalogInputConfigInitWithData(_arg0, _arg1, _arg2);

                DeviceConfiguration.ATAnalogInputConfigUnsafe _result0;
                if (_ret == IntPtr.Zero)
                {
                    _result0 = null;
                }
                else if (DeviceConfiguration.ATAnalogInputConfigUnsafe.NativeToManagedMap.ContainsKey(_ret))
                {
                    _result0 = (DeviceConfiguration.ATAnalogInputConfigUnsafe)DeviceConfiguration.ATAnalogInputConfigUnsafe.NativeToManagedMap[_ret];
                }
                else
                {
                    _result0 = DeviceConfiguration.ATAnalogInputConfigUnsafe._CreateInstance(_ret);
                }
                return(_result0);
            }
        }
        /// <summary>Copy bytes from the data object at a given start offset into a given buffer</summary>
        /// <param name="data">The data object</param>
        /// <param name="bytes">The buffer to copy into</param>
        /// <param name="offset">The offset in the data object to copy from</param>
        /// <param name="maxLength">The maximum length of data to copy</param>
        public static void ATDataGetBytesAtOffset(Foundation.ATDataUnsafe data, IntPtr bytes, ulong offset, ulong maxLength)
        {
            var _arg0 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;

            _Internal.ATDataGetBytesAtOffset(_arg0, bytes, offset, maxLength);
        }
Пример #21
0
        /// <summary>Parse data into a analog input config manager object from its binary representation as received from an AirTurn/storage</summary>
        /// <param name="inputConfigManager">The analog input config manager object</param>
        /// <param name="port">The port to parse data for</param>
        /// <param name="data">The data</param>
        /// <param name="lengthParsed">The length of the data</param>
        /// <returns>The initialized object or `NULL` if initialization failed</returns>
        public static bool ATAnalogInputConfigManagerParseData(DeviceConfiguration.ATAnalogInputConfigManagerUnsafe inputConfigManager, DeviceTypes.ATPortUnsafe port, Foundation.ATDataUnsafe data, ref ulong lengthParsed)
        {
            var _arg0 = ReferenceEquals(inputConfigManager, null) ? IntPtr.Zero : inputConfigManager._Instance;
            var _arg2 = ReferenceEquals(data, null) ? IntPtr.Zero : data._Instance;

            fixed(ulong *_lengthParsed3 = &lengthParsed)
            {
                var _arg3 = _lengthParsed3;
                var _ret  = _Internal.ATAnalogInputConfigManagerParseData(_arg0, port, _arg2, _arg3);

                return(_ret);
            }
        }