पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv0.0.4

bluetooth_classic

ब्लूटूथ क्लासिक डिवाइस से कनेक्ट करने के लिए एक फ्लटर प्लगइन, मुख्य रूप से सीरियल संचार के साथ काम करने के लिए डिज़ाइन किया गया है।

Android
30-दिन डाउनलोड
1.1 हज़ार
लाइक
27
Pub अंक
145

पैकेज इंस्टॉल करें

flutter pub add bluetooth_classic

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

एक फ्लटर प्लगइन जो ब्लूटूथ क्लासिक डिवाइस से कनेक्शन की अनुमति देता है, मुख्य रूप से सीरियल कम्युनिकेशन के लिए। यह एंड्रॉइड पर ब्लूटूथ क्लासिक पेरिफेरल्स के साथ खोज, जोड़, और डेटा के आदान-प्रदान के लिए एक सीधा इंटरफेस प्रदान करता है। औद्योगिक सेंसर, मेडिकल डिवाइस या कस्टम हार्डवेयर जैसे ऐप्लिकेशन में विश्वसनीय, लो-लेवल डेटा ट्रांसफर की आवश्यकता वाले ऐप्लिकेशन के लिए डिज़ाइन किया गया है। प्लगइन एंड्रॉइड के ब्लूटूथ API के साथ बिना किसी बाधा के एकीकृत है, डेवलपर्स के लिए डिवाइस कम्युनिकेशन पर ध्यान केंद्रित करने के लिए एक न्यूनतम अबस्ट्रैक्शन लेयर प्रदान करता है।

उपयोग

  • पुराने ब्लूटूथ उपकरणों से कनेक्ट करना
  • सीरियल डेटा प्रसारित करना
  • औद्योगिक सेंसर एकीकरण
  • चिकित्सा उपकरण संचार
  • कस्टम हार्डवेयर नियंत्रण

मुख्य विशेषताएँ

  • Android-केवल समर्थन
  • सीरियल संचार फोकस
  • डिवाइस खोज और जोड़ना
  • निम्न स्तरीय डेटा हस्तांतरण
  • ब्लूटूथ क्लासिक के लिए सरल API

इनके लिए उपयुक्त

  • Android ऐप विकासकर्ता
  • हार्डवेयर इंटीग्रेटर्स
  • ब्लूटूथ क्लासिक के साथ आईओटी प्रोजेक्ट्स
  • सीरियल प्रोटोकॉल कार्यान्वयन

विचार योग्य बातें

  • Android प्लेटफॉर्म तक सीमित
  • कोई iOS समर्थन नहीं
  • ब्लूटूथ अनुमति की आवश्यकता है
  • उपकरण सुसंगतता पर निर्भर करता है
  • कनेक्शन स्थितियों का हैंडलिंग

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

bluetooth_classic

A Flutter plugin to connect to Bluetooth Classic devices, mainly designed to work with serial communication.

Pub Version (including pre-releases) Pub Popularity

Features

  • check that permissions are granted to use the device
  • get already paired devices
  • scan for devices
  • connect & disconnect to a device
  • read from connected device
  • write to connected device

Installation

To install the package, simply run flutter pub add bluetooth_classic

Api Documentation

For a list of functions and their definitions, you can look at the documentation on pub.dev

Basic example

Getting Paired Devices
import 'package:bluetooth_classic/bluetooth_classic.dart';

final _bluetoothClassicPlugin = BluetoothClassic();
await _bluetoothClassicPlugin.initPermissions();
List<Device> _discoveredDevices = await _bluetoothClassicPlugin.getPairedDevices();
Scanning for Devices
import 'package:bluetooth_classic/bluetooth_classic.dart';
import 'package:bluetooth_classic/models/device.dart';

final _bluetoothClassicPlugin = BluetoothClassic();
List<Device> _discoveredDevices = [];
await _bluetoothClassicPlugin.initPermissions();
_bluetoothClassicPlugin.onDeviceDiscovered().listen(
  (event) {
    _discoveredDevices = [..._discoveredDevices, event];
  },
);
await _bluetoothClassicPlugin.startScan();
// when you want to stop scanning
await _bluetoothClassicPlugin.stopScan();

Connecting to a device, reading and sending data to it
import 'package:bluetooth_classic/bluetooth_classic.dart';

final _bluetoothClassicPlugin = BluetoothClassic();
Uint8List _data = Uint8List(0);

await _bluetoothClassicPlugin.initPermissions();
// connect to a device with its MAC address and the application uuid you want to use (in this example, serial)
await _bluetoothClassicPlugin.connect("AA:AA:AA:AA", "00001101-0000-1000-8000-00805f9b34fb");

// NB: I'm not doing error checking or seeing if the device is still connected in this code, check the [example folder](/example/lib/main.dart) for a more thorough demonstration
// send data to device
await _bluetoothClassicPlugin.write("ping");

//
_bluetoothClassicPlugin.onDeviceDataReceived().listen((event) {
  setState(() {
    _data = Uint8List.fromList([..._data, ...event]);
  });
});

// disconnect when done
await _bluetoothClassicPlugin.disconnect();

Example Code

You can find the latest example code in the example folder

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 1 आइटम

  • plugin_platform_interface^2.0.2

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट

अभी कोई डेटा उपलब्ध नहीं है।