How to connect to BLE device that isn't advertising service UUID in iOS app
I am trying to connect an ESP32 module to my iPhone via BLE and am using centralManager.scanForPeripherals(withServices: [carServiceCBUUID], options: nil)
where let carServiceCBUUID = CBUUID(string: "c0de0001-feed-f00d-c0ff-eeb3d05ebeef")
. I am following Ray Wenderlich's heart monitor tutorial but since the ESP32 bluetooth module is not advertising the main Service UUID, it won't find the device when I do scanForPeripherals
. Attached is the screenshot of the LightBlue information on the BLE device. Is there a way I can change the advertising data so I can advertise the service? I am running this code on the ESP32 https://thejeshgn.com/2018/06/11/esp32-ble-building-an-echo-service-gatt-server/
screenshot of LightBlue connection
ios swift arduino bluetooth-lowenergy esp32
add a comment |
I am trying to connect an ESP32 module to my iPhone via BLE and am using centralManager.scanForPeripherals(withServices: [carServiceCBUUID], options: nil)
where let carServiceCBUUID = CBUUID(string: "c0de0001-feed-f00d-c0ff-eeb3d05ebeef")
. I am following Ray Wenderlich's heart monitor tutorial but since the ESP32 bluetooth module is not advertising the main Service UUID, it won't find the device when I do scanForPeripherals
. Attached is the screenshot of the LightBlue information on the BLE device. Is there a way I can change the advertising data so I can advertise the service? I am running this code on the ESP32 https://thejeshgn.com/2018/06/11/esp32-ble-building-an-echo-service-gatt-server/
screenshot of LightBlue connection
ios swift arduino bluetooth-lowenergy esp32
1
The issue is not on the Swift. If you don't publicly advertise the service, you can't find it that way. You need to docentralManager.scanForPeripherals(withServices: nil, options: nil)
. I guess thatBLEAdvertising *pAdvertising = pServer->getAdvertising();
is the where you might want to explicitly advertise the service.
– Larme
Nov 15 '18 at 21:00
add a comment |
I am trying to connect an ESP32 module to my iPhone via BLE and am using centralManager.scanForPeripherals(withServices: [carServiceCBUUID], options: nil)
where let carServiceCBUUID = CBUUID(string: "c0de0001-feed-f00d-c0ff-eeb3d05ebeef")
. I am following Ray Wenderlich's heart monitor tutorial but since the ESP32 bluetooth module is not advertising the main Service UUID, it won't find the device when I do scanForPeripherals
. Attached is the screenshot of the LightBlue information on the BLE device. Is there a way I can change the advertising data so I can advertise the service? I am running this code on the ESP32 https://thejeshgn.com/2018/06/11/esp32-ble-building-an-echo-service-gatt-server/
screenshot of LightBlue connection
ios swift arduino bluetooth-lowenergy esp32
I am trying to connect an ESP32 module to my iPhone via BLE and am using centralManager.scanForPeripherals(withServices: [carServiceCBUUID], options: nil)
where let carServiceCBUUID = CBUUID(string: "c0de0001-feed-f00d-c0ff-eeb3d05ebeef")
. I am following Ray Wenderlich's heart monitor tutorial but since the ESP32 bluetooth module is not advertising the main Service UUID, it won't find the device when I do scanForPeripherals
. Attached is the screenshot of the LightBlue information on the BLE device. Is there a way I can change the advertising data so I can advertise the service? I am running this code on the ESP32 https://thejeshgn.com/2018/06/11/esp32-ble-building-an-echo-service-gatt-server/
screenshot of LightBlue connection
ios swift arduino bluetooth-lowenergy esp32
ios swift arduino bluetooth-lowenergy esp32
asked Nov 15 '18 at 20:47
JohnJohn
234
234
1
The issue is not on the Swift. If you don't publicly advertise the service, you can't find it that way. You need to docentralManager.scanForPeripherals(withServices: nil, options: nil)
. I guess thatBLEAdvertising *pAdvertising = pServer->getAdvertising();
is the where you might want to explicitly advertise the service.
– Larme
Nov 15 '18 at 21:00
add a comment |
1
The issue is not on the Swift. If you don't publicly advertise the service, you can't find it that way. You need to docentralManager.scanForPeripherals(withServices: nil, options: nil)
. I guess thatBLEAdvertising *pAdvertising = pServer->getAdvertising();
is the where you might want to explicitly advertise the service.
– Larme
Nov 15 '18 at 21:00
1
1
The issue is not on the Swift. If you don't publicly advertise the service, you can't find it that way. You need to do
centralManager.scanForPeripherals(withServices: nil, options: nil)
. I guess that BLEAdvertising *pAdvertising = pServer->getAdvertising();
is the where you might want to explicitly advertise the service.– Larme
Nov 15 '18 at 21:00
The issue is not on the Swift. If you don't publicly advertise the service, you can't find it that way. You need to do
centralManager.scanForPeripherals(withServices: nil, options: nil)
. I guess that BLEAdvertising *pAdvertising = pServer->getAdvertising();
is the where you might want to explicitly advertise the service.– Larme
Nov 15 '18 at 21:00
add a comment |
1 Answer
1
active
oldest
votes
According to documentation of scanForPeripheralsWithServices:options:
the serviceUUIDs
parameter can be nil
- in that case
all discovered peripherals are returned regardless of their supported services (not recommended)
So unless you are planning to use background modes to scan when app is in background, you can just pass nil
as serviceUUIDs
parameter
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327666%2fhow-to-connect-to-ble-device-that-isnt-advertising-service-uuid-in-ios-app%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
According to documentation of scanForPeripheralsWithServices:options:
the serviceUUIDs
parameter can be nil
- in that case
all discovered peripherals are returned regardless of their supported services (not recommended)
So unless you are planning to use background modes to scan when app is in background, you can just pass nil
as serviceUUIDs
parameter
add a comment |
According to documentation of scanForPeripheralsWithServices:options:
the serviceUUIDs
parameter can be nil
- in that case
all discovered peripherals are returned regardless of their supported services (not recommended)
So unless you are planning to use background modes to scan when app is in background, you can just pass nil
as serviceUUIDs
parameter
add a comment |
According to documentation of scanForPeripheralsWithServices:options:
the serviceUUIDs
parameter can be nil
- in that case
all discovered peripherals are returned regardless of their supported services (not recommended)
So unless you are planning to use background modes to scan when app is in background, you can just pass nil
as serviceUUIDs
parameter
According to documentation of scanForPeripheralsWithServices:options:
the serviceUUIDs
parameter can be nil
- in that case
all discovered peripherals are returned regardless of their supported services (not recommended)
So unless you are planning to use background modes to scan when app is in background, you can just pass nil
as serviceUUIDs
parameter
answered Nov 15 '18 at 21:02
mag_zbcmag_zbc
4,12383048
4,12383048
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327666%2fhow-to-connect-to-ble-device-that-isnt-advertising-service-uuid-in-ios-app%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
The issue is not on the Swift. If you don't publicly advertise the service, you can't find it that way. You need to do
centralManager.scanForPeripherals(withServices: nil, options: nil)
. I guess thatBLEAdvertising *pAdvertising = pServer->getAdvertising();
is the where you might want to explicitly advertise the service.– Larme
Nov 15 '18 at 21:00