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); }
public static UuidHandler GetDeviceCharastricServiceUuid(BleDeviceHandler handle, int idx) { var ptr = _BlePluginDeviceCharastricServiceUuid(handle.ptr, idx); var uuid = new UuidHandler(ptr); return(uuid); }
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); }
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); }
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); }
public static void SetNotificationRequest(ulong addr, UuidHandler serviceUuid, UuidHandler charaUuid, bool flag) { _BlePluginSetNotificateRequest(addr, serviceUuid.ptr, charaUuid.ptr, flag); }
public static WriteRequestHandler WriteCharastristicRequest(ulong addr, UuidHandler serviceUuid, UuidHandler charaUuid, byte[] data) { return(WriteCharastristicRequest(addr, serviceUuid, charaUuid, data, 0, data.Length)); }
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); }
public static void AddScanServiceUuid(UuidHandler uuid) { _BlePluginAddScanServiceUuid(uuid.ptr); }