- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm just wondering how to create a custom api call between master and slave devices. I want to send a message from master to slave with the master ID and some data, and I want a response. How do I do this?
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Claire,
BLE requires one device to act as Client (normally the master) and other as Server (normally the Slave). This Client-Server architecture allows master to send or receive data from server. To send data from Master to Slave, you can define a custom service/characteristics on server side and use its attribute handle to write data to it after BLE connection.
I would suggest you to go through following application notes:
AN91267: Getting Started with PSoC 4 BLE: http://www.cypress.com/documentation/application-notes/an91267-getting-started-psoc-4-ble
AN91162: Creating a BLE Custom profile: http://www.cypress.com/documentation/application-notes/an91162-creating-ble-custom-profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Claire,
BLE requires one device to act as Client (normally the master) and other as Server (normally the Slave). This Client-Server architecture allows master to send or receive data from server. To send data from Master to Slave, you can define a custom service/characteristics on server side and use its attribute handle to write data to it after BLE connection.
I would suggest you to go through following application notes:
AN91267: Getting Started with PSoC 4 BLE: http://www.cypress.com/documentation/application-notes/an91267-getting-started-psoc-4-ble
AN91162: Creating a BLE Custom profile: http://www.cypress.com/documentation/application-notes/an91162-creating-ble-custom-profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Roit, I'll try that.
Forgive me, I'm very new to BLE and even more new to Cypress. One more question, if the master is the client and the slave is the server, can the slave also write to the master? I need the slave to respond to the master's message with some updated data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Claire,
Not a problem. We all did start at some point of the time. 🙂
Technically, a slave cannot "write" to master on its own terms. The master can either read data from slave, which is more of 'pull' approach or master can start something called as notification/indication on slave, which is 'push' approach.
I think you would want the second option. Here, the master would enable notification/indication on a characteristic in server which supports this. Once enabled, server is free to send the data to master anytime it wants, until it is disabled my master.
The second app note, AN91162, should help you to add this feature to your slave.