Commit Graph

42 Commits

Author SHA1 Message Date
Glenn Ruben Bakke 5d9c191a19 nrf5/modules/ubluepy: Fixing type in ubluepy_peripheral.c. 2017-05-14 19:58:10 +02:00
Glenn Ruben Bakke cf0d2bb457 nrf5/modules/ubluepy: Setting peripheral role upon advertise() or connect(). 2017-05-14 19:58:10 +02:00
Glenn Ruben Bakke 78c0821216 nrf5/modules/ubluepy: Continue characteristic discovery until nothing more is found during connect proceedure. 2017-05-14 18:06:42 +02:00
Glenn Ruben Bakke 370c20ff6c nrf5/modules/ubluepy: Continue primary service discovery until nothing more is found in connect proceedure. 2017-05-13 18:12:15 +02:00
Glenn Ruben Bakke 3420843774 nrf5/modules/ubluepy: Remove duplication GAP event handler registration in peripheral.connect(). 2017-05-13 16:17:03 +02:00
glennrub 4584ef4ace Support address types (#18)
* nrf5/modules/ubluepy: Adding new enumeration of address types.

* nrf5/modules/ubluepy: Adding constants that can be used from micropython for public and random static address types.

* nrf5/modules/ubluepy: Adding support for optionally setting address type in Peripheral.connect(). Public address is used as default. Address types can be retrieved from 'constants'. Either constants.ADDR_TYPE_PUBLIC or constants.ADDR_TYPE_RANDOM_STATIC.

* nrf5/modules/ubluepy: Register central GAP event handler before issuing connect to a peripheral. Has to be done before connect() function as a connected event will be propergated upon successfull connection. The handler will set the connection handle which gets connect function out of the busy loop waiting for connection to succeed.

* nrf5/modules/ubluepy: Removing duplicate setting of GAP event handler in connect().
2017-05-13 16:12:14 +02:00
Glenn Ruben Bakke 0865fbd92d nrf5/modules/ubluepy: Register central GAP event handler before issuing connect to a peripheral. Has to be done before connect() function as a connected event will be propergated upon successfull connection. The handler will set the connection handle which gets connect function out of the busy loop waiting for connection to succeed. 2017-05-13 15:06:58 +02:00
Glenn Ruben Bakke 18e73d4214 nrf5/modules/ubluepy: Fixing compilation bug of wrong variable name when registering gattc event handler in ublupy peripheral connect function (central mode). 2017-05-12 20:11:30 +02:00
Glenn Ruben Bakke 54656044f7 nrf5: Syncing code with upstream master and converting all module and method tables to use MP_ROM macros. Also adding explicit casting of local dicts to (mp_obj_dict_t*). 2017-05-09 22:54:58 +02:00
Glenn Ruben Bakke 587c6277c4 nrf5/modules/ubluepy: Adding method Peripheral object to stop any ongoing advertisment. Adding compile guard to only include advertise and advertise_stop if peripheral role is compiled in. 2017-04-04 21:25:28 +02:00
Glenn Ruben Bakke 46c21ff6ba nrf5/modules/ubluepy: Adding support for starting advertisment from BLE UART REPL, by delaying registration of gatt/gatts and gattc handlers until needed in advertise or connect. If non connectable advertisment is selected, handlers in peripheral new is not anymore overriding the other peripheral instances which has set the callbacks. 2017-04-04 20:24:43 +02:00
Glenn Ruben Bakke 0559be4ffc nrf5/bluetooth: Adding possibility to configure whether advertisment should be connectable or not. 2017-04-02 18:34:56 +02:00
Glenn Ruben Bakke f7fbf55a45 nrf5/modules/ubluepy: Open up Peripheral advertise method to pass custom data to the bluetooth driver. Allowing method to allow kwargs only if no args is set. To support setting data kwarg only. 2017-04-02 15:50:07 +02:00
Glenn Ruben Bakke ebb7925a16 nrf5/modules/ubluepy: Tab-fix 2017-03-30 22:53:25 +02:00
Glenn Ruben Bakke bd2981681f nrf5/modules/ubluepy: Updating peripheral object to handle characteristic discovery (central mode). 2017-03-30 22:47:14 +02:00
Glenn Ruben Bakke 75148ee6ca nrf5/modules/ubluepy: Updating ubluepy peripheral object to new bluetooth driver API. Starting to populate service objects and uuid objects. Also adding the service to the peripheral object throught the regular static function for adding services. Handle value for the primary service is assuming that it is the first element in the handle range; start_handle reported by the service discovery. 2017-03-29 23:37:32 +02:00
Glenn Ruben Bakke a139d5e8f7 nrf5/modules/ubluepy: Adding some work in progress on service discovery. 2017-03-28 23:40:28 +02:00
Glenn Ruben Bakke c230bc021a nrf5/modules/ubluepy: Update connect method to parse dev_addr parameter and pass it to the bluetooth driver, going through a allocated heap buffer. Adding call to the bluetooth driver to issue a connect. Hardcoding address type for now. 2017-03-26 20:45:21 +02:00
Glenn Ruben Bakke 4d147beedb nrf5/modules/ubluepy: Adding template function for central connect() in peripheral object. 2017-03-25 17:51:52 +01:00
Glenn Ruben Bakke 851705fc3a nrf5/modules/ubluepy: Disable all functions central related functions in the Peripheral object for now, even if MICROPY_PY_UBLUEPY_CENTRAL is enabled. 2017-03-12 14:27:09 +01:00
Glenn Ruben Bakke db3dd8bc8b nrf5/modules: Updating ubluepy peripheral to pass handle value to python event handler instead of data length. Data length can be derived from the bytearray structure. 2017-03-03 00:04:13 +01:00
Glenn Ruben Bakke 10e7c16351 nrf5/modules: Adding new gatts handler and registration of it during creation of a peripheral object. Also, added forwarding to python callback function (for now the same as for GAP). 2017-02-19 00:10:27 +01:00
Glenn Ruben Bakke 71475bb028 nrf5/modules: Updating method documentation in ubluepy peripheral and service. 2017-02-18 18:16:07 +01:00
Glenn Ruben Bakke 307c2d6aed nrf5/modules: Updating method documentation in ubluepy peripheral class. 2017-02-18 18:12:37 +01:00
Glenn Ruben Bakke 63ed32ecaa nrf5/modules: Correcting tabbing in ubluepy periheral impl. 2017-02-18 17:57:59 +01:00
Glenn Ruben Bakke 577bf0724a nrf5/modules: Updating ubluepy peripheral. Creating empty service list in constructor. Appending services to the list when added. Added new function for retreiving the service list; getServices(). 2017-02-18 17:57:10 +01:00
Glenn Ruben Bakke 852dde6747 nrf5/modules: Removing connection handle from python gap event handler callback function. 2017-02-18 14:41:46 +01:00
Glenn Ruben Bakke 04f8891dc9 nrf5/modules: Updating peripheral class to assign periopheral parent pointer to service's thats added. Also added a hook in the bluetooth le event handler to store the connection handle value, to prevent any services or characteristics to handle this value themselves. 2017-02-18 13:17:31 +01:00
Glenn Ruben Bakke 21f1d8c640 nrf5: Updating all includes of softdevice.h to ble_drv.h 2017-02-17 19:10:24 +01:00
Glenn Ruben Bakke 5f4c464f29 nrf5/sdk: Renaming bluetooth driver functions to have ble_drv* prefix. Updating modules using it. 2017-02-17 19:02:24 +01:00
Glenn Ruben Bakke bba8221aa2 nrf5/modules: Updating bluetooth driver and ubluepy to use explicit gap event handler. Adding connection handle parameter to the gap handler from ubluepy. Resetting advertisment flag if connection event is recieved, in order to allow for subsequent advertisment if disconnected again. Example in ublupy header updated. 2017-02-17 17:32:42 +01:00
Glenn Ruben Bakke 2fd55feb0c nrf5/modules: Guarding callback to python event handler before issue the call in case it is not set. 2017-02-16 18:49:47 +01:00
Glenn Ruben Bakke 832a7ffd14 nrf5/modules: updating ubluepy and bluetooth driver to support python created event handler. Added registration of callback from ubluepy against the bluetooth driver and dispatching of events to the user supplied python function. 2017-02-15 23:32:42 +01:00
Glenn Ruben Bakke db75b5535c nrf5/modules: Adding two new functions to ubluepy peripheral class to set specific handlers for notificaitons and connection related events. 2017-02-15 19:30:45 +01:00
Glenn Ruben Bakke b493bfda64 nrf5/modules: Adding 'withDelegate' function to peripheral class. 2017-02-15 00:22:00 +01:00
Glenn Ruben Bakke 18aab4a6b9 nrf5/modules: Updating advertisment method in peripheral class to memset advertisment structure. Also applying service list if set to the advertisment structure. 2017-02-12 15:17:30 +01:00
Glenn Ruben Bakke 9d24742351 nrf5/modules: Updating ubluepy peripheral class to use mp_const_none instead of MP_OBJ_NULL for unset values in advertisment method parameter list. Adding extraction of the service list in the advertisment method. The list is not yet handled. 2017-02-12 14:23:13 +01:00
Glenn Ruben Bakke 3a68e40102 nrf5/modules: Turning ubluepy peripheral advertisment function into a keyword argument function so that it would be possible to set device name, service uuids, or manually constructed data payload. 2017-02-11 17:43:47 +01:00
Glenn Ruben Bakke 0264f68698 nrf5/modules: Extending the implementation of Peripheral class in ubluepy. 2017-02-08 18:48:35 +01:00
Glenn Ruben Bakke 723943abde nrf5/modules: Adding new and print function to ubluepy peripheral class. Template functions only. 2017-02-07 22:17:55 +01:00
Glenn Ruben Bakke 3cd518af3a nrf5/modules: Updating ubluepy with class function placeholders. 2017-02-06 20:19:06 +01:00
Glenn Ruben Bakke 73d00c98a0 nrf5/modules: Renaming ble module folder to ubluepy. 2017-02-05 21:10:44 +01:00