Esempio n. 1
0
        public static ReadRequestHandler ReadCharastristicRequest(ulong addr, UuidHandler serviceUuid, UuidHandler charaUuid)
        {
            var ptr    = _BlePluginReadCharacteristicRequest(addr, serviceUuid.ptr, charaUuid.ptr);
            var handle = new ReadRequestHandler(ptr);

            return(handle);
        }
Esempio n. 2
0
        public static UuidHandler GetDeviceCharastricServiceUuid(BleDeviceHandler handle, int idx)
        {
            var ptr  = _BlePluginDeviceCharastricServiceUuid(handle.ptr, idx);
            var uuid = new UuidHandler(ptr);

            return(uuid);
        }
Esempio n. 3
0
        public static unsafe UuidData ConvertUuidData(UuidHandler handler)
        {
            UuidData   data       = new UuidData();
            UuidBuffer uuidBuffer = new UuidBuffer();
            void *     ptr        = &uuidBuffer.fixedBuffer[0];

            _BlePluginConvertUuidUint128(handler.ptr, new IntPtr(ptr));

            data.data1 = uuidBuffer.fixedBuffer[0];
            data.data2 = uuidBuffer.fixedBuffer[1];
            data.data3 = uuidBuffer.fixedBuffer[2];
            data.data4 = uuidBuffer.fixedBuffer[3];
            return(data);
        }
Esempio n. 4
0
        public static string GetUuidStr(UuidHandler handle)
        {
            string str;

            if (uuidDictByHandle.TryGetValue(handle, out str))
            {
                return(str);
            }
            var data = DllInterface.ConvertUuidData(handle);

            str = data.ToString();
            uuidDictByStr.Add(str, handle);
            uuidDictByHandle.Add(handle, str);
            return(str);
        }
Esempio n. 5
0
        public static UuidHandler GetUuid(string str)
        {
            uint d1, d2, d3, d4;

            str = str.ToUpper();
            var handle = new UuidHandler();

            if (uuidDictByStr.TryGetValue(str, out handle))
            {
                return(handle);
            }
            ParseUuid(str, out d1, out d2, out d3, out d4);
            handle = DllInterface.GetOrCreateUuidObject(d1, d2, d3, d4);
            uuidDictByStr.Add(str, handle);
            uuidDictByHandle.Add(handle, str);
            return(handle);
        }
Esempio n. 6
0
 public static void SetNotificationRequest(ulong addr, UuidHandler serviceUuid, UuidHandler charaUuid, bool flag)
 {
     _BlePluginSetNotificateRequest(addr, serviceUuid.ptr, charaUuid.ptr, flag);
 }
Esempio n. 7
0
 public static WriteRequestHandler WriteCharastristicRequest(ulong addr, UuidHandler serviceUuid, UuidHandler charaUuid, byte[] data)
 {
     return(WriteCharastristicRequest(addr, serviceUuid, charaUuid, data, 0, data.Length));
 }
Esempio n. 8
0
        public static unsafe WriteRequestHandler WriteCharastristicRequest(ulong addr, UuidHandler serviceUuid, UuidHandler charaUuid, byte[] data, int idx, int size)
        {
            IntPtr resultPtr;

            fixed(void *ptr = &data[idx])
            {
                var dataPtr = new IntPtr(ptr);

                resultPtr = _BlePluginWriteCharacteristicRequest(addr, serviceUuid.ptr, charaUuid.ptr, dataPtr, size);
            }

            var handle = new WriteRequestHandler(resultPtr);

            return(handle);
        }
Esempio n. 9
0
 public static void AddScanServiceUuid(UuidHandler uuid)
 {
     _BlePluginAddScanServiceUuid(uuid.ptr);
 }