d4ryl00
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ![](https://i.imgur.com/y6iZJ50.png) Brain storming BLE # Requirement - Device doesn't need to connect to people that are not in the same topic - so it will use priority and weight - Device shouldn't connect to two topics if it's part of it. - that will be solved by priority - Device can be part of a n-group should advertise on all groups that is a member - that should be working as expected. - Check how many services or characteristic can device have. - Service - Berty only 1 - Limit 20-25 on each device - Topic - Characteristic - Descriptor - Available or Not Topic YES/NO - Usually no limit on how many you can. But after test: - Services - 20-25 total problem might be PRIMARY_SECONDARY you can change it and should be good but better with characteristics. - Characteristics - as many as you need tested with 100. - Descriptor - i believe only 1-5 per characteristic - Groups can contain n-member - here we have a limit of 4 devices in total so each device can be connected to 3 more without any issue. After that rejects connection. ## Topic priority? - Put a weight for each peer based on shared topic between peers. - peer A is in group 1, 2, 3. - peer B is in group 1, 3 - peer C is in group 3. So for peer A, peer B has weight=2, peer C has weight=1 Weight is calculated by how many common groups is shared between the peers. Problem here is that you will have to actually connect with the other devices to get Characteristic to be able to calculate weight. App layer knows how many topics are available and shared between people? Topics and the shared weight can be calculated. App knows Topics and knows people in topics? Yes? so it can calculate weight. - Device 1 comes to topic flowers start advertising - Device 1 leaves flowers now it starts advertising on all topics - Device 1 enters topic cars start advertising on that topic - Everybody around me on the same topic is visible to me so i can add anybody but actually connecting to each one we have to request a connect and accept a connection. - topic everyone on the topic request/accept each other to add and then connect to all on the topic - problem is reconnect won't work properly if you have topic on cars 10 people pair of 3 will connect next pair of 3 maybe to the next one connectGatt. You can't verify that the first pair of 3 has the next 3 devices for(all topics has shared people weight ) { people (PeerID) with more weight? connect to them first. We connect to the next weight available and if any space left connect to the highest possible weight } # Scanner - proceed connections only when it has 3 connections max, so ignore all other found devices # White list ## add * device found and the client try to connect to a device * server is connected to that device # Workflow * Device A's scanner found device B, adds it to whitelist, and try to connect * Device A's scanner found device C, adds it to whitelist, and try to connect * Device A's scanner found device D, adds it to whitelist, and try to connect * Device A's scanner found device E, don't add it to whitelist because connection limit reached * Device A cannot be connected to the device D and after 3 attempt, add device D to the blacklist * Device A has no connection from Device B and after a timeout of 30s, device A disconnect. It try 3 times and after add device B to the blacklist. Device D is remove from the blacklist to the whitelist if a new device is not being added to the chain in the meantime. If whitelist is full we delete the last removed from blacklist. * Before deleting Device D, device A's scanner found device E and added it the the whitelist and try to connect to it. - Don't implement the solution. Device's will eventually reconnect with the device they couldn't after one of the devices drop from the chain. For example we have 5 devices and 1 and 4 couldn't connect but the rest connected. In certain moment device 2 dropped from the chain and after that 1 and 4 reconnect. Now all devices are connected normally. And if any device comes won't be added. Mostly for the Android on IOS might be added 1 more. - Only implement a limit in the client, no white/black list. - device A client connected to C, D, E - device A server connected to B, C, D - device B client connected to C, D, E - device C client connected to B, D, E - D, C, E - device D client connected to B, C, E - B, C, D - device E client connected to A, B, C - A, B, C - device A - B, C, D, fail with D try again with D - device B - A, C, E but D was available connected - device C - A, B, - device E -> A (drop) 3 connected (stop scanning advertising) 30 sec start again so find C - device D <- A frozen block (drop) - all the devices will do the same as E and A at the same time Connection time will be: time * timeout * devicesCount around 2xtimeouts one is OS and one is your timeout gatt.close so it works Timeout can be decrease by handling your own cycle to speed up connection between multiple devices. Something to take in mind that if many devices around timeouts will need more time to success. Stop scanner when client is connected to 3 devices - stop advertising when server has 3 connections When the server has 1 connection, the client try to connect to that remote client. The problem is that the client doesn't have the remote 4-digit because it didn't scan that device before. So we can do that only if the server handshake is done. client device that write and read to the server has a new mac than the one fron the scanner because of privacy this is not always and not all device are like that A client will connect to the server but the B server/client wont be connected so no handshake for the B server/client connectToGatt no handshake - client B -> server A - Server A (client A) connect -> server B - device E - already have D, B connected so 3rd A - device D <- device A frozen block 4 -1. If you have more connection doesn't even trigger connection. 0. You need client to connect to do below operations 1. Client (A) read server (B) peerID 2. Client (A) write its own peerID on server (B) Only when you have read from server only client because of privacy you have 2 mac address on connection. Server has MAC Address Client has Mac Address When read/write happens new MAC Address happens Device A After 30 s, the client will disconnect from C, D only, so it will have only 1 active connection. So scanner will try to connect to 2 other devices (B, C, H, etc). Request priority for the connection you already have. I did balanced. It has to be done after connection or after service discovery because Service discovery will request Low_Latency and also requestMtu request Low_Latency. It has to be done before handshake. - device A client connected to nobody - device A server connected to E - We have 100 devices around - The scanner have to connected to device E in priority - The whitelist has two fields: mac address and 4-digits - So the scanner parse this list before every connection - Scanner has 3 devices now but 1 of them power off? What now? - whitelist: B, C, D and we lost B because power off. What now? How do you remove B from whiteList? On Disconnected we remove B from whitelist. So after that new device will be added to whiteList size will be checked. - 10 devices connected to the server, so 10 devices in the whitelist but scanner check the limit in the meantime. 1) in the for loop, we try to find each devices in the whitelist in the foundmap to prioritize them connection. 2) after the for loop, if we have less than 3 connections, we can proceed connection to scan result normally. - Another solution would be to: - Add a random group service id for 4 people in the group or each chat everytime it's created and devices will be looking only for that serviceID rather than implementing the logic for the block in the SDK - For example Device A makes group with Device B and creates the service which will be 4545 and then DeviceB search for devices on 4545 :) - Conversation Groupd - ID? pass the ID to BLE Driver - Device 1 - Service for each device to only filter - Device 2 - Service for each device to only filter - Device 3 - Service for each device to only filter - Device 4 - Service for each device to only filter ## Device A ### Whitelist - check on limit here 3 reconnect attemp * Device B 30 sec? attemp no ok blacklist * Device C * Device E ### Blacklist - decrease connection size 2 * Device B * Device D ### Connecting ### Connected * Device C ## Device B ### Whitelist * Device C * Device D * Device E ### Blacklist ### Connecting ### Connected ## Device C ### Whitelist ### Blacklist ### Connecting ### Connected ## Device D ### Whitelist ### Blacklist ### Connecting ### Connected ## Device E ### Whitelist ### Blacklist ### Connecting ### Connected

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully