{"id":1195,"url":"https://github.com/1amageek/Bleu","last_synced_at":"2025-07-30T20:32:49.152Z","repository":{"id":56903755,"uuid":"84823610","full_name":"1amageek/Bleu","owner":"1amageek","description":"BLE (Bluetooth LE) for U🎁 Bleu is the best in the Bluetooth library.","archived":false,"fork":false,"pushed_at":"2019-10-10T10:26:35.000Z","size":512,"stargazers_count":492,"open_issues_count":1,"forks_count":31,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-24T16:42:50.648Z","etag":null,"topics":["bluetooth","bluetooth-le","bluetooth-low-energy","ios","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1amageek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-13T12:25:21.000Z","updated_at":"2024-11-11T03:34:56.000Z","dependencies_parsed_at":"2022-08-21T02:50:18.085Z","dependency_job_id":null,"html_url":"https://github.com/1amageek/Bleu","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1amageek%2FBleu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1amageek%2FBleu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1amageek%2FBleu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1amageek%2FBleu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1amageek","download_url":"https://codeload.github.com/1amageek/Bleu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228187562,"owners_count":17882325,"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":["bluetooth","bluetooth-le","bluetooth-low-energy","ios","swift"],"created_at":"2024-01-05T20:15:40.997Z","updated_at":"2024-12-04T20:31:05.826Z","avatar_url":"https://github.com/1amageek.png","language":"Swift","funding_links":[],"categories":["Hardware","Swift"],"sub_categories":["Bluetooth","Other free courses"],"readme":"\u003cimg src=\"https://github.com/1amageek/Bleu/blob/master/Bleu.png\" width=\"100%\"\u003e\n\n# Bleu\nBleu is a Bluetooth library.\nBleu is the easiest way to operate CoreBluetooth.\n\nBleu is possible to operate by replacing Bluetooth 's `Peripheral` and `Central` with `Server` and `Client`.\nBleu can be developed event-driven.\n\n\n [![Version](http://img.shields.io/cocoapods/v/Bleu.svg)](http://cocoapods.org/?q=Bleu)\n [![Platform](http://img.shields.io/cocoapods/p/Bleu.svg)](https://cocoapods.org/pods/Bleu)\n [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)\n [![Downloads](https://img.shields.io/cocoapods/dt/Bleu.svg?label=Total%20Downloads\u0026colorB=28B9FE)](https://cocoapods.org/pods/Bleu)\n\n\n## Installation\n\n\u003c!--\n#### [Carthage](https://github.com/Carthage/Carthage)\n--\u003e\n\n#### [CocoaPods](https://github.com/cocoapods/cocoapods)\n\n- Insert `pod 'Bleu' ` to your Podfile.\n- Run `pod install`.\n\nNote: CocoaPods 1.1.0 is required to install Bleu.\n \n## Usage\n\nPlease customize `Communicable+.swift`.\n\n``` shell\nuuidgen // create uuid\n```\n\n``` Swift\nextension Communicable {\n    \n    public var serviceUUID: CBUUID {\n        return CBUUID(string: \"YOUR UUID\")\n    }\n    \n}\n\nstruct GetUserIDItem: Communicable {\n    \n    public var method: RequestMethod {\n        return .get(isNotified: false)\n    }\n    \n    public var characteristicUUID: CBUUID {\n        return CBUUID(string: \"YOUR UUID\")\n    }\n    \n}\n\nstruct PostUserIDItem: Communicable {\n    \n    public var method: RequestMethod {\n        return .post\n    }\n    \n    public var characteristicUUID: CBUUID {\n        return CBUUID(string: \"YOUR UUID\")\n    }\n    \n}\n\n```\n\n\n### 😃 Get\n\n#### Peripheral(Server)\n``` Swift\nBleu.addReceiver(Receiver(GetUserID(), get: { [weak self] (manager, request) in\n    guard let text: String = self?.textField.text else {\n        manager.respond(to: request, withResult: .attributeNotFound)\n        return\n    }\n    request.value = text.data(using: .utf8)\n    manager.respond(to: request, withResult: .success)\n}))\n\nBleu.startAdvertising()\n```\n\n#### Central(Client)\n``` Swift\nlet request: Request = Request(communication: GetUserID()) { [weak self] (peripheral, characteristic, error) in\n    if let error = error {\n        debugPrint(error)\n        return\n    }\n    \n    let data: Data = characteristic.value!\n    let text: String = String(data: data, encoding: .utf8)!\n    \n    self?.centralTextField.text = text\n}\nBleu.send([request]) { completedRequests, error in\n    if let error = error {\n        print(\"timeout\")\n    }\n}\n```\n\n### 😃 Post \n\n#### Peripheral(Server)\n``` Swift\nBleu.addReceiver(Receiver(PostUserID(), post: { (manager, request) in\n    let data: Data = request.value!\n    let text: String = String(data: data, encoding: .utf8)!\n    print(text)\n    manager.respond(to: request, withResult: .success)\n}))\n\nBleu.startAdvertising()\n```\n\n#### Central(Client)\n``` Swift\nlet data: Data = \"Sample\".data(using: .utf8)!\nlet request: Request = Request(communication: PostUserID()) { (peripheral, characteristic, error) in\n    if let error = error {\n        debugPrint(error)\n        return\n    }\n    \n    print(\"success\")\n}\nrequest.value = data\nBleu.send([request]) { completedRequests, error in\n    if let error = error {\n        print(\"timeout\")\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1amageek%2FBleu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1amageek%2FBleu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1amageek%2FBleu/lists"}