ARMmbed / mbed-os-example-ble

BLE demos using mbed OS and mbed cli
Apache License 2.0
134 stars 118 forks source link

Add a BLE_SupportedFeatures example #358

Closed idea--list closed 3 years ago

idea--list commented 3 years ago

Main purpose of this new example is to list which optional BLE features are supported by a device and showcases how one can access BLE related API members. It also starts advertising of non-connectable type and thus implements listening to only 1 event, which helps to understand the concept of event listeners before overwhelming the user with 10 different event listeners in the first example. As such, this example is aimed for those who just begin programming BLE with Mbed OS.

paul-szczepanek-arm commented 3 years ago

PRs need to target the development branch. Master is only for releases.

paul-szczepanek-arm commented 3 years ago

To rebase your branch: git pull --rebase upstream development assuming you have upstream defined, if not, first add it with: git remote add upstream https://github.com/ARMmbed/mbed-os-example-ble.git

I don't expect you'll have any conflicts but if you do you need to resolve them.

After your branch is rebased: git push -f to replace the old version at origin

idea--list commented 3 years ago

will give git cli a try, though until now i only used github.com directly...

idea--list commented 3 years ago

I am on a windows10 machine with Git bash installed. For some reason i can not clone the repo using git commands, so i downloaded&extracted the .zip. Then inside git bash i changed to the folder where i extracted the repo, typed git init then git remote add upstream https://github.com/ARMmbed/mbed-os-example-ble.git and also git pull --rebase upstream development executed as expected. However git push -f results in:

fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

    git remote add <name> <url>

and then push using the remote name

    git push <name>

here i got stuck

idea--list commented 3 years ago

@paul-szczepanek-arm Instead of fighting with git commands i installed "github desktop". Cloned this repo successfully, then i under Branch->rebase current branch i tried to change to the development branch but it tells me the development branch is up to date with master and does not let me rebase. image

idea--list commented 3 years ago

If i try to clone the development branch with github desktop, then it asks for my username&pw but does not let me clone the dev branch. Something might be missing.

paul-szczepanek-arm commented 3 years ago

If you cloned it with github desktop you can open the command line (in the repository menu -> open terminal) and use the git commands.

The original problem you had is because you didn't clone the repo you didn't have origin set up. You add it the same way: git remote add origin https://github.com/idea--list/mbed-os-example-ble.git With the one checked out with the github desktop version that should be already done so you can just issue the rebase command

idea--list commented 3 years ago

I think the easiest solution is that i delete this PR, fork the repo again and then i edit the development branch in my fork and make a new PR based on that.

paul-szczepanek-arm commented 3 years ago

Rebasing is a very common procedure, it's worth learning it.

paul-szczepanek-arm commented 3 years ago

Are you sure you checked out your own fork and not this repo? I mean through the desktop version.

idea--list commented 3 years ago

Are you sure you checked out your own fork and not this repo? I mean through the desktop version. Maybe that was the issue, let's see...

idea--list commented 3 years ago

Still no luck:

  1. I cloned my own fork on my desktop.
  2. Under repository menu -> open in command prompt i type git remote add upstream https://github.com/ARMmbed/mbed-os-example-ble.git this returns: error: remote upstream already exists.
  3. Then i type git pull --rebase upstream development in github desktop a popup is shown telling me there is a conflict with the mbed-os.lib file in each example folder.
  4. I edit all the conflicting files to contain nothing just: https://github.com/ARMmbed/mbed-os/
  5. Doing so i may click the "continue rebase" button.
  6. Then i needed to repeat steps 4 & 5.
  7. Now it seems to OK.

What is next? My guess is force pushing, but am not sure.

paul-szczepanek-arm commented 3 years ago

github desktop already adds upstream, that's why the error. It's fine. Now you have a rebased branch on your local machine you just need to push but you have to do it on the command line: git push -f The -f is short for --force-push which overwrites the branch at origin (github) with your newly rebased version on your local machine.

idea--list commented 3 years ago

The command prompt tells me it is done. Is there anything else to do on my behalf?

paul-szczepanek-arm commented 3 years ago

Yes, remove the advertising part from the example.

idea--list commented 3 years ago

Thanks for leading me through my first rebasing process! I will make the changes today on my local desktop and then force push once again.

paul-szczepanek-arm commented 3 years ago

OK, thanks. Force push is only needed if the remote has a different history from yours (which is what happens if you rebase - you change the history/base of your commits), otherwise normal push is enough.

idea--list commented 3 years ago

Made the changes, updated the readme, pushed to my fork on github. Hope everything is fine this time.

paul-szczepanek-arm commented 3 years ago

Thank you. Tomorrow I will merge this to a separate branch temporarily to clean up the history a bit and then open a PR for development. I'll add you as reviewer when I do that so you can approve any changes I make.