aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElectric-Blue <Electric-Blue@users.noreply.github.com>2016-01-26 01:46:00 +0300
committerElectric-Blue <Electric-Blue@users.noreply.github.com>2016-01-26 01:46:00 +0300
commit27a7a2a18a6db8b67cbe0e86c37cb174de2a1295 (patch)
treec177c4cccdb180c8d52c026db3d6ad3ab26c584f
parent9fcfb43b1080e252c20f72fedeb3a1b69f0f7bdd (diff)
downloadNimBluez-27a7a2a18a6db8b67cbe0e86c37cb174de2a1295.tar.gz
NimBluez-27a7a2a18a6db8b67cbe0e86c37cb174de2a1295.zip
Update on documentation.
-rw-r--r--.gitignore2
-rw-r--r--LICENSE3
-rw-r--r--README.md57
3 files changed, 58 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 67d9b34..a40df19 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-nimcache/
+**/nimcache/
diff --git a/LICENSE b/LICENSE
index fb4c9b9..52fd356 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2016, Electric-Blue
+Copyright (c) 2016, Maxim V. Abramov
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -21,4 +21,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/README.md b/README.md
index 264d252..f22609c 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,57 @@
# NimBluez
-Nim modules for access to system Bluetooth resources.
+
+Modules for access to system [Bluetooth](https://www.bluetooth.com/) resources for the [Nim](http://nim-lang.org/) programming language.
+
+Use [nimbluez.bluetooth](https://github.com/Electric-Blue/NimBluez/nimbluez/bluetooth.nim) module for cross-platform discovery and managing Bluetooth devices and services.
+
+For cross-platform low-level sockets interface implementation for Bluetooth use
+[nimbluez.bluetoothnativesockets](https://github.com/Electric-Blue/NimBluez/nimbluez/bluetoothnativesockets.nim).
+
+You can find wrappers for [BlueZ](http://www.bluez.org/) in [nimbluez/bluez](https://github.com/Electric-Blue/NimBluez/nimbluez/bluez/) folder.
+For [Microsoft Bluetooth](https://msdn.microsoft.com/en-us/library/windows/desktop/aa362761%28v=vs.85%29.aspx) protocol stack wrappers look at [nimbluez/msbt](https://github.com/Electric-Blue/NimBluez/nimbluez/msbt/).
+
+## Installation
+To install using [Nimble](https://github.com/nim-lang/nimble) run the following:
+```
+$ nimble install nimbluez
+```
+
+## Examples
+
+.. code-block:: nim
+ # Simple discovery example.
+ import nimbluez.bluetooth
+
+ echo "All visible remote devices:"
+ for remoteDevice in getRemoteDevices():
+ echo remoteDevice.address, " - ", remoteDevice.name
+
+.. code-block:: nim
+ # Simple server example.
+ # Attention! This code
+ import nimbluez/bluetoothnativesockets
+
+ var serverSocket = newBluetoothNativeSocket(SOCK_STREAM, BTPROTO_RFCOMM)
+ discard serverSocket.bindAddr(RfcommPort(0))
+ discard serverSocket.listen()
+ var
+ clientSocket: SocketHandle
+ clientAddress: string
+ clientSocket = serverSocket.acceptRfcommAddr(clientAddress)
+ var
+ message: string
+ message = clientSocket.recv()
+ echo message
+ clientSocket.close()
+ serverSocket.close()
+
+.. code-block:: nim
+ # Simple client example.
+ import nimbluez/bluetoothnativesockets
+
+ var clientSocket = newBluetoothNativeSocket(SOCK_STREAM, BTPROTO_RFCOMM)
+ discard clientSocket.connect(RfcommPort(1), "00:02:72:0F:5C:87")
+ discard clientSocket.send("Hi there!")
+ clientSocket.close()
+
+For more examples look at [examples]() folder.