{"id":13413222,"url":"https://github.com/paypal/gatt","last_synced_at":"2025-05-15T12:00:17.628Z","repository":{"id":16322020,"uuid":"19071172","full_name":"paypal/gatt","owner":"paypal","description":"Gatt is a Go package for building Bluetooth Low Energy peripherals","archived":false,"fork":false,"pushed_at":"2022-08-17T00:35:11.000Z","size":657,"stargazers_count":1150,"open_issues_count":50,"forks_count":286,"subscribers_count":48,"default_branch":"master","last_synced_at":"2025-04-14T19:59:09.343Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paypal.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-23T13:45:27.000Z","updated_at":"2025-03-19T06:46:47.000Z","dependencies_parsed_at":"2022-07-19T03:32:04.147Z","dependency_job_id":null,"html_url":"https://github.com/paypal/gatt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fgatt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fgatt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fgatt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paypal%2Fgatt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paypal","download_url":"https://codeload.github.com/paypal/gatt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337611,"owners_count":22054253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:35.496Z","updated_at":"2025-05-15T12:00:17.425Z","avatar_url":"https://github.com/paypal.png","language":"Go","funding_links":[],"categories":["Go","IoT (Internet of Things)","Connectivity","物聯網","物联网","物联网(IOT)","Relational Databases","\u003cspan id=\"物联网-iot-internet-of-things\"\u003e物联网 IoT (Internet of Things)\u003c/span\u003e"],"sub_categories":["Advanced Console UIs","Bluetooth 4.0, Bluetooth Smart (BLE)","Search and Analytic Databases","高級控制台界面","检索及分析资料库","SQL 查询语句构建库","交流","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","高级控制台界面"],"readme":"# Package gatt provides a Bluetooth Low Energy GATT implementation.\n\nGatt (Generic Attribute Profile) is the protocol used to write BLE peripherals (servers) and centrals (clients).\n\nAs a peripheral, you can create services, characteristics, and descriptors,\nadvertise, accept connections, and handle requests.\n\nAs a central, you can scan, connect, discover services, and make requests.\n\n## SETUP\n\n### gatt supports both Linux and OS X.\n\n### On Linux:\nTo gain complete and exclusive control of the HCI device, gatt uses\nHCI_CHANNEL_USER (introduced in Linux v3.14) instead of HCI_CHANNEL_RAW.\nThose who must use an older kernel may patch in these relevant commits\nfrom Marcel Holtmann:\n\n    Bluetooth: Introduce new HCI socket channel for user operation\n    Bluetooth: Introduce user channel flag for HCI devices\n    Bluetooth: Refactor raw socket filter into more readable code\n\nNote that because gatt uses HCI_CHANNEL_USER, once gatt has opened the\ndevice no other program may access it.\n\nBefore starting a gatt program, make sure that your BLE device is down:\n\n    sudo hciconfig\n    sudo hciconfig hci0 down  # or whatever hci device you want to use\n\nIf you have BlueZ 5.14+ (or aren't sure), stop the built-in\nbluetooth server, which interferes with gatt, e.g.:\n\n    sudo service bluetooth stop\n\nBecause gatt programs administer network devices, they must\neither be run as root, or be granted appropriate capabilities:\n\n    sudo \u003cexecutable\u003e\n    # OR\n    sudo setcap 'cap_net_raw,cap_net_admin=eip' \u003cexecutable\u003e\n    \u003cexecutable\u003e\n\n## Usage\nPlease see [godoc.org](http://godoc.org/github.com/paypal/gatt) for documentation.\n\n## Examples\n\n### Build and run the examples on a native environment (Linux or OS X)\n\nGo is a compiled language, which means to run the examples you need to build them first.\n\n    # Build the sample server.\n    go build examples/server.go\n    # Start the sample server.\n    sudo ./server\n\nAlternatively, you can use \"go run\" to build and run the examples in a single step:\n\n    # Build and run the sample server.\n    sudo go run examples/server.go\n\nDiscoverer and explorer demonstrates central (client) functions:\n\n    # Discover surrounding peripherals.\n    sudo go run examples/discoverer.go\n\n    # Connect to and explorer a peripheral device.\n    sudo go run examples/explorer.go \u003cperipheral ID\u003e\n\n### Cross-compile and deploy to a target device\n\n    # Build and run the server example on a ARMv5 target device.\n    GOARCH=arm GOARM=5 GOOS=linux go build examples/server.go\n    cp server \u003ctarget device\u003e\n    # Start the server on the target device\n    sudo ./server\n\nSee the server.go, discoverer.go, and explorer.go in the examples/\ndirectory for writing server or client programs that run on Linux\nand OS X.\n\nUsers, especially on Linux platforms, seeking finer-grained control\nover the devices can see the examples/server_lnx.go for the usage\nof Option, which are platform specific.\n\nSee the rest of the docs for other options and finer-grained control.\n\n## Note\nNote that some BLE central devices, particularly iOS, may aggressively\ncache results from previous connections. If you change your services or\ncharacteristics, you may need to reboot the other device to pick up the\nchanges. This is a common source of confusion and apparent bugs. For an\nOS X central, see http://stackoverflow.com/questions/20553957.\n\n## Known Issues\n\nCurrently OS X vesion  does not support subscribing to indications. \nPlease check [#32](https://github.com/paypal/gatt/issues/32) for the status of this issue.\n\n## REFERENCES\n\ngatt started life as a port of bleno, to which it is indebted:\nhttps://github.com/sandeepmistry/bleno. If you are having\nproblems with gatt, particularly around installation, issues\nfiled with bleno might also be helpful references.\n\nTo try out your GATT server, it is useful to experiment with a\ngeneric BLE client. LightBlue is a good choice. It is available\nfree for both iOS and OS X.\n\ngatt is similar to [bleno](https://github.com/sandeepmistry/bleno) and [noble](https://github.com/sandeepmistry/noble), which offer BLE GATT implementations for node.js.\n\nGatt is released under a [BSD-style license](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaypal%2Fgatt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaypal%2Fgatt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaypal%2Fgatt/lists"}