Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh4 offline exp #983

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6f8ed04
[Add] Added Support for sending more than 20 bytes of data if MTU Cha…
arihantdaga Feb 27, 2019
cd48229
Fix Part 1
arihantdaga Jul 5, 2019
f89f2f8
Fix Part 2
arihantdaga Jul 5, 2019
bc9acbc
[fix] [update] Send Bytes in chunks if exceeds MTU Size (20 bytes)
chaymankala Oct 21, 2019
a489f1f
Merge branch 'master' of https://github.com/don/cordova-plugin-ble-ce…
arihantdaga Jun 15, 2020
463413b
Merge pull request #1 from chaymankala/master
arihantdaga Dec 14, 2020
9e6d84a
Fixed WriteWithoutResponse function for data length less than 20
arihantdaga Dec 14, 2020
b2166eb
Added Device provisioining and models
arihantdaga May 4, 2022
586640f
scan device perfected
arihantdaga May 4, 2022
1d71eff
added device provisioning function and some docs
arihantdaga May 4, 2022
2caf948
added sources in plugin.xml
arihantdaga May 4, 2022
3c7a88b
add: getMeshInfo
arihantdaga May 4, 2022
63e2559
docs
arihantdaga May 4, 2022
ba4ecbb
added telinkBleMeshLibrary
arihantdaga May 4, 2022
d4b4f2f
[fix]
chaymankala May 6, 2022
271cc91
nm
chaymankala May 6, 2022
eddba05
[update] dev
chaymankala Jun 27, 2022
eef4747
Added kickout function.
vishw-a Jul 5, 2022
957a412
dev
chaymankala Jul 8, 2022
9c3e255
Delete node is done in ble mesh
vishw-a Jul 15, 2022
02b2cc8
Merge branch 'master' of https://github.com/don/cordova-plugin-ble-ce…
chaymankala Sep 27, 2022
2d0bb88
[init] ios plugin
chaymankala Sep 27, 2022
f088261
Merge branch 'feature/mesh_support' of https://github.com/kiot-innova…
chaymankala Sep 27, 2022
b99ba9b
Merge branch 'don-master' of https://github.com/kiot-innovations/cord…
chaymankala Sep 27, 2022
088e040
fixes
chaymankala Sep 30, 2022
42abf12
[fix]- ios changes and fixes
chaymankala Jan 17, 2023
5575eb6
[fix]prov, offline control, grp control, grp mgmnt
chaymankala Jan 17, 2023
e6b80fc
Merge branch 'mesh2_merger' of https://github.com/kiot-innovations/co…
chaymankala Jan 17, 2023
48c3572
[new]- ios plugin changes
chaymankala Feb 22, 2023
0c83afd
[new]-ble mesh cahnges
sowmya-kiot Mar 29, 2023
7a2e9be
Merge branch 'mesh2_merger' of https://github.com/kiot-innovations/co…
sowmya-kiot Mar 29, 2023
f5c4737
[new]-ios changes
chaymankala May 5, 2023
0592482
[new]- ble changes
sowmya-kiot May 17, 2023
703a6ab
[new]- ble mesh changes
sowmya-kiot May 17, 2023
924ef81
Merge branch 'mesh2_merger' of https://github.com/kiot-innovations/co…
sowmya-kiot May 17, 2023
4a1539d
Merge branch 'mesh2_merger' of https://github.com/kiot-innovations/co…
sowmya-kiot May 17, 2023
90617b0
[new]-plugin changes
sowmya-kiot Jul 7, 2023
4385447
[new]- stop scan function
sowmya-kiot Jul 18, 2023
48ee51b
[dev]
chaymankala Aug 4, 2023
18e8a77
dummy commit
arihantdaga Aug 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
.idea/
*.DS_Store
src/android/TelinkBleMeshLib/.gradle/*
src/android/TelinkBleMeshLib/build/.transforms
src/android/TelinkBleMeshLib/build/android-profile
src/android/TelinkBleMeshLib/build/generated
src/android/TelinkBleMeshLib/build/intermediates
src/android/TelinkBleMeshLib/build/reports
src/android/TelinkBleMeshLib/build/tmp
src/android/TelinkBleMeshLib/build/outputs/logs
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,10 @@ Run the app on your phone

If you need Nordic DFU capability, Tomáš Bedřich has a [fork](https://github.com/fxe-gear/cordova-plugin-ble-central) of this plugin that adds an `updateFirmware()` method that allows users to upgrade nRF5x based chips over the air. https://github.com/fxe-gear/cordova-plugin-ble-central

# Mesh Interface

For mesh interface read this - [Mesh](./mesh.md)

# License

Apache 2.0
Expand Down
9 changes: 9 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Source file copy in plugin.xml
How to include telinkmeshlibrary in the project.
Provisioning should run on a separate thread i guess. (Same for scanning ?)
Setting Node Names and Mesh Names

Kickout devices from mesh
Send messages to nodes.

Hello
16 changes: 16 additions & 0 deletions listsourcefiles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

import os
from posixpath import relpath
template = '<source-file src="{{FILE_PATH}}" target-dir="src/com/megster/cordova/ble/central/{{ADITIONAL_PATH}}" />'
androidPath = os.path.join('src', 'android')
pathToTravel = os.path.join(os.path.dirname(os.path.realpath(__file__)), androidPath)
# Walk through the directory tree and find all files recursively
for root, dirs, files in os.walk(pathToTravel):
for file in files:
if file.endswith('.java'):
relPath = os.path.relpath(os.path.join(root, file), os.path.dirname(os.path.realpath(__file__)))
relDir = os.path.dirname(os.path.relpath(relPath, androidPath))
sourceFile = template.replace('{{FILE_PATH}}', os.path.join(relPath))
sourceFile = sourceFile.replace('{{ADITIONAL_PATH}}',os.path.join('',relDir))
sourceFile = sourceFile.replace('\\', '/')
print(sourceFile)
67 changes: 67 additions & 0 deletions mesh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
## Methods

- [Methods](#methods)
- [initialize](#initialize)
- [provScanDevices](#provscandevices)
- [provAddDevice](#provadddevice)
- [getMeshInfo](#getmeshinfo)

## Build AAR
```bash
./gradlew build
```
Then rename it to TelinkBleMeshLib.aar, and thats it!

```
## initialize
Initialize Ble Mesh & its handlers. Call this before any other functions.
```JavaScript
// Returns Promise<void>
ble.mesh.initialize();
```

## provScanDevices
Scan nearby devices which can be provisioned.
```JavaScript
ble.mesh.provScanDevices({}, successCallback, failureCallback);
// calls successcallback with found devices. It sends list of all mesh devices and times out after 15 seconds.
{
"devices": [
{
"isProcessing": false,
"logExpand": false,
"nodeInfo": {
"meshAddress": -1,
"macAddress": "A4:C1:38:BB:1E:6C",
"elementCnt": 0,
"bound": false,
"lum": 100,
"temp": 0,
"isLpn": false,
"isOffline": true,
"isDefaultBind": false,
"pidDesc": "(unbound)",
"deviceUUID": "7CDA06A96E226C3CBEA5C5CE442F64FC"
}
}
]
}
```
## provAddDevice
Provision a selected device. Send UUID of the device which needs to be provisioned.
```JavaScript
ble.mesh.provadddevice({
uuid: UUID
}, successCallback, failureCallback);
// it calls successcallbacks with different events, even if mesh provisioning fails or binding fails. With event type.
Events: ['device_prov_begin', 'device_prov_suc', 'device_prov_fail', 'device_bind_suc', 'device_bind_fail']
// We'll get events in order , first device_prov then device_bind.
Response:
{"ev":"device_prov_begin","device":{"isProcessing":true,"logExpand":false,"nodeInfo":{"meshAddress":6,"macAddress":"A4:C1:38:BB:1E:6C","elementCnt":0,"bound":false,"lum":100,"temp":0,"isLpn":false,"isOffline":true,"isDefaultBind":false,"pidDesc":"(unbound)","deviceUUID":"7CDA06A96E226C3CBEA5C5CE442F64FC"}}}
{"ev":"device_bind_suc","device":{"isProcessing":false,"logExpand":false,"nodeInfo":{"meshAddress":6,"macAddress":"A4:C1:38:BB:1E:6C","elementCnt":2,"bound":true,"lum":100,"temp":0,"isLpn":false,"isOffline":true,"isDefaultBind":false,"pidDesc":"cid-1102 pid-0100","deviceUUID":"7CDA06A96E226C3CBEA5C5CE442F64FC","deviceKey":"AE023B27FF34E7321F6212187D942C35","netKeyIdxes":[0]}}}

```

## getMeshInfo
Get Full Mesh configuration. Usually needed for syncing with server. Sample response - [samplemeshinfo.json](meshdemo/samplemeshinfo.json)
Note: the entire reponse can be bvery big, dont send it as it is to server. We can process and send it.
42 changes: 42 additions & 0 deletions meshdemo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<button id="scan" style="z-index: 1000;top: 150px;position: absolute; width: 100px; height: 50px; margin-top: 20px;">
Scan </button>
<button id="provision"
style="z-index: 1000;top: 220px;position: absolute; width: 100px; height: 50px; margin-top: 20px;"> Prov 1st device
</button>
<button id="meshInfo"
style="z-index: 1000;top: 290px;position: absolute; width: 100px; height: 50px; margin-top: 20px;"> Mesh Info
</button>


<script type="text/javascript">
setTimeout(() => {
console.log("Document Ready");
document.getElementById("scan").addEventListener('click', () => {
console.log("Scan Button Clicked");
window.ble.mesh.initialize();
window.ble.mesh.provScanDevices({}, (d) => {
console.log("SCAN_RESULT: ", JSON.stringify(d));
}, (err) => {
console.log("Error in scanning", JSON.stringify(err));
})
});
document.getElementById("provision").addEventListener('click', () => {
console.log("Prov Button Clicked");
window.ble.mesh.provAddDevice({ uuid: "7CDA06A96E226C3CBEA5C5CE442F64FC" }, (d) => {
console.log(JSON.stringify(d));
}, (err) => {
console.log("Error in provisioning: ", JSON.stringify(err));
})
});
document.getElementById("meshInfo").addEventListener('click', () => {
console.log("Prov Button Clicked");
window.ble.mesh.getMeshInfo().then((d) => {
console.log(JSON.stringify(d));
}).catch((err) => {
console.log("Error in provisioning: ", JSON.stringify(err));
})
});

}, 5000);

</script>
Loading