Merge pull request #1993 from dhalbert/ble-scanner
bleio: add central and scanner functionality, cleanup bleio API, some code restructure
This commit is contained in:
commit
74be29cbf9
1
conf.py
1
conf.py
@ -84,6 +84,7 @@ version = release = '0.0.0'
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ["**/build*",
|
||||
".git",
|
||||
".venv",
|
||||
".direnv",
|
||||
"docs/README.md",
|
||||
|
174
locale/ID.po
174
locale/ID.po
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -218,16 +218,15 @@ msgstr ""
|
||||
msgid "A hardware interrupt channel is already in use"
|
||||
msgstr "Sebuah channel hardware interrupt sedang digunakan"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr "buffers harus mempunyai panjang yang sama"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
msgid "All I2C peripherals are in use"
|
||||
msgstr "Semua perangkat I2C sedang digunakan"
|
||||
@ -354,20 +353,8 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
@ -502,17 +489,11 @@ msgstr ""
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr "Tidak bisa menyesuaikan data ke dalam paket advertisment"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr "Tidak bisa menyesuaikan data ke dalam paket advertisment"
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr ""
|
||||
@ -550,6 +531,10 @@ msgstr ""
|
||||
msgid "Expected a UUID"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -559,12 +544,7 @@ msgstr ""
|
||||
msgid "Failed sending command."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr "Gagal untuk mendapatkan mutex, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr "Gagal untuk mendapatkan mutex, status: 0x%08lX"
|
||||
@ -574,11 +554,6 @@ msgstr "Gagal untuk mendapatkan mutex, status: 0x%08lX"
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr "Gagal untuk menambahkan karakteristik, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to add service"
|
||||
msgstr "Gagal untuk menambahkan layanan, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -599,27 +574,21 @@ msgstr "Gagal untuk megalokasikan buffer RX dari %d byte"
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr "Gagal untuk merubah status softdevice, error: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to connect:"
|
||||
msgstr "Gagal untuk menyambungkan, status: 0x%08lX"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to continue scanning"
|
||||
msgstr "Gagal untuk melanjutkan scanning, status: 0x%08lX"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr "Gagal untuk melanjutkan scanning, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to create mutex"
|
||||
msgstr "Gagal untuk membuat mutex, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, fuzzy
|
||||
msgid "Failed to discover services"
|
||||
msgstr "Gagal untuk menemukan layanan, status: 0x%08lX"
|
||||
@ -659,48 +628,41 @@ msgstr "Gagal untuk menulis nilai gatts, status: 0x%08lX"
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr "Gagal untuk menambahkan Vendor Spesific UUID, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to release mutex"
|
||||
msgstr "Gagal untuk melepaskan mutex, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr "Gagal untuk melepaskan mutex, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to start advertising"
|
||||
msgstr "Gagal untuk memulai advertisement, status: 0x%08lX"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr "Gagal untuk memulai advertisement, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to start scanning"
|
||||
msgstr "Gagal untuk melakukan scanning, status: 0x%08lX"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr "Gagal untuk melakukan scanning, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr "Gagal untuk memberhentikan advertisement, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr "Gagal untuk memberhentikan advertisement, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -916,6 +878,10 @@ msgstr ""
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr "Tidak ada DAC (Digital Analog Converter) di dalam chip"
|
||||
@ -966,6 +932,7 @@ msgstr ""
|
||||
msgid "No such file/directory"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
#, fuzzy
|
||||
msgid "Not connected"
|
||||
@ -1229,7 +1196,7 @@ msgid "USB Error"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
@ -1928,8 +1895,9 @@ msgstr ""
|
||||
msgid "integer required"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
@ -2144,6 +2112,14 @@ msgstr "tidak ada modul yang bernama '%q'"
|
||||
msgid "no such attribute"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr "argumen non-default mengikuti argumen standar(default)"
|
||||
@ -2353,10 +2329,6 @@ msgstr ""
|
||||
msgid "script compilation not supported"
|
||||
msgstr "kompilasi script tidak didukung"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr ""
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr ""
|
||||
@ -2624,6 +2596,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr ""
|
||||
@ -2670,6 +2646,10 @@ msgstr ""
|
||||
#~ msgid "Cannot update i/f status"
|
||||
#~ msgstr "Tidak dapat memperbarui status i/f"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Data too large for the advertisement packet"
|
||||
#~ msgstr "Tidak bisa menyesuaikan data ke dalam paket advertisment"
|
||||
|
||||
#~ msgid "Don't know how to pass object to native function"
|
||||
#~ msgstr "Tidak tahu cara meloloskan objek ke fungsi native"
|
||||
|
||||
@ -2682,6 +2662,26 @@ msgstr ""
|
||||
#~ msgid "Error in ffi_prep_cif"
|
||||
#~ msgstr "Errod pada ffi_prep_cif"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to acquire mutex"
|
||||
#~ msgstr "Gagal untuk mendapatkan mutex, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to add service"
|
||||
#~ msgstr "Gagal untuk menambahkan layanan, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to connect:"
|
||||
#~ msgstr "Gagal untuk menyambungkan, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to continue scanning"
|
||||
#~ msgstr "Gagal untuk melanjutkan scanning, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to create mutex"
|
||||
#~ msgstr "Gagal untuk membuat mutex, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
|
||||
#~ msgstr "Gagal untuk melaporkan nilai atribut, status: 0x%08lX"
|
||||
@ -2690,6 +2690,22 @@ msgstr ""
|
||||
#~ msgid "Failed to read attribute value, err %0x04x"
|
||||
#~ msgstr "Gagal untuk membaca nilai atribut, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to release mutex"
|
||||
#~ msgstr "Gagal untuk melepaskan mutex, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start advertising"
|
||||
#~ msgstr "Gagal untuk memulai advertisement, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start scanning"
|
||||
#~ msgstr "Gagal untuk melakukan scanning, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to stop advertising"
|
||||
#~ msgstr "Gagal untuk memberhentikan advertisement, status: 0x%08lX"
|
||||
|
||||
#~ msgid "GPIO16 does not support pull up."
|
||||
#~ msgstr "GPIO16 tidak mendukung pull up"
|
||||
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-11 18:42-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -219,12 +219,11 @@ msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
@ -349,20 +348,8 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
@ -492,15 +479,10 @@ msgstr ""
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr ""
|
||||
@ -538,6 +520,10 @@ msgstr ""
|
||||
msgid "Expected a UUID"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -547,11 +533,7 @@ msgstr ""
|
||||
msgid "Failed sending command."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr ""
|
||||
@ -561,10 +543,6 @@ msgstr ""
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to add service"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -584,12 +562,13 @@ msgstr ""
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to connect:"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to continue scanning"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
@ -597,11 +576,7 @@ msgstr ""
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to create mutex"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to discover services"
|
||||
msgstr ""
|
||||
|
||||
@ -638,27 +613,24 @@ msgstr ""
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to release mutex"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start advertising"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start scanning"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
@ -666,16 +638,16 @@ msgstr ""
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -891,6 +863,10 @@ msgstr ""
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr ""
|
||||
@ -941,6 +917,7 @@ msgstr ""
|
||||
msgid "No such file/directory"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
msgid "Not connected"
|
||||
msgstr ""
|
||||
@ -1196,7 +1173,7 @@ msgid "USB Error"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
@ -1884,8 +1861,9 @@ msgstr ""
|
||||
msgid "integer required"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
@ -2099,6 +2077,14 @@ msgstr ""
|
||||
msgid "no such attribute"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr ""
|
||||
@ -2307,10 +2293,6 @@ msgstr ""
|
||||
msgid "script compilation not supported"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr ""
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr ""
|
||||
@ -2577,6 +2559,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr ""
|
||||
|
181
locale/de_DE.po
181
locale/de_DE.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
|
||||
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
|
||||
"Last-Translator: Pascal Deneaux\n"
|
||||
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
|
||||
@ -219,16 +219,15 @@ msgstr "3-arg pow() wird nicht unterstützt"
|
||||
msgid "A hardware interrupt channel is already in use"
|
||||
msgstr "Ein Hardware Interrupt Kanal wird schon benutzt"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgstr "Die Adresse ist nicht %d Bytes lang oder das Format ist falsch"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr "Die Adresse muss %d Bytes lang sein"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
msgid "All I2C peripherals are in use"
|
||||
msgstr "Alle I2C-Peripheriegeräte sind in Benutzung"
|
||||
@ -353,21 +352,9 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr "Kann dotstar nicht mit %s verwenden"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr "Im Central mode können Dienste nicht hinzugefügt werden"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr "Im Central mode kann advertise nicht gemacht werden"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr "Im Central mode kann name nicht geändert werden"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
msgstr "Im Peripheral mode kann keine Verbindung hergestellt werden"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
msgid "Cannot delete values"
|
||||
@ -496,15 +483,10 @@ msgstr "Data 0 pin muss am Byte ausgerichtet sein"
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr "Zu vielen Daten für das advertisement packet"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr "Daten sind zu groß für das advertisement packet"
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr "Die Zielkapazität ist kleiner als destination_length."
|
||||
@ -542,6 +524,10 @@ msgstr "Characteristic wird erwartet"
|
||||
msgid "Expected a UUID"
|
||||
msgstr "Eine UUID wird erwartet"
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -551,11 +537,7 @@ msgstr "Habe ein Tupel der Länge %d erwartet aber %d erhalten"
|
||||
msgid "Failed sending command."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr "Akquirieren des Mutex gescheitert"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr "Mutex konnte nicht akquiriert werden. Status: 0x%04x"
|
||||
@ -565,10 +547,6 @@ msgstr "Mutex konnte nicht akquiriert werden. Status: 0x%04x"
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr "Hinzufügen des Characteristic ist gescheitert. Status: 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to add service"
|
||||
msgstr "Dienst konnte nicht hinzugefügt werden"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -588,24 +566,21 @@ msgstr "Konnte keine RX Buffer mit %d allozieren"
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr "Fehler beim Ändern des Softdevice-Status"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to connect:"
|
||||
msgstr "Verbindung fehlgeschlagen:"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to continue scanning"
|
||||
msgstr "Der Scanvorgang kann nicht fortgesetzt werden"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr "Der Scanvorgang kann nicht fortgesetzt werden. Status: 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to create mutex"
|
||||
msgstr "Erstellen des Mutex ist fehlgeschlagen"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to discover services"
|
||||
msgstr "Es konnten keine Dienste gefunden werden"
|
||||
|
||||
@ -642,44 +617,41 @@ msgstr "gatts value konnte nicht gelesen werden. Status: 0x%04x"
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr "Kann keine herstellerspezifische UUID hinzufügen. Status: 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to release mutex"
|
||||
msgstr "Loslassen des Mutex gescheitert"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr "Mutex konnte nicht freigegeben werden. Status: 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start advertising"
|
||||
msgstr "Kann advertisement nicht starten"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr "Kann advertisement nicht starten. Status: 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start scanning"
|
||||
msgstr "Der Scanvorgang kann nicht gestartet werden"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr "Der Scanvorgang kann nicht gestartet werden. Status: 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr "Kann advertisement nicht stoppen"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr "Kann advertisement nicht stoppen. Status: 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -904,6 +876,10 @@ msgstr ""
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr "Kein DAC im Chip vorhanden"
|
||||
@ -954,6 +930,7 @@ msgstr "Kein Speicherplatz auf Gerät"
|
||||
msgid "No such file/directory"
|
||||
msgstr "Keine solche Datei/Verzeichnis"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
msgid "Not connected"
|
||||
msgstr "Nicht verbunden"
|
||||
@ -1225,8 +1202,8 @@ msgid "USB Error"
|
||||
msgstr "USB Fehler"
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgstr "UUID-Integer nicht im Bereich 0 bis 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'"
|
||||
@ -1925,9 +1902,10 @@ msgstr "int() arg 2 muss >= 2 und <= 36 sein"
|
||||
msgid "integer required"
|
||||
msgstr "integer erforderlich"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
msgstr "Das Interval ist nicht im Bereich 0.0020 bis 10.24"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
msgid "invalid I2C peripheral"
|
||||
@ -2146,6 +2124,14 @@ msgstr "Kein Modul mit dem Namen '%q'"
|
||||
msgid "no such attribute"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr "ein non-default argument folgt auf ein default argument"
|
||||
@ -2358,10 +2344,6 @@ msgstr "Der schedule stack ist voll"
|
||||
msgid "script compilation not supported"
|
||||
msgstr "kompilieren von Skripten ist nicht unterstützt"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr ""
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr ""
|
||||
@ -2633,6 +2615,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr "write_args muss eine Liste, ein Tupel oder None sein"
|
||||
@ -2664,9 +2650,24 @@ msgstr ""
|
||||
#~ msgid "AP required"
|
||||
#~ msgstr "AP erforderlich"
|
||||
|
||||
#~ msgid "Address is not %d bytes long or is in wrong format"
|
||||
#~ msgstr "Die Adresse ist nicht %d Bytes lang oder das Format ist falsch"
|
||||
|
||||
#~ msgid "C-level assert"
|
||||
#~ msgstr "C-Level Assert"
|
||||
|
||||
#~ msgid "Can't add services in Central mode"
|
||||
#~ msgstr "Im Central mode können Dienste nicht hinzugefügt werden"
|
||||
|
||||
#~ msgid "Can't advertise in Central mode"
|
||||
#~ msgstr "Im Central mode kann advertise nicht gemacht werden"
|
||||
|
||||
#~ msgid "Can't change the name in Central mode"
|
||||
#~ msgstr "Im Central mode kann name nicht geändert werden"
|
||||
|
||||
#~ msgid "Can't connect in Peripheral mode"
|
||||
#~ msgstr "Im Peripheral mode kann keine Verbindung hergestellt werden"
|
||||
|
||||
#~ msgid "Cannot connect to AP"
|
||||
#~ msgstr "Kann nicht zu AP verbinden"
|
||||
|
||||
@ -2679,6 +2680,9 @@ msgstr ""
|
||||
#~ msgid "Cannot update i/f status"
|
||||
#~ msgstr "Kann i/f Status nicht updaten"
|
||||
|
||||
#~ msgid "Data too large for the advertisement packet"
|
||||
#~ msgstr "Daten sind zu groß für das advertisement packet"
|
||||
|
||||
#~ msgid "Don't know how to pass object to native function"
|
||||
#~ msgstr ""
|
||||
#~ "Ich weiß nicht, wie man das Objekt an die native Funktion übergeben kann"
|
||||
@ -2692,12 +2696,39 @@ msgstr ""
|
||||
#~ msgid "Error in ffi_prep_cif"
|
||||
#~ msgstr "Fehler in ffi_prep_cif"
|
||||
|
||||
#~ msgid "Failed to acquire mutex"
|
||||
#~ msgstr "Akquirieren des Mutex gescheitert"
|
||||
|
||||
#~ msgid "Failed to add service"
|
||||
#~ msgstr "Dienst konnte nicht hinzugefügt werden"
|
||||
|
||||
#~ msgid "Failed to connect:"
|
||||
#~ msgstr "Verbindung fehlgeschlagen:"
|
||||
|
||||
#~ msgid "Failed to continue scanning"
|
||||
#~ msgstr "Der Scanvorgang kann nicht fortgesetzt werden"
|
||||
|
||||
#~ msgid "Failed to create mutex"
|
||||
#~ msgstr "Erstellen des Mutex ist fehlgeschlagen"
|
||||
|
||||
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
|
||||
#~ msgstr "Kann den Attributwert nicht mitteilen. Status: 0x%04x"
|
||||
|
||||
#~ msgid "Failed to read attribute value, err %0x04x"
|
||||
#~ msgstr "Kann den Attributwert nicht lesen. Status: 0x%04x"
|
||||
|
||||
#~ msgid "Failed to release mutex"
|
||||
#~ msgstr "Loslassen des Mutex gescheitert"
|
||||
|
||||
#~ msgid "Failed to start advertising"
|
||||
#~ msgstr "Kann advertisement nicht starten"
|
||||
|
||||
#~ msgid "Failed to start scanning"
|
||||
#~ msgstr "Der Scanvorgang kann nicht gestartet werden"
|
||||
|
||||
#~ msgid "Failed to stop advertising"
|
||||
#~ msgstr "Kann advertisement nicht stoppen"
|
||||
|
||||
#~ msgid "Function requires lock."
|
||||
#~ msgstr ""
|
||||
#~ "Die Funktion erwartet, dass der 'lock'-Befehl zuvor ausgeführt wurde"
|
||||
@ -2769,6 +2800,9 @@ msgstr ""
|
||||
#~ msgid "UART(1) can't read"
|
||||
#~ msgstr "UART(1) kann nicht lesen"
|
||||
|
||||
#~ msgid "UUID integer value not in range 0 to 0xffff"
|
||||
#~ msgstr "UUID-Integer nicht im Bereich 0 bis 0xffff"
|
||||
|
||||
#~ msgid "Unable to remount filesystem"
|
||||
#~ msgstr "Dateisystem konnte nicht wieder eingebunden werden."
|
||||
|
||||
@ -2800,6 +2834,9 @@ msgstr ""
|
||||
#~ msgid "impossible baudrate"
|
||||
#~ msgstr "Unmögliche Baudrate"
|
||||
|
||||
#~ msgid "interval not in range 0.0020 to 10.24"
|
||||
#~ msgstr "Das Interval ist nicht im Bereich 0.0020 bis 10.24"
|
||||
|
||||
#~ msgid "invalid alarm"
|
||||
#~ msgstr "ungültiger Alarm"
|
||||
|
||||
|
112
locale/en_US.po
112
locale/en_US.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
|
||||
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@ -219,12 +219,11 @@ msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
@ -349,20 +348,8 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
@ -492,15 +479,10 @@ msgstr ""
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr ""
|
||||
@ -538,6 +520,10 @@ msgstr ""
|
||||
msgid "Expected a UUID"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -547,11 +533,7 @@ msgstr ""
|
||||
msgid "Failed sending command."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr ""
|
||||
@ -561,10 +543,6 @@ msgstr ""
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to add service"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -584,12 +562,13 @@ msgstr ""
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to connect:"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to continue scanning"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
@ -597,11 +576,7 @@ msgstr ""
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to create mutex"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to discover services"
|
||||
msgstr ""
|
||||
|
||||
@ -638,27 +613,24 @@ msgstr ""
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to release mutex"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start advertising"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start scanning"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
@ -666,16 +638,16 @@ msgstr ""
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -891,6 +863,10 @@ msgstr ""
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr ""
|
||||
@ -941,6 +917,7 @@ msgstr ""
|
||||
msgid "No such file/directory"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
msgid "Not connected"
|
||||
msgstr ""
|
||||
@ -1196,7 +1173,7 @@ msgid "USB Error"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
@ -1884,8 +1861,9 @@ msgstr ""
|
||||
msgid "integer required"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
@ -2099,6 +2077,14 @@ msgstr ""
|
||||
msgid "no such attribute"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr ""
|
||||
@ -2307,10 +2293,6 @@ msgstr ""
|
||||
msgid "script compilation not supported"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr ""
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr ""
|
||||
@ -2577,6 +2559,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr ""
|
||||
|
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
|
||||
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: @sommersoft, @MrCertainly\n"
|
||||
@ -221,12 +221,11 @@ msgstr "Avast! A hardware interrupt channel be used already"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
@ -353,20 +352,8 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
@ -496,15 +483,10 @@ msgstr ""
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr ""
|
||||
@ -542,6 +524,10 @@ msgstr ""
|
||||
msgid "Expected a UUID"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -551,11 +537,7 @@ msgstr ""
|
||||
msgid "Failed sending command."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr ""
|
||||
@ -565,10 +547,6 @@ msgstr ""
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to add service"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -588,12 +566,13 @@ msgstr ""
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to connect:"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to continue scanning"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
@ -601,11 +580,7 @@ msgstr ""
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to create mutex"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to discover services"
|
||||
msgstr ""
|
||||
|
||||
@ -642,27 +617,24 @@ msgstr ""
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to release mutex"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start advertising"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start scanning"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
@ -670,16 +642,16 @@ msgstr ""
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -895,6 +867,10 @@ msgstr ""
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr "Shiver me timbers! There be no DAC on this chip"
|
||||
@ -945,6 +921,7 @@ msgstr ""
|
||||
msgid "No such file/directory"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
msgid "Not connected"
|
||||
msgstr ""
|
||||
@ -1200,7 +1177,7 @@ msgid "USB Error"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
@ -1888,8 +1865,9 @@ msgstr ""
|
||||
msgid "integer required"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
@ -2103,6 +2081,14 @@ msgstr ""
|
||||
msgid "no such attribute"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr ""
|
||||
@ -2311,10 +2297,6 @@ msgstr ""
|
||||
msgid "script compilation not supported"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr ""
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr ""
|
||||
@ -2581,6 +2563,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr ""
|
||||
|
224
locale/es.po
224
locale/es.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-09 09:07-0400\n"
|
||||
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@ -219,16 +219,15 @@ msgstr "pow() con 3 argumentos no soportado"
|
||||
msgid "A hardware interrupt channel is already in use"
|
||||
msgstr "El canal EXTINT ya está siendo utilizado"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgstr "Direción no es %d bytes de largo o esta en el formato incorrecto"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr "La dirección debe ser %d bytes de largo"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
msgid "All I2C peripherals are in use"
|
||||
msgstr "Todos los periféricos I2C están siendo usados"
|
||||
@ -247,7 +246,9 @@ msgstr "Todos los canales de eventos estan siendo usados"
|
||||
|
||||
#: ports/atmel-samd/audio_dma.c ports/atmel-samd/common-hal/audiobusio/PDMIn.c
|
||||
msgid "All sync event channels in use"
|
||||
msgstr "Todos los canales de eventos de sincronización (sync event channels) están siendo utilizados"
|
||||
msgstr ""
|
||||
"Todos los canales de eventos de sincronización (sync event channels) están "
|
||||
"siendo utilizados"
|
||||
|
||||
#: shared-bindings/pulseio/PWMOut.c
|
||||
msgid "All timers for this pin are in use"
|
||||
@ -287,7 +288,9 @@ msgstr "Valores del array deben ser bytes individuales."
|
||||
|
||||
#: supervisor/shared/safe_mode.c
|
||||
msgid "Attempted heap allocation when MicroPython VM not running.\n"
|
||||
msgstr "Intento de allocation de heap cuando la VM de MicroPython no estaba corriendo.\n"
|
||||
msgstr ""
|
||||
"Intento de allocation de heap cuando la VM de MicroPython no estaba "
|
||||
"corriendo.\n"
|
||||
|
||||
#: main.c
|
||||
msgid "Auto-reload is off.\n"
|
||||
@ -297,7 +300,9 @@ msgstr "Auto-recarga deshabilitada.\n"
|
||||
msgid ""
|
||||
"Auto-reload is on. Simply save files over USB to run them or enter REPL to "
|
||||
"disable.\n"
|
||||
msgstr "Auto-reload habilitado. Simplemente guarda los archivos via USB para ejecutarlos o entra al REPL para desabilitarlos.\n"
|
||||
msgstr ""
|
||||
"Auto-reload habilitado. Simplemente guarda los archivos via USB para "
|
||||
"ejecutarlos o entra al REPL para desabilitarlos.\n"
|
||||
|
||||
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
|
||||
msgid "Bit clock and word select must share a clock unit"
|
||||
@ -351,21 +356,9 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr "No se puede usar dotstar con %s"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr "No se pueden agregar servicio en modo Central"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr "No puede anunciarse en Central mode"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr "No se puede cambiar el nombre en modo Central"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
msgstr "No se puede conectar en modo Peripheral"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
msgid "Cannot delete values"
|
||||
@ -494,15 +487,10 @@ msgstr "El pin Data 0 debe estar alineado a bytes"
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr "Trozo de datos debe seguir fmt chunk"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr "Data es muy grande para el paquete de advertisement."
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr "Data es muy grande para el paquete de advertisement."
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr "Capacidad de destino es mas pequeña que destination_length."
|
||||
@ -540,6 +528,10 @@ msgstr "Se esperaba una Característica."
|
||||
msgid "Expected a UUID"
|
||||
msgstr "Se esperaba un UUID"
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -549,24 +541,16 @@ msgstr "Se esperaba un tuple de %d, se obtuvo %d"
|
||||
msgid "Failed sending command."
|
||||
msgstr "Fallo enviando comando"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr "Fallo al adquirir el mutex"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr "Fallo al adquirir el mutex, err: 0x%08lX"
|
||||
msgstr "No se puede adquirir el mutex, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Service.c
|
||||
#, c-format
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr "Fallo al añadir caracteristica, err: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to add service"
|
||||
msgstr "Fallo al agregar servicio"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -586,24 +570,22 @@ msgstr "Falló la asignación del buffer RX de %d bytes"
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr "No se puede cambiar el estado del softdevice"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to connect:"
|
||||
msgstr "No se puede conectar:"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to continue scanning"
|
||||
msgstr "No se puede iniciar el escaneo."
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr "No se puede iniciar el escaneo. err: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to create mutex"
|
||||
msgstr "Fallo al crear mutex"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, fuzzy
|
||||
msgid "Failed to discover services"
|
||||
msgstr "No se puede descubrir servicios"
|
||||
|
||||
@ -640,44 +622,41 @@ msgstr "No se puede escribir el valor del atributo. status: 0x%02x"
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr "Fallo al registrar el Vendor-Specific UUID, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to release mutex"
|
||||
msgstr "No se puede liberar el mutex, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr "No se puede liberar el mutex, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start advertising"
|
||||
msgstr "No se puede inicar el anuncio"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr "No se puede inicar el anuncio. err: 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start scanning"
|
||||
msgstr "No se puede iniciar el escaneo"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr "No se puede iniciar el escaneo. err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr "No se puede detener el anuncio"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr "No se puede detener el anuncio. err: 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -735,7 +714,9 @@ msgstr "operación I2C no soportada"
|
||||
msgid ""
|
||||
"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/"
|
||||
"mpy-update for more info."
|
||||
msgstr "Archivo .mpy incompatible. Actualice todos los archivos .mpy. Consulte http://adafru.it/mpy-update para más información"
|
||||
msgstr ""
|
||||
"Archivo .mpy incompatible. Actualice todos los archivos .mpy. Consulte "
|
||||
"http://adafru.it/mpy-update para más información"
|
||||
|
||||
#: shared-bindings/_pew/PewPew.c
|
||||
msgid "Incorrect buffer size"
|
||||
@ -897,6 +878,10 @@ msgstr "Micrófono demora de inicio debe estar en el rango 0.0 a 1.0"
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr "Debe de ser una subclase de %q"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr "El chip no tiene DAC"
|
||||
@ -947,6 +932,7 @@ msgstr "No queda espacio en el dispositivo"
|
||||
msgid "No such file/directory"
|
||||
msgstr "No existe el archivo/directorio"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
msgid "Not connected"
|
||||
msgstr "No conectado"
|
||||
@ -959,7 +945,8 @@ msgstr "No reproduciendo"
|
||||
msgid ""
|
||||
"Object has been deinitialized and can no longer be used. Create a new object."
|
||||
msgstr ""
|
||||
"El objeto se ha desinicializado y ya no se puede utilizar. Crea un nuevo objeto"
|
||||
"El objeto se ha desinicializado y ya no se puede utilizar. Crea un nuevo "
|
||||
"objeto"
|
||||
|
||||
#: ports/nrf/common-hal/busio/UART.c
|
||||
msgid "Odd parity is not supported"
|
||||
@ -1226,8 +1213,8 @@ msgid "USB Error"
|
||||
msgstr "Error USB"
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgstr "UUID integer valor no es en el distancia de 0 a 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'"
|
||||
@ -1370,8 +1357,8 @@ msgstr "argumento es una secuencia vacía"
|
||||
msgid "argument has wrong type"
|
||||
msgstr "el argumento tiene un tipo erroneo"
|
||||
|
||||
#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c
|
||||
#: shared-bindings/gamepad/GamePad.c shared-bindings/_stage/__init__.c
|
||||
#: py/argcheck.c shared-bindings/_stage/__init__.c
|
||||
#: shared-bindings/digitalio/DigitalInOut.c shared-bindings/gamepad/GamePad.c
|
||||
msgid "argument num/types mismatch"
|
||||
msgstr "argumento número/tipos no coinciden"
|
||||
|
||||
@ -1930,9 +1917,10 @@ msgstr "int() arg 2 debe ser >= 2 y <= 36"
|
||||
msgid "integer required"
|
||||
msgstr "Entero requerido"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
msgstr "interval no estan en el rango 0.0020 a 10.24"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
msgid "invalid I2C peripheral"
|
||||
@ -2148,6 +2136,14 @@ msgstr "ningún módulo se llama '%q'"
|
||||
msgid "no such attribute"
|
||||
msgstr "no hay tal atributo"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr "argumento no predeterminado sigue argumento predeterminado"
|
||||
@ -2363,10 +2359,6 @@ msgstr ""
|
||||
msgid "script compilation not supported"
|
||||
msgstr "script de compilación no soportado"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr "services incluye un objeto que no es Servicio"
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr "signo no permitido en el espeficador de string format"
|
||||
@ -2634,6 +2626,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr ""
|
||||
@ -2667,6 +2663,21 @@ msgstr "paso cero"
|
||||
#~ msgid "AP required"
|
||||
#~ msgstr "AP requerido"
|
||||
|
||||
#~ msgid "Address is not %d bytes long or is in wrong format"
|
||||
#~ msgstr "Direción no es %d bytes largo o esta en el formato incorrecto"
|
||||
|
||||
#~ msgid "Can't add services in Central mode"
|
||||
#~ msgstr "No se pueden agregar servicio en modo Central"
|
||||
|
||||
#~ msgid "Can't advertise in Central mode"
|
||||
#~ msgstr "No se puede anunciar en modo Central"
|
||||
|
||||
#~ msgid "Can't change the name in Central mode"
|
||||
#~ msgstr "No se puede cambiar el nombre en modo Central"
|
||||
|
||||
#~ msgid "Can't connect in Peripheral mode"
|
||||
#~ msgstr "No se puede conectar en modo Peripheral"
|
||||
|
||||
#~ msgid "Cannot connect to AP"
|
||||
#~ msgstr "No se puede conectar a AP"
|
||||
|
||||
@ -2679,6 +2690,10 @@ msgstr "paso cero"
|
||||
#~ msgid "Cannot update i/f status"
|
||||
#~ msgstr "No se puede actualizar i/f status"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Data too large for the advertisement packet"
|
||||
#~ msgstr "Los datos no caben en el paquete de anuncio."
|
||||
|
||||
#~ msgid "Don't know how to pass object to native function"
|
||||
#~ msgstr "No se sabe cómo pasar objeto a función nativa"
|
||||
|
||||
@ -2691,6 +2706,26 @@ msgstr "paso cero"
|
||||
#~ msgid "Error in ffi_prep_cif"
|
||||
#~ msgstr "Error en ffi_prep_cif"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to acquire mutex"
|
||||
#~ msgstr "No se puede adquirir el mutex, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to add service"
|
||||
#~ msgstr "No se puede detener el anuncio. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to connect:"
|
||||
#~ msgstr "No se puede conectar. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to continue scanning"
|
||||
#~ msgstr "No se puede iniciar el escaneo. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to create mutex"
|
||||
#~ msgstr "No se puede leer el valor del atributo. status 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
|
||||
#~ msgstr "No se puede notificar el valor del anuncio. status: 0x%02x"
|
||||
@ -2699,6 +2734,22 @@ msgstr "paso cero"
|
||||
#~ msgid "Failed to read attribute value, err %0x04x"
|
||||
#~ msgstr "No se puede leer el valor del atributo. status 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to release mutex"
|
||||
#~ msgstr "No se puede liberar el mutex, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start advertising"
|
||||
#~ msgstr "No se puede inicar el anuncio. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start scanning"
|
||||
#~ msgstr "No se puede iniciar el escaneo. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to stop advertising"
|
||||
#~ msgstr "No se puede detener el anuncio. status: 0x%02x"
|
||||
|
||||
#~ msgid "Function requires lock."
|
||||
#~ msgstr "La función requiere lock"
|
||||
|
||||
@ -2772,6 +2823,9 @@ msgstr "paso cero"
|
||||
#~ msgid "UART(1) can't read"
|
||||
#~ msgstr "UART(1) no puede leer"
|
||||
|
||||
#~ msgid "UUID integer value not in range 0 to 0xffff"
|
||||
#~ msgstr "El valor integer UUID no está en el rango 0 a 0xffff"
|
||||
|
||||
#~ msgid "Unable to remount filesystem"
|
||||
#~ msgstr "Incapaz de montar de nuevo el sistema de archivos"
|
||||
|
||||
@ -2821,6 +2875,9 @@ msgstr "paso cero"
|
||||
#~ msgid "impossible baudrate"
|
||||
#~ msgstr "baudrate imposible"
|
||||
|
||||
#~ msgid "interval not in range 0.0020 to 10.24"
|
||||
#~ msgstr "El intervalo está fuera del rango de 0.0020 a 10.24"
|
||||
|
||||
#~ msgid "invalid alarm"
|
||||
#~ msgstr "alarma inválida"
|
||||
|
||||
@ -2858,6 +2915,9 @@ msgstr "paso cero"
|
||||
#~ msgid "scan failed"
|
||||
#~ msgstr "scan ha fallado"
|
||||
|
||||
#~ msgid "services includes an object that is not a Service"
|
||||
#~ msgstr "services incluye un objeto que no es servicio"
|
||||
|
||||
#~ msgid "too many arguments"
|
||||
#~ msgstr "muchos argumentos"
|
||||
|
||||
|
188
locale/fil.po
188
locale/fil.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
|
||||
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
|
||||
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
|
||||
"Language-Team: fil\n"
|
||||
@ -220,16 +220,15 @@ msgstr "3-arg pow() hindi suportado"
|
||||
msgid "A hardware interrupt channel is already in use"
|
||||
msgstr "Isang channel ng hardware interrupt ay ginagamit na"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr "ang palette ay dapat 32 bytes ang haba"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
msgid "All I2C peripherals are in use"
|
||||
msgstr "Lahat ng I2C peripherals ginagamit"
|
||||
@ -356,21 +355,9 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr "Hindi maarang maglagay ng service sa Central mode"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr "Hindi ma advertise habang nasa Central mode"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr "Hindi mapalitan ang pangalan sa Central mode"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
msgstr "Hindi maconnect sa Peripheral mode"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
msgid "Cannot delete values"
|
||||
@ -502,17 +489,11 @@ msgstr "graphic ay dapat 2048 bytes ang haba"
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr "Dapat sunurin ng Data chunk ang fmt chunk"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr "Hindi makasya ang data sa loob ng advertisement packet"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr "Hindi makasya ang data sa loob ng advertisement packet"
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr ""
|
||||
@ -553,6 +534,10 @@ msgstr "Hindi mabasa and Characteristic."
|
||||
msgid "Expected a UUID"
|
||||
msgstr "Umasa ng %q"
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -562,12 +547,7 @@ msgstr ""
|
||||
msgid "Failed sending command."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr "Nabigo sa pag kuha ng mutex, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr "Nabigo sa pag kuha ng mutex, status: 0x%08lX"
|
||||
@ -577,11 +557,6 @@ msgstr "Nabigo sa pag kuha ng mutex, status: 0x%08lX"
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr "Nabigo sa paglagay ng characteristic, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to add service"
|
||||
msgstr "Hindi matagumpay ang paglagay ng service, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -602,27 +577,21 @@ msgstr "Nabigong ilaan ang RX buffer ng %d bytes"
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr "Nabigo sa pagbago ng softdevice state, error: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to connect:"
|
||||
msgstr "Hindi makaconnect, status: 0x%08lX"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to continue scanning"
|
||||
msgstr "Hindi maituloy ang pag scan, status: 0x%0xlX"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr "Hindi maituloy ang pag scan, status: 0x%0xlX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to create mutex"
|
||||
msgstr "Hindi matagumpay ang pagbuo ng mutex, status: 0x%0xlX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, fuzzy
|
||||
msgid "Failed to discover services"
|
||||
msgstr "Nabigo sa pagdiscover ng services, status: 0x%08lX"
|
||||
@ -662,48 +631,41 @@ msgstr "Hindi maisulat ang gatts value, status: 0x%08lX"
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr "Hindi matagumpay ang paglagay ng Vender Specific UUID, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to release mutex"
|
||||
msgstr "Nabigo sa pagrelease ng mutex, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr "Nabigo sa pagrelease ng mutex, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to start advertising"
|
||||
msgstr "Hindi masimulaan ang advertisement, status: 0x%08lX"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr "Hindi masimulaan ang advertisement, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to start scanning"
|
||||
msgstr "Hindi masimulaan mag i-scan, status: 0x%0xlX"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr "Hindi masimulaan mag i-scan, status: 0x%0xlX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr "Hindi mahinto ang advertisement, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr "Hindi mahinto ang advertisement, status: 0x%08lX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -925,6 +887,10 @@ msgstr "Ang delay ng startup ng mikropono ay dapat na nasa 0.0 hanggang 1.0"
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr "Walang DAC sa chip"
|
||||
@ -975,6 +941,7 @@ msgstr ""
|
||||
msgid "No such file/directory"
|
||||
msgstr "Walang file/directory"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
#, fuzzy
|
||||
msgid "Not connected"
|
||||
@ -1249,7 +1216,7 @@ msgid "USB Error"
|
||||
msgstr "May pagkakamali ang USB"
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
@ -1960,8 +1927,9 @@ msgstr "int() arg 2 ay dapat >=2 at <= 36"
|
||||
msgid "integer required"
|
||||
msgstr "kailangan ng int"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
@ -2180,6 +2148,14 @@ msgstr "walang module na '%q'"
|
||||
msgid "no such attribute"
|
||||
msgstr "walang ganoon na attribute"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr "non-default argument sumusunod sa default argument"
|
||||
@ -2393,10 +2369,6 @@ msgstr "puno na ang schedule stack"
|
||||
msgid "script compilation not supported"
|
||||
msgstr "script kompilasyon hindi supportado"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr ""
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr "sign hindi maaring string format specifier"
|
||||
@ -2665,6 +2637,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr ""
|
||||
@ -2701,6 +2677,18 @@ msgstr "zero step"
|
||||
#~ msgid "C-level assert"
|
||||
#~ msgstr "C-level assert"
|
||||
|
||||
#~ msgid "Can't add services in Central mode"
|
||||
#~ msgstr "Hindi maarang maglagay ng service sa Central mode"
|
||||
|
||||
#~ msgid "Can't advertise in Central mode"
|
||||
#~ msgstr "Hindi ma advertise habang nasa Central mode"
|
||||
|
||||
#~ msgid "Can't change the name in Central mode"
|
||||
#~ msgstr "Hindi mapalitan ang pangalan sa Central mode"
|
||||
|
||||
#~ msgid "Can't connect in Peripheral mode"
|
||||
#~ msgstr "Hindi maconnect sa Peripheral mode"
|
||||
|
||||
#~ msgid "Cannot connect to AP"
|
||||
#~ msgstr "Hindi maka connect sa AP"
|
||||
|
||||
@ -2713,6 +2701,10 @@ msgstr "zero step"
|
||||
#~ msgid "Cannot update i/f status"
|
||||
#~ msgstr "Hindi ma-update i/f status"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Data too large for the advertisement packet"
|
||||
#~ msgstr "Hindi makasya ang data sa loob ng advertisement packet"
|
||||
|
||||
#~ msgid "Don't know how to pass object to native function"
|
||||
#~ msgstr "Hindi alam ipasa ang object sa native function"
|
||||
|
||||
@ -2725,6 +2717,26 @@ msgstr "zero step"
|
||||
#~ msgid "Error in ffi_prep_cif"
|
||||
#~ msgstr "Pagkakamali sa ffi_prep_cif"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to acquire mutex"
|
||||
#~ msgstr "Nabigo sa pag kuha ng mutex, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to add service"
|
||||
#~ msgstr "Hindi matagumpay ang paglagay ng service, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to connect:"
|
||||
#~ msgstr "Hindi makaconnect, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to continue scanning"
|
||||
#~ msgstr "Hindi maituloy ang pag scan, status: 0x%0xlX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to create mutex"
|
||||
#~ msgstr "Hindi matagumpay ang pagbuo ng mutex, status: 0x%0xlX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
|
||||
#~ msgstr "Hindi mabalitaan ang attribute value, status: 0x%08lX"
|
||||
@ -2733,6 +2745,22 @@ msgstr "zero step"
|
||||
#~ msgid "Failed to read attribute value, err %0x04x"
|
||||
#~ msgstr "Hindi mabasa ang value ng attribute, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to release mutex"
|
||||
#~ msgstr "Nabigo sa pagrelease ng mutex, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start advertising"
|
||||
#~ msgstr "Hindi masimulaan ang advertisement, status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start scanning"
|
||||
#~ msgstr "Hindi masimulaan mag i-scan, status: 0x%0xlX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to stop advertising"
|
||||
#~ msgstr "Hindi mahinto ang advertisement, status: 0x%08lX"
|
||||
|
||||
#~ msgid "Function requires lock."
|
||||
#~ msgstr "Kailangan ng lock ang function."
|
||||
|
||||
|
202
locale/fr.po
202
locale/fr.po
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 0.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
|
||||
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
|
||||
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
|
||||
"Language-Team: fr\n"
|
||||
@ -221,16 +221,15 @@ msgstr "pow() non supporté avec 3 arguments"
|
||||
msgid "A hardware interrupt channel is already in use"
|
||||
msgstr "Un canal d'interruptions matérielles est déjà utilisé"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgstr "L'adresse n'est pas longue de %d octets ou est d'un format erroné"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr "L'adresse doit être longue de %d octets"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
#, fuzzy
|
||||
msgid "All I2C peripherals are in use"
|
||||
@ -361,21 +360,9 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr "Impossible d'utiliser 'dotstar' avec %s"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr "Impossible d'ajouter des services en mode Central"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr "Impossible de publier en mode Central"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr "Modification du nom impossible en mode Central"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
msgstr "Impossible de se connecter en mode 'Peripheral'"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
msgid "Cannot delete values"
|
||||
@ -508,15 +495,10 @@ msgstr "La broche 'Data 0' doit être aligné sur l'octet"
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr "Un bloc de données doit suivre un bloc de format"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr "Données trop volumineuses pour un paquet de diffusion"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr "Données trop volumineuses pour le paquet de diffusion"
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr "La capacité de destination est plus petite que 'destination_length'."
|
||||
@ -556,6 +538,10 @@ msgstr "Une 'Characteristic' est attendue"
|
||||
msgid "Expected a UUID"
|
||||
msgstr "Un UUID est attendu"
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -565,12 +551,7 @@ msgstr "Tuple de longueur %d attendu, obtenu %d"
|
||||
msgid "Failed sending command."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr "Echec de l'obtention de mutex"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr "Echec de l'obtention de mutex, err 0x%04x"
|
||||
@ -580,11 +561,6 @@ msgstr "Echec de l'obtention de mutex, err 0x%04x"
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr "Echec de l'ajout de caractéristique, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to add service"
|
||||
msgstr "Echec de l'ajout de service"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -605,27 +581,21 @@ msgstr "Echec de l'allocation de %d octets du tampon RX"
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr "Echec de la modification de l'état du périphérique"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to connect:"
|
||||
msgstr "Echec de connection:"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to continue scanning"
|
||||
msgstr "Impossible de poursuivre le scan"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr "Impossible de poursuivre le scan, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to create mutex"
|
||||
msgstr "Echec de la création de mutex"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, fuzzy
|
||||
msgid "Failed to discover services"
|
||||
msgstr "Echec de la découverte de services"
|
||||
@ -666,48 +636,41 @@ msgstr "Impossible de lire la valeur de 'gatts', err 0x%04x"
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr "Echec de l'ajout de l'UUID du fournisseur, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to release mutex"
|
||||
msgstr "Impossible de libérer mutex"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr "Impossible de libérer mutex, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to start advertising"
|
||||
msgstr "Echec du démarrage de la diffusion"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr "Impossible de commencer à diffuser, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to start scanning"
|
||||
msgstr "Impossible de commencer à scanner"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr "Impossible de commencer à scanner, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr "Echec de l'arrêt de diffusion"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr "Echec de l'arrêt de diffusion, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -933,6 +896,10 @@ msgstr "Le délais au démarrage du micro doit être entre 0.0 et 1.0"
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr "Pas de DAC sur la puce"
|
||||
@ -983,6 +950,7 @@ msgstr "Il n'y a plus d'espace libre sur le périphérique"
|
||||
msgid "No such file/directory"
|
||||
msgstr "Fichier/dossier introuvable"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
#, fuzzy
|
||||
msgid "Not connected"
|
||||
@ -1269,8 +1237,8 @@ msgid "USB Error"
|
||||
msgstr "Erreur USB"
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgstr "valeur de l'entier UUID est hors-bornes 0 à 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'"
|
||||
@ -1992,9 +1960,10 @@ msgstr "l'argument 2 de int() doit être >=2 et <=36"
|
||||
msgid "integer required"
|
||||
msgstr "entier requis"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
msgstr "intervalle hors bornes 0.0020 à 10.24"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
msgid "invalid I2C peripheral"
|
||||
@ -2213,6 +2182,14 @@ msgstr "pas de module '%q'"
|
||||
msgid "no such attribute"
|
||||
msgstr "pas de tel attribut"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr ""
|
||||
@ -2433,10 +2410,6 @@ msgstr "pile de planification pleine"
|
||||
msgid "script compilation not supported"
|
||||
msgstr "compilation de script non supportée"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr "'services' inclut un object qui n'est pas un 'Service'"
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr "signe non autorisé dans les spéc. de formats de chaînes de caractères"
|
||||
@ -2707,6 +2680,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr "'value_count' doit être > 0"
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr "'write_args' doit être une liste, un tuple ou 'None'"
|
||||
@ -2741,6 +2718,21 @@ msgstr "'step' nul"
|
||||
#~ msgid "AP required"
|
||||
#~ msgstr "'AP' requis"
|
||||
|
||||
#~ msgid "Address is not %d bytes long or is in wrong format"
|
||||
#~ msgstr "L'adresse n'est pas longue de %d octets ou est d'un format erroné"
|
||||
|
||||
#~ msgid "Can't add services in Central mode"
|
||||
#~ msgstr "Impossible d'ajouter des services en mode Central"
|
||||
|
||||
#~ msgid "Can't advertise in Central mode"
|
||||
#~ msgstr "Impossible de publier en mode Central"
|
||||
|
||||
#~ msgid "Can't change the name in Central mode"
|
||||
#~ msgstr "Modification du nom impossible en mode Central"
|
||||
|
||||
#~ msgid "Can't connect in Peripheral mode"
|
||||
#~ msgstr "Impossible de se connecter en mode 'Peripheral'"
|
||||
|
||||
#~ msgid "Cannot connect to AP"
|
||||
#~ msgstr "Impossible de se connecter à 'AP'"
|
||||
|
||||
@ -2753,6 +2745,9 @@ msgstr "'step' nul"
|
||||
#~ msgid "Cannot update i/f status"
|
||||
#~ msgstr "le status i/f ne peut être mis à jour"
|
||||
|
||||
#~ msgid "Data too large for the advertisement packet"
|
||||
#~ msgstr "Données trop volumineuses pour le paquet de diffusion"
|
||||
|
||||
#~ msgid "Don't know how to pass object to native function"
|
||||
#~ msgstr "Ne sais pas comment passer l'objet à une fonction native"
|
||||
|
||||
@ -2765,6 +2760,26 @@ msgstr "'step' nul"
|
||||
#~ msgid "Error in ffi_prep_cif"
|
||||
#~ msgstr "Erreur dans ffi_prep_cif"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to acquire mutex"
|
||||
#~ msgstr "Echec de l'obtention de mutex"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to add service"
|
||||
#~ msgstr "Echec de l'ajout de service"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to connect:"
|
||||
#~ msgstr "Echec de connection:"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to continue scanning"
|
||||
#~ msgstr "Impossible de poursuivre le scan"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to create mutex"
|
||||
#~ msgstr "Echec de la création de mutex"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
|
||||
#~ msgstr "Impossible de notifier la valeur de l'attribut. status: 0x%08lX"
|
||||
@ -2773,6 +2788,22 @@ msgstr "'step' nul"
|
||||
#~ msgid "Failed to read attribute value, err %0x04x"
|
||||
#~ msgstr "Impossible de lire la valeur de l'attribut. status: 0x%08lX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to release mutex"
|
||||
#~ msgstr "Impossible de libérer mutex"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start advertising"
|
||||
#~ msgstr "Echec du démarrage de la diffusion"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start scanning"
|
||||
#~ msgstr "Impossible de commencer à scanner"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to stop advertising"
|
||||
#~ msgstr "Echec de l'arrêt de diffusion"
|
||||
|
||||
#~ msgid "Function requires lock."
|
||||
#~ msgstr "La fonction nécessite un verrou."
|
||||
|
||||
@ -2843,6 +2874,9 @@ msgstr "'step' nul"
|
||||
#~ msgid "UART(1) can't read"
|
||||
#~ msgstr "UART(1) ne peut pas lire"
|
||||
|
||||
#~ msgid "UUID integer value not in range 0 to 0xffff"
|
||||
#~ msgstr "valeur de l'entier UUID est hors-bornes 0 à 0xffff"
|
||||
|
||||
#~ msgid "Unable to remount filesystem"
|
||||
#~ msgstr "Impossible de remonter le système de fichiers"
|
||||
|
||||
@ -2889,6 +2923,9 @@ msgstr "'step' nul"
|
||||
#~ msgid "impossible baudrate"
|
||||
#~ msgstr "débit impossible"
|
||||
|
||||
#~ msgid "interval not in range 0.0020 to 10.24"
|
||||
#~ msgstr "intervalle hors bornes 0.0020 à 10.24"
|
||||
|
||||
#~ msgid "invalid alarm"
|
||||
#~ msgstr "alarme invalide"
|
||||
|
||||
@ -2924,6 +2961,9 @@ msgstr "'step' nul"
|
||||
#~ msgid "scan failed"
|
||||
#~ msgstr "échec du scan"
|
||||
|
||||
#~ msgid "services includes an object that is not a Service"
|
||||
#~ msgstr "'services' inclut un object qui n'est pas un 'Service'"
|
||||
|
||||
#~ msgid "too many arguments"
|
||||
#~ msgstr "trop d'arguments"
|
||||
|
||||
|
188
locale/it_IT.po
188
locale/it_IT.po
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
|
||||
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
|
||||
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
|
||||
"Language-Team: \n"
|
||||
@ -219,16 +219,15 @@ msgstr "pow() con tre argmomenti non supportata"
|
||||
msgid "A hardware interrupt channel is already in use"
|
||||
msgstr "Un canale di interrupt hardware è già in uso"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr "la palette deve essere lunga 32 byte"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
msgid "All I2C peripherals are in use"
|
||||
msgstr "Tutte le periferiche I2C sono in uso"
|
||||
@ -356,21 +355,9 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr "dotstar non può essere usato con %s"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr "non si può aggiungere servizi in Central mode"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr "non si può pubblicizzare in Central mode"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr "non si può cambiare il nome in Central mode"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
msgstr "non si può connettere in Periferal mode"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
msgid "Cannot delete values"
|
||||
@ -503,17 +490,11 @@ msgstr "graphic deve essere lunga 2048 byte"
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr "Impossibile inserire dati nel pacchetto di advertisement."
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr "Impossibile inserire dati nel pacchetto di advertisement."
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr "La capacità di destinazione è più piccola di destination_length."
|
||||
@ -553,6 +534,10 @@ msgstr "Non è possibile aggiungere Characteristic."
|
||||
msgid "Expected a UUID"
|
||||
msgstr "Atteso un %q"
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -562,12 +547,7 @@ msgstr ""
|
||||
msgid "Failed sending command."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr "Impossibile allocare buffer RX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
|
||||
@ -577,11 +557,6 @@ msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr "Impossibile fermare advertisement. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to add service"
|
||||
msgstr "Impossibile fermare advertisement. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -602,27 +577,21 @@ msgstr "Fallita allocazione del buffer RX di %d byte"
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr "Impossibile fermare advertisement. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to connect:"
|
||||
msgstr "Impossibile connettersi. status: 0x%02x"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to continue scanning"
|
||||
msgstr "Impossible iniziare la scansione. status: 0x%02x"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr "Impossible iniziare la scansione. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to create mutex"
|
||||
msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, fuzzy
|
||||
msgid "Failed to discover services"
|
||||
msgstr "Impossibile fermare advertisement. status: 0x%02x"
|
||||
@ -661,48 +630,41 @@ msgstr "Impossibile scrivere valore dell'attributo. status: 0x%02x"
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr "Non è possibile aggiungere l'UUID del vendor specifico da 128-bit"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to release mutex"
|
||||
msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to start advertising"
|
||||
msgstr "Impossibile avviare advertisement. status: 0x%02x"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr "Impossibile avviare advertisement. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to start scanning"
|
||||
msgstr "Impossible iniziare la scansione. status: 0x%02x"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr "Impossible iniziare la scansione. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr "Impossibile fermare advertisement. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr "Impossibile fermare advertisement. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -924,6 +886,10 @@ msgstr ""
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr "Nessun DAC sul chip"
|
||||
@ -974,6 +940,7 @@ msgstr "Non che spazio sul dispositivo"
|
||||
msgid "No such file/directory"
|
||||
msgstr "Nessun file/directory esistente"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
#, fuzzy
|
||||
msgid "Not connected"
|
||||
@ -1248,7 +1215,7 @@ msgid "USB Error"
|
||||
msgstr "Errore USB"
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
@ -1952,8 +1919,9 @@ msgstr "il secondo argomanto di int() deve essere >= 2 e <= 36"
|
||||
msgid "integer required"
|
||||
msgstr "intero richiesto"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
@ -2174,6 +2142,14 @@ msgstr "nessun modulo chiamato '%q'"
|
||||
msgid "no such attribute"
|
||||
msgstr "attributo inesistente"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr "argomento non predefinito segue argmoento predfinito"
|
||||
@ -2391,10 +2367,6 @@ msgstr ""
|
||||
msgid "script compilation not supported"
|
||||
msgstr "compilazione dello scrip non suportata"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr ""
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr "segno non permesso nello spcificatore di formato della stringa"
|
||||
@ -2663,6 +2635,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr ""
|
||||
@ -2699,6 +2675,18 @@ msgstr "zero step"
|
||||
#~ msgid "C-level assert"
|
||||
#~ msgstr "assert a livello C"
|
||||
|
||||
#~ msgid "Can't add services in Central mode"
|
||||
#~ msgstr "non si può aggiungere servizi in Central mode"
|
||||
|
||||
#~ msgid "Can't advertise in Central mode"
|
||||
#~ msgstr "non si può pubblicizzare in Central mode"
|
||||
|
||||
#~ msgid "Can't change the name in Central mode"
|
||||
#~ msgstr "non si può cambiare il nome in Central mode"
|
||||
|
||||
#~ msgid "Can't connect in Peripheral mode"
|
||||
#~ msgstr "non si può connettere in Periferal mode"
|
||||
|
||||
#~ msgid "Cannot connect to AP"
|
||||
#~ msgstr "Impossible connettersi all'AP"
|
||||
|
||||
@ -2711,6 +2699,10 @@ msgstr "zero step"
|
||||
#~ msgid "Cannot update i/f status"
|
||||
#~ msgstr "Impossibile aggiornare status di i/f"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Data too large for the advertisement packet"
|
||||
#~ msgstr "Impossibile inserire dati nel pacchetto di advertisement."
|
||||
|
||||
#~ msgid "Don't know how to pass object to native function"
|
||||
#~ msgstr "Non so come passare l'oggetto alla funzione nativa"
|
||||
|
||||
@ -2723,6 +2715,26 @@ msgstr "zero step"
|
||||
#~ msgid "Error in ffi_prep_cif"
|
||||
#~ msgstr "Errore in ffi_prep_cif"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to acquire mutex"
|
||||
#~ msgstr "Impossibile allocare buffer RX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to add service"
|
||||
#~ msgstr "Impossibile fermare advertisement. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to connect:"
|
||||
#~ msgstr "Impossibile connettersi. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to continue scanning"
|
||||
#~ msgstr "Impossible iniziare la scansione. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to create mutex"
|
||||
#~ msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
|
||||
#~ msgstr "Impossibile notificare valore dell'attributo. status: 0x%02x"
|
||||
@ -2731,6 +2743,22 @@ msgstr "zero step"
|
||||
#~ msgid "Failed to read attribute value, err %0x04x"
|
||||
#~ msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to release mutex"
|
||||
#~ msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start advertising"
|
||||
#~ msgstr "Impossibile avviare advertisement. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start scanning"
|
||||
#~ msgstr "Impossible iniziare la scansione. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to stop advertising"
|
||||
#~ msgstr "Impossibile fermare advertisement. status: 0x%02x"
|
||||
|
||||
#~ msgid "GPIO16 does not support pull up."
|
||||
#~ msgstr "GPIO16 non supporta pull-up"
|
||||
|
||||
|
184
locale/pl.po
184
locale/pl.po
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
|
||||
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
|
||||
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
|
||||
"Language-Team: pl\n"
|
||||
@ -218,16 +218,15 @@ msgstr "3-argumentowy pow() jest niewspierany"
|
||||
msgid "A hardware interrupt channel is already in use"
|
||||
msgstr "Kanał przerwań sprzętowych w użyciu"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgstr "Adres nie ma długości %d bajtów lub zły format"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr "Adres musi mieć %d bajtów"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
msgid "All I2C peripherals are in use"
|
||||
msgstr "Wszystkie peryferia I2C w użyciu"
|
||||
@ -352,21 +351,9 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr "Nie można używać dotstar z %s"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr "Nie można dodać serwisów w trybie Central"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr "Nie można rozgłaszać w trybie Central"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr "Nie można zmienić nazwy w trybie Central"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
msgstr "Nie można się łączyć w trybie Peripheral"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
msgid "Cannot delete values"
|
||||
@ -495,15 +482,10 @@ msgstr "Nóżka data 0 musi być wyrównana do bajtu"
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr "Fragment danych musi następować po fragmencie fmt"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr "Zbyt dużo danych pakietu rozgłoszeniowego"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr "Zbyt dużo danych pakietu rozgłoszeniowego"
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr "Pojemność celu mniejsza od destination_length."
|
||||
@ -541,6 +523,10 @@ msgstr "Oczekiwano charakterystyki"
|
||||
msgid "Expected a UUID"
|
||||
msgstr "Oczekiwano UUID"
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -550,11 +536,7 @@ msgstr "Oczekiwano krotkę długości %d, otrzymano %d"
|
||||
msgid "Failed sending command."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr "Nie udało się uzyskać blokady"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr "Nie udało się uzyskać blokady, błąd 0x$04x"
|
||||
@ -564,10 +546,6 @@ msgstr "Nie udało się uzyskać blokady, błąd 0x$04x"
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr "Nie udało się dodać charakterystyki, błąd 0x$04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to add service"
|
||||
msgstr "Nie udało się dodać serwisu"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -587,24 +565,21 @@ msgstr "Nie udała się alokacja %d bajtów na bufor RX"
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr "Nie udało się zmienić stanu softdevice"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to connect:"
|
||||
msgstr "Nie udało się połączenie:"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to continue scanning"
|
||||
msgstr "Nie udała się kontynuacja skanowania"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr "Nie udała się kontynuacja skanowania, błąd 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to create mutex"
|
||||
msgstr "Nie udało się stworzyć blokady"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to discover services"
|
||||
msgstr "Nie udało się odkryć serwisów"
|
||||
|
||||
@ -641,44 +616,41 @@ msgstr "Nie udało się odczytać gatts, błąd 0x%04x"
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr "Nie udało się zarejestrować UUID dostawcy, błąd 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to release mutex"
|
||||
msgstr "Nie udało się zwolnić blokady"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr "Nie udało się zwolnić blokady, błąd 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start advertising"
|
||||
msgstr "Nie udało się rozpocząć rozgłaszania"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr "Nie udało się rozpocząć rozgłaszania, błąd 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start scanning"
|
||||
msgstr "Nie udało się rozpocząć skanowania"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr "Nie udało się rozpocząć skanowania, błąd 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr "Nie udało się zatrzymać rozgłaszania"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr "Nie udało się zatrzymać rozgłaszania, błąd 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -901,6 +873,10 @@ msgstr "Opóźnienie włączenia mikrofonu musi być w zakresie od 0.0 do 1.0"
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr "Brak DAC"
|
||||
@ -951,6 +927,7 @@ msgstr "Brak miejsca"
|
||||
msgid "No such file/directory"
|
||||
msgstr "Brak pliku/katalogu"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
msgid "Not connected"
|
||||
msgstr "Nie podłączono"
|
||||
@ -1216,8 +1193,8 @@ msgid "USB Error"
|
||||
msgstr "Błąd USB"
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgstr "Wartość UUID poza zakresem 0 do 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'"
|
||||
@ -1909,9 +1886,10 @@ msgstr "argument 2 do int() busi być pomiędzy 2 a 36"
|
||||
msgid "integer required"
|
||||
msgstr "wymagana liczba całkowita"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
msgstr "przedział poza zakresem 0.0020 do 10.24"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
msgid "invalid I2C peripheral"
|
||||
@ -2124,6 +2102,14 @@ msgstr "brak modułu o nazwie '%q'"
|
||||
msgid "no such attribute"
|
||||
msgstr "nie ma takiego atrybutu"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr "argument z wartością domyślną przed argumentem bez"
|
||||
@ -2334,10 +2320,6 @@ msgstr "stos planu pełen"
|
||||
msgid "script compilation not supported"
|
||||
msgstr "kompilowanie skryptów nieobsługiwane"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr "obiekt typu innego niż Service w services"
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr "znak jest niedopuszczalny w specyfikacji formatu łańcucha"
|
||||
@ -2604,6 +2586,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr "value_count musi być > 0"
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr "write_args musi być listą, krotką lub None"
|
||||
@ -2632,6 +2618,51 @@ msgstr "y poza zakresem"
|
||||
msgid "zero step"
|
||||
msgstr "zerowy krok"
|
||||
|
||||
#~ msgid "Address is not %d bytes long or is in wrong format"
|
||||
#~ msgstr "Adres nie ma długości %d bajtów lub zły format"
|
||||
|
||||
#~ msgid "Can't add services in Central mode"
|
||||
#~ msgstr "Nie można dodać serwisów w trybie Central"
|
||||
|
||||
#~ msgid "Can't advertise in Central mode"
|
||||
#~ msgstr "Nie można rozgłaszać w trybie Central"
|
||||
|
||||
#~ msgid "Can't change the name in Central mode"
|
||||
#~ msgstr "Nie można zmienić nazwy w trybie Central"
|
||||
|
||||
#~ msgid "Can't connect in Peripheral mode"
|
||||
#~ msgstr "Nie można się łączyć w trybie Peripheral"
|
||||
|
||||
#~ msgid "Data too large for the advertisement packet"
|
||||
#~ msgstr "Zbyt dużo danych pakietu rozgłoszeniowego"
|
||||
|
||||
#~ msgid "Failed to acquire mutex"
|
||||
#~ msgstr "Nie udało się uzyskać blokady"
|
||||
|
||||
#~ msgid "Failed to add service"
|
||||
#~ msgstr "Nie udało się dodać serwisu"
|
||||
|
||||
#~ msgid "Failed to connect:"
|
||||
#~ msgstr "Nie udało się połączenie:"
|
||||
|
||||
#~ msgid "Failed to continue scanning"
|
||||
#~ msgstr "Nie udała się kontynuacja skanowania"
|
||||
|
||||
#~ msgid "Failed to create mutex"
|
||||
#~ msgstr "Nie udało się stworzyć blokady"
|
||||
|
||||
#~ msgid "Failed to release mutex"
|
||||
#~ msgstr "Nie udało się zwolnić blokady"
|
||||
|
||||
#~ msgid "Failed to start advertising"
|
||||
#~ msgstr "Nie udało się rozpocząć rozgłaszania"
|
||||
|
||||
#~ msgid "Failed to start scanning"
|
||||
#~ msgstr "Nie udało się rozpocząć skanowania"
|
||||
|
||||
#~ msgid "Failed to stop advertising"
|
||||
#~ msgstr "Nie udało się zatrzymać rozgłaszania"
|
||||
|
||||
#~ msgid "Invalid bit clock pin"
|
||||
#~ msgstr "Zła nóżka zegara"
|
||||
|
||||
@ -2643,3 +2674,12 @@ msgstr "zerowy krok"
|
||||
|
||||
#~ msgid "Must be a Group subclass."
|
||||
#~ msgstr "Musi dziedziczyć z Group."
|
||||
|
||||
#~ msgid "UUID integer value not in range 0 to 0xffff"
|
||||
#~ msgstr "Wartość UUID poza zakresem 0 do 0xffff"
|
||||
|
||||
#~ msgid "interval not in range 0.0020 to 10.24"
|
||||
#~ msgstr "przedział poza zakresem 0.0020 do 10.24"
|
||||
|
||||
#~ msgid "services includes an object that is not a Service"
|
||||
#~ msgstr "obiekt typu innego niż Service w services"
|
||||
|
160
locale/pt_BR.po
160
locale/pt_BR.po
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
|
||||
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@ -219,16 +219,15 @@ msgstr ""
|
||||
msgid "A hardware interrupt channel is already in use"
|
||||
msgstr "Um canal de interrupção de hardware já está em uso"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr "buffers devem ser o mesmo tamanho"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
msgid "All I2C peripherals are in use"
|
||||
msgstr "Todos os periféricos I2C estão em uso"
|
||||
@ -353,20 +352,8 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
@ -498,17 +485,11 @@ msgstr ""
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr "Pedaço de dados deve seguir o pedaço de cortes"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr "Não é possível ajustar dados no pacote de anúncios."
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr "Não é possível ajustar dados no pacote de anúncios."
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr ""
|
||||
@ -548,6 +529,10 @@ msgstr "Não é possível adicionar Característica."
|
||||
msgid "Expected a UUID"
|
||||
msgstr "Esperado um"
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -557,12 +542,7 @@ msgstr ""
|
||||
msgid "Failed sending command."
|
||||
msgstr "Falha ao enviar comando."
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr "Falha ao alocar buffer RX"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr "Não é possível ler o valor do atributo. status: 0x%02x"
|
||||
@ -572,11 +552,6 @@ msgstr "Não é possível ler o valor do atributo. status: 0x%02x"
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr "Não pode parar propaganda. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to add service"
|
||||
msgstr "Não pode parar propaganda. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -597,12 +572,13 @@ msgstr "Falha ao alocar buffer RX de %d bytes"
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr "Não pode parar propaganda. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to connect:"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to continue scanning"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
@ -610,12 +586,7 @@ msgstr ""
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr "Não é possível iniciar o anúncio. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to create mutex"
|
||||
msgstr "Não é possível ler o valor do atributo. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, fuzzy
|
||||
msgid "Failed to discover services"
|
||||
msgstr "Não pode parar propaganda. status: 0x%02x"
|
||||
@ -654,48 +625,41 @@ msgstr "Não é possível gravar o valor do atributo. status: 0x%02x"
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr "Não é possível adicionar o UUID de 128 bits específico do fornecedor."
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to release mutex"
|
||||
msgstr "Não é possível ler o valor do atributo. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr "Não é possível ler o valor do atributo. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to start advertising"
|
||||
msgstr "Não é possível iniciar o anúncio. status: 0x%02x"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr "Não é possível iniciar o anúncio. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to start scanning"
|
||||
msgstr "Não é possível iniciar o anúncio. status: 0x%02x"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr "Não é possível iniciar o anúncio. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#, fuzzy
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr "Não pode parar propaganda. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr "Não pode parar propaganda. status: 0x%02x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, fuzzy, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -914,6 +878,10 @@ msgstr ""
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr "Nenhum DAC no chip"
|
||||
@ -964,6 +932,7 @@ msgstr ""
|
||||
msgid "No such file/directory"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
#, fuzzy
|
||||
msgid "Not connected"
|
||||
@ -1224,7 +1193,7 @@ msgid "USB Error"
|
||||
msgstr "Erro na USB"
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
@ -1917,8 +1886,9 @@ msgstr ""
|
||||
msgid "integer required"
|
||||
msgstr "inteiro requerido"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
@ -2133,6 +2103,14 @@ msgstr ""
|
||||
msgid "no such attribute"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr ""
|
||||
@ -2342,10 +2320,6 @@ msgstr ""
|
||||
msgid "script compilation not supported"
|
||||
msgstr "compilação de script não suportada"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr ""
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr ""
|
||||
@ -2614,6 +2588,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr ""
|
||||
@ -2657,6 +2635,10 @@ msgstr "passo zero"
|
||||
#~ msgid "Cannot update i/f status"
|
||||
#~ msgstr "Não é possível atualizar o status i/f"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Data too large for the advertisement packet"
|
||||
#~ msgstr "Não é possível ajustar dados no pacote de anúncios."
|
||||
|
||||
#~ msgid "Don't know how to pass object to native function"
|
||||
#~ msgstr "Não sabe como passar o objeto para a função nativa"
|
||||
|
||||
@ -2669,6 +2651,18 @@ msgstr "passo zero"
|
||||
#~ msgid "Error in ffi_prep_cif"
|
||||
#~ msgstr "Erro no ffi_prep_cif"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to acquire mutex"
|
||||
#~ msgstr "Falha ao alocar buffer RX"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to add service"
|
||||
#~ msgstr "Não pode parar propaganda. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to create mutex"
|
||||
#~ msgstr "Não é possível ler o valor do atributo. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
|
||||
#~ msgstr "Não é possível gravar o valor do atributo. status: 0x%02x"
|
||||
@ -2677,6 +2671,22 @@ msgstr "passo zero"
|
||||
#~ msgid "Failed to read attribute value, err %0x04x"
|
||||
#~ msgstr "Não é possível ler o valor do atributo. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to release mutex"
|
||||
#~ msgstr "Não é possível ler o valor do atributo. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start advertising"
|
||||
#~ msgstr "Não é possível iniciar o anúncio. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to start scanning"
|
||||
#~ msgstr "Não é possível iniciar o anúncio. status: 0x%02x"
|
||||
|
||||
#, fuzzy
|
||||
#~ msgid "Failed to stop advertising"
|
||||
#~ msgstr "Não pode parar propaganda. status: 0x%02x"
|
||||
|
||||
#~ msgid "GPIO16 does not support pull up."
|
||||
#~ msgstr "GPIO16 não suporta pull up."
|
||||
|
||||
|
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: circuitpython-cn\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-06-25 17:53-0700\n"
|
||||
"POT-Creation-Date: 2019-07-09 09:06-0400\n"
|
||||
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
|
||||
"Last-Translator: hexthat\n"
|
||||
"Language-Team: Chinese Hanyu Pinyin\n"
|
||||
@ -219,16 +219,15 @@ msgstr "bù zhīchí 3-arg pow ()"
|
||||
msgid "A hardware interrupt channel is already in use"
|
||||
msgstr "Yìngjiàn zhōngduàn tōngdào yǐ zài shǐyòng zhōng"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address is not %d bytes long or is in wrong format"
|
||||
msgstr "Dìzhǐ bùshì %d zì jié zhǎng, huòzhě géshì cuòwù"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
#, c-format
|
||||
msgid "Address must be %d bytes long"
|
||||
msgstr "Dìzhǐ bìxū shì %d zì jié zhǎng"
|
||||
|
||||
#: shared-bindings/bleio/Address.c
|
||||
msgid "Address type out of range"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/busio/I2C.c
|
||||
msgid "All I2C peripherals are in use"
|
||||
msgstr "Suǒyǒu I2C wàiwéi qì zhèngzài shǐyòng"
|
||||
@ -353,21 +352,9 @@ msgstr ""
|
||||
msgid "Can not use dotstar with %s"
|
||||
msgstr "Wúfǎ yǔ dotstar yīqǐ shǐyòng %s"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't add services in Central mode"
|
||||
msgstr "Wúfǎ zài zhōngyāng móshì xià tiānjiā fúwù"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't advertise in Central mode"
|
||||
msgstr "Wúfǎ zài zhōngyāng móshì zhōng guǎnggào"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't change the name in Central mode"
|
||||
msgstr "Wúfǎ gēnggǎi zhōngyāng móshì de míngchēng"
|
||||
|
||||
#: shared-bindings/bleio/Device.c
|
||||
msgid "Can't connect in Peripheral mode"
|
||||
msgstr "Wúfǎ zài biānyuán móshì zhōng liánjiē"
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "Can't set CCCD for local Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/displayio/Bitmap.c shared-bindings/pulseio/PulseIn.c
|
||||
msgid "Cannot delete values"
|
||||
@ -496,15 +483,10 @@ msgstr "Shùjù 0 de yǐn jiǎo bìxū shì zì jié duìqí"
|
||||
msgid "Data chunk must follow fmt chunk"
|
||||
msgstr "Shùjù kuài bìxū zūnxún fmt qū kuài"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
msgid "Data too large for advertisement packet"
|
||||
msgstr "Guǎnggào bāo de shùjù tài dà"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Data too large for the advertisement packet"
|
||||
msgstr "Guǎnggào bāo de shùjù tài dà"
|
||||
|
||||
#: shared-bindings/audiobusio/PDMIn.c
|
||||
msgid "Destination capacity is smaller than destination_length."
|
||||
msgstr "Mùbiāo róngliàng xiǎoyú mùdì de_chángdù."
|
||||
@ -542,6 +524,10 @@ msgstr "Yùqí de tèdiǎn"
|
||||
msgid "Expected a UUID"
|
||||
msgstr "Yùqí UUID"
|
||||
|
||||
#: shared-bindings/bleio/Central.c
|
||||
msgid "Expected an Address"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
msgid "Expected tuple of length %d, got %d"
|
||||
@ -551,11 +537,7 @@ msgstr "Qīwàng de chángdù wèi %d de yuán zǔ, dédào %d"
|
||||
msgid "Failed sending command."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to acquire mutex"
|
||||
msgstr "Wúfǎ huòdé mutex"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr "Wúfǎ huòdé mutex, err 0x%04x"
|
||||
@ -565,10 +547,6 @@ msgstr "Wúfǎ huòdé mutex, err 0x%04x"
|
||||
msgid "Failed to add characteristic, err 0x%04x"
|
||||
msgstr "Tiānjiā tèxìng shībài, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to add service"
|
||||
msgstr "Tiānjiā fúwù shībài"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to add service, err 0x%04x"
|
||||
@ -588,24 +566,21 @@ msgstr "Fēnpèi RX huǎnchōng qū%d zì jié shībài"
|
||||
msgid "Failed to change softdevice state"
|
||||
msgstr "Gēnggǎi ruǎn shèbèi zhuàngtài shībài"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to connect:"
|
||||
msgstr "Liánjiē shībài:"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to configure advertising, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to continue scanning"
|
||||
msgstr "Jìxù sǎomiáo shībài"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to connect: timeout"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "Failed to continue scanning, err 0x%04x"
|
||||
msgstr "Jìxù sǎomiáo shībài, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to create mutex"
|
||||
msgstr "Wúfǎ chuàngjiàn hù chì suǒ"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "Failed to discover services"
|
||||
msgstr "Fāxiàn fúwù shībài"
|
||||
|
||||
@ -642,44 +617,41 @@ msgstr "Wúfǎ dòu qǔ gatts zhí, err 0x%04x"
|
||||
msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
|
||||
msgstr "Wúfǎ zhùcè màizhǔ tèdìng de UUID, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to release mutex"
|
||||
msgstr "Wúfǎ shìfàng mutex"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c ports/nrf/sd_mutex.c
|
||||
#: ports/nrf/sd_mutex.c
|
||||
#, c-format
|
||||
msgid "Failed to release mutex, err 0x%04x"
|
||||
msgstr "Wúfǎ shìfàng mutex, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start advertising"
|
||||
msgstr "Qǐdòng guǎnggào shībài"
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to set device name, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to start advertising, err 0x%04x"
|
||||
msgstr "Qǐdòng guǎnggào shībài, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to start scanning"
|
||||
msgstr "Qǐdòng sǎomiáo shībài"
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
#, c-format
|
||||
msgid "Failed to start connecting, error 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "Failed to start scanning, err 0x%04x"
|
||||
msgstr "Qǐdòng sǎomiáo shībài, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Device.c
|
||||
msgid "Failed to stop advertising"
|
||||
msgstr "Wúfǎ tíngzhǐ guǎnggào"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
#: ports/nrf/common-hal/bleio/Peripheral.c
|
||||
#, c-format
|
||||
msgid "Failed to stop advertising, err 0x%04x"
|
||||
msgstr "Wúfǎ tíngzhǐ guǎnggào, err 0x%04x"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write CCCD, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#, c-format
|
||||
msgid "Failed to write attribute value, err 0x%04x"
|
||||
@ -901,6 +873,10 @@ msgstr "Màikèfēng qǐdòng yánchí bìxū zài 0.0 Dào 1.0 De fànwéi nèi
|
||||
msgid "Must be a %q subclass."
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/analogio/AnalogOut.c
|
||||
msgid "No DAC on chip"
|
||||
msgstr "Méiyǒu DAC zài xīnpiàn shàng de"
|
||||
@ -951,6 +927,7 @@ msgstr "Shèbèi shàng méiyǒu kònggé"
|
||||
msgid "No such file/directory"
|
||||
msgstr "Méiyǒu cǐ lèi wénjiàn/mùlù"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Characteristic.c
|
||||
#: shared-bindings/bleio/CharacteristicBuffer.c
|
||||
msgid "Not connected"
|
||||
msgstr "Wèi liánjiē"
|
||||
@ -1221,8 +1198,8 @@ msgid "USB Error"
|
||||
msgstr "USB Cuòwù"
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID integer value not in range 0 to 0xffff"
|
||||
msgstr "UUID zhěngshù zhí bùzài fànwéi 0 zhì 0xffff"
|
||||
msgid "UUID integer value must be 0-0xffff"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/bleio/UUID.c
|
||||
msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'"
|
||||
@ -1919,9 +1896,10 @@ msgstr "zhěngshù() cānshù 2 bìxū > = 2 qiě <= 36"
|
||||
msgid "integer required"
|
||||
msgstr "xūyào zhěngshù"
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Broadcaster.c
|
||||
msgid "interval not in range 0.0020 to 10.24"
|
||||
msgstr "jùlí 0.0020 Zhì 10.24 Zhī jiān de jiàngé shíjiān"
|
||||
#: shared-bindings/bleio/Peripheral.c shared-bindings/bleio/Scanner.c
|
||||
#, c-format
|
||||
msgid "interval must be in range %s-%s"
|
||||
msgstr ""
|
||||
|
||||
#: extmod/machine_i2c.c
|
||||
msgid "invalid I2C peripheral"
|
||||
@ -2136,6 +2114,14 @@ msgstr "méiyǒu mókuài '%q'"
|
||||
msgid "no such attribute"
|
||||
msgstr "méiyǒu cǐ shǔxìng"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "non-Service found in services"
|
||||
msgstr ""
|
||||
|
||||
#: ports/nrf/common-hal/bleio/Central.c
|
||||
msgid "non-UUID found in service_uuids"
|
||||
msgstr ""
|
||||
|
||||
#: py/compile.c
|
||||
msgid "non-default argument follows default argument"
|
||||
msgstr "bùshì mòrèn cānshù zūnxún mòrèn cānshù"
|
||||
@ -2346,10 +2332,6 @@ msgstr "jìhuà duīzhàn yǐ mǎn"
|
||||
msgid "script compilation not supported"
|
||||
msgstr "bù zhīchí jiǎoběn biānyì"
|
||||
|
||||
#: shared-bindings/bleio/Peripheral.c
|
||||
msgid "services includes an object that is not a Service"
|
||||
msgstr "fúwù bāokuò yīgè bùshì fúwù de wùjiàn"
|
||||
|
||||
#: py/objstr.c
|
||||
msgid "sign not allowed in string format specifier"
|
||||
msgstr "zìfú chuàn géshì shuōmíng fú zhōng bù yǔnxǔ shǐyòng fúhào"
|
||||
@ -2616,6 +2598,10 @@ msgstr ""
|
||||
msgid "value_count must be > 0"
|
||||
msgstr "zhí jìshù bìxū wèi > 0"
|
||||
|
||||
#: shared-bindings/bleio/Scanner.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_pixelbuf/PixelBuf.c
|
||||
msgid "write_args must be a list, tuple, or None"
|
||||
msgstr "xiě cānshù bìxū shì yuán zǔ, lièbiǎo huò None"
|
||||
@ -2644,6 +2630,51 @@ msgstr "y zhí chāochū biānjiè"
|
||||
msgid "zero step"
|
||||
msgstr "líng bù"
|
||||
|
||||
#~ msgid "Address is not %d bytes long or is in wrong format"
|
||||
#~ msgstr "Dìzhǐ bùshì %d zì jié zhǎng, huòzhě géshì cuòwù"
|
||||
|
||||
#~ msgid "Can't add services in Central mode"
|
||||
#~ msgstr "Wúfǎ zài zhōngyāng móshì xià tiānjiā fúwù"
|
||||
|
||||
#~ msgid "Can't advertise in Central mode"
|
||||
#~ msgstr "Wúfǎ zài zhōngyāng móshì zhōng guǎnggào"
|
||||
|
||||
#~ msgid "Can't change the name in Central mode"
|
||||
#~ msgstr "Wúfǎ gēnggǎi zhōngyāng móshì de míngchēng"
|
||||
|
||||
#~ msgid "Can't connect in Peripheral mode"
|
||||
#~ msgstr "Wúfǎ zài biānyuán móshì zhōng liánjiē"
|
||||
|
||||
#~ msgid "Data too large for the advertisement packet"
|
||||
#~ msgstr "Guǎnggào bāo de shùjù tài dà"
|
||||
|
||||
#~ msgid "Failed to acquire mutex"
|
||||
#~ msgstr "Wúfǎ huòdé mutex"
|
||||
|
||||
#~ msgid "Failed to add service"
|
||||
#~ msgstr "Tiānjiā fúwù shībài"
|
||||
|
||||
#~ msgid "Failed to connect:"
|
||||
#~ msgstr "Liánjiē shībài:"
|
||||
|
||||
#~ msgid "Failed to continue scanning"
|
||||
#~ msgstr "Jìxù sǎomiáo shībài"
|
||||
|
||||
#~ msgid "Failed to create mutex"
|
||||
#~ msgstr "Wúfǎ chuàngjiàn hù chì suǒ"
|
||||
|
||||
#~ msgid "Failed to release mutex"
|
||||
#~ msgstr "Wúfǎ shìfàng mutex"
|
||||
|
||||
#~ msgid "Failed to start advertising"
|
||||
#~ msgstr "Qǐdòng guǎnggào shībài"
|
||||
|
||||
#~ msgid "Failed to start scanning"
|
||||
#~ msgstr "Qǐdòng sǎomiáo shībài"
|
||||
|
||||
#~ msgid "Failed to stop advertising"
|
||||
#~ msgstr "Wúfǎ tíngzhǐ guǎnggào"
|
||||
|
||||
#~ msgid "Invalid bit clock pin"
|
||||
#~ msgstr "Wúxiào de wèi shízhōng yǐn jiǎo"
|
||||
|
||||
@ -2668,12 +2699,21 @@ msgstr "líng bù"
|
||||
#~ msgid "Only bit maps of 8 bit color or less are supported"
|
||||
#~ msgstr "Jǐn zhīchí 8 wèi yánsè huò xiǎoyú"
|
||||
|
||||
#~ msgid "UUID integer value not in range 0 to 0xffff"
|
||||
#~ msgstr "UUID zhěngshù zhí bùzài fànwéi 0 zhì 0xffff"
|
||||
|
||||
#~ msgid "expected a DigitalInOut"
|
||||
#~ msgstr "qídài de DigitalInOut"
|
||||
|
||||
#~ msgid "interval not in range 0.0020 to 10.24"
|
||||
#~ msgstr "jùlí 0.0020 Zhì 10.24 Zhī jiān de jiàngé shíjiān"
|
||||
|
||||
#~ msgid "row must be packed and word aligned"
|
||||
#~ msgstr "xíng bìxū dǎbāo bìngqiě zì duìqí"
|
||||
|
||||
#~ msgid "services includes an object that is not a Service"
|
||||
#~ msgstr "fúwù bāokuò yīgè bùshì fúwù de wùjiàn"
|
||||
|
||||
#~ msgid "too many arguments"
|
||||
#~ msgstr "tài duō cānshù"
|
||||
|
||||
|
@ -159,7 +159,6 @@ SRC_C += \
|
||||
boards/$(BOARD)/pins.c \
|
||||
device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \
|
||||
bluetooth/ble_drv.c \
|
||||
bluetooth/ble_uart.c \
|
||||
lib/libc/string0.c \
|
||||
lib/mp-readline/readline.c \
|
||||
lib/oofatfs/ff.c \
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -30,10 +31,6 @@
|
||||
|
||||
#include "ble.h"
|
||||
|
||||
#if (BLUETOOTH_SD == 132) && (BLE_API_VERSION == 2)
|
||||
#define NRF52
|
||||
#endif
|
||||
|
||||
#define MAX_TX_IN_PROGRESS 10
|
||||
|
||||
#ifndef BLE_GATT_ATT_MTU_DEFAULT
|
||||
@ -43,9 +40,12 @@
|
||||
#define BLE_CONN_CFG_TAG_CUSTOM 1
|
||||
|
||||
#define MSEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000) / (RESOLUTION))
|
||||
#define SEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000000) / (RESOLUTION))
|
||||
// 0.625 msecs (625 usecs)
|
||||
#define ADV_INTERVAL_UNIT_FLOAT_SECS (0.000625)
|
||||
// Microseconds is the base unit. The macros above know that.
|
||||
#define UNIT_0_625_MS (625)
|
||||
#define UNIT_1_25_MS (1250)
|
||||
#define UNIT_10_MS (10000)
|
||||
|
||||
typedef void (*ble_drv_evt_handler_t)(ble_evt_t*, void*);
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -3,8 +3,8 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
@ -136,17 +137,15 @@ void common_hal_bleio_adapter_get_address(bleio_address_obj_t *address) {
|
||||
uint32_t err_code;
|
||||
|
||||
common_hal_bleio_adapter_set_enabled(true);
|
||||
|
||||
#if (BLE_API_VERSION == 2)
|
||||
err_code = sd_ble_gap_address_get(&local_address);
|
||||
#else
|
||||
err_code = sd_ble_gap_addr_get(&local_address);
|
||||
#endif
|
||||
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to get local address"));
|
||||
}
|
||||
|
||||
address->type = local_address.addr_type;
|
||||
memcpy(address->value, local_address.addr, BLEIO_ADDRESS_BYTES);
|
||||
|
||||
mp_buffer_info_t buf_info;
|
||||
mp_get_buffer_raise(address, &buf_info, MP_BUFFER_READ);
|
||||
memcpy(address->bytes, buf_info.buf, NUM_BLEIO_ADDRESS_BYTES);
|
||||
}
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "ble.h"
|
||||
#include "ble_drv.h"
|
||||
#include "ble_hci.h"
|
||||
#include "nrf_soc.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "common-hal/bleio/Broadcaster.h"
|
||||
#include "shared-bindings/bleio/Adapter.h"
|
||||
#include "shared-bindings/bleio/Broadcaster.h"
|
||||
|
||||
static uint8_t m_adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;
|
||||
|
||||
void common_hal_bleio_broadcaster_construct(bleio_broadcaster_obj_t *self, mp_float_t interval) {
|
||||
common_hal_bleio_adapter_set_enabled(true); // TODO -- Do this somewhere else maybe bleio __init__
|
||||
const mp_float_t min = BLE_GAP_ADV_INTERVAL_MIN * ADV_INTERVAL_UNIT_FLOAT_SECS;
|
||||
const mp_float_t max = BLE_GAP_ADV_INTERVAL_MAX * ADV_INTERVAL_UNIT_FLOAT_SECS;
|
||||
|
||||
if (interval < min || interval > max) {
|
||||
// Would like to print range using the constants above, but vargs would convert to double.
|
||||
mp_raise_ValueError(translate("interval not in range 0.0020 to 10.24"));
|
||||
}
|
||||
self->interval = interval;
|
||||
}
|
||||
|
||||
|
||||
void common_hal_bleio_broadcaster_start_advertising(bleio_broadcaster_obj_t *self, mp_buffer_info_t *data) {
|
||||
uint32_t err_code;
|
||||
|
||||
if (data->len >= BLE_GAP_ADV_SET_DATA_SIZE_MAX) {
|
||||
mp_raise_ValueError(translate("Data too large for advertisement packet"));
|
||||
}
|
||||
memcpy(self->adv_data, data->buf, data->len);
|
||||
|
||||
ble_gap_adv_params_t m_adv_params = {
|
||||
.interval = (uint32_t) (self->interval / ADV_INTERVAL_UNIT_FLOAT_SECS),
|
||||
.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_SCANNABLE_UNDIRECTED,
|
||||
.duration = BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED,
|
||||
.filter_policy = BLE_GAP_ADV_FP_ANY,
|
||||
.primary_phy = BLE_GAP_PHY_1MBPS,
|
||||
};
|
||||
|
||||
common_hal_bleio_broadcaster_stop_advertising(self);
|
||||
|
||||
const ble_gap_adv_data_t ble_gap_adv_data = {
|
||||
.adv_data.p_data = self->adv_data,
|
||||
.adv_data.len = data->len,
|
||||
};
|
||||
|
||||
err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &ble_gap_adv_data, &m_adv_params);
|
||||
if (err_code == NRF_SUCCESS) {
|
||||
err_code = sd_ble_gap_adv_start(m_adv_handle, BLE_CONN_CFG_TAG_CUSTOM);
|
||||
}
|
||||
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to start advertising, err 0x%04x"), err_code);
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_bleio_broadcaster_stop_advertising(bleio_broadcaster_obj_t *self) {
|
||||
|
||||
if (m_adv_handle == BLE_GAP_ADV_SET_HANDLE_NOT_SET) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t err_code = sd_ble_gap_adv_stop(m_adv_handle);
|
||||
|
||||
if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_INVALID_STATE)) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to stop advertising, err 0x%04x"), err_code);
|
||||
}
|
||||
}
|
463
ports/nrf/common-hal/bleio/Central.c
Normal file
463
ports/nrf/common-hal/bleio/Central.c
Normal file
@ -0,0 +1,463 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ble.h"
|
||||
#include "ble_drv.h"
|
||||
#include "ble_hci.h"
|
||||
#include "nrf_soc.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/bleio/Adapter.h"
|
||||
#include "shared-bindings/bleio/Characteristic.h"
|
||||
#include "shared-bindings/bleio/Central.h"
|
||||
#include "shared-bindings/bleio/Descriptor.h"
|
||||
#include "shared-bindings/bleio/Service.h"
|
||||
#include "shared-bindings/bleio/UUID.h"
|
||||
|
||||
static bleio_service_obj_t *m_char_discovery_service;
|
||||
static bleio_characteristic_obj_t *m_desc_discovery_characteristic;
|
||||
|
||||
static volatile bool m_discovery_in_process;
|
||||
static volatile bool m_discovery_successful;
|
||||
|
||||
// service_uuid may be NULL, to discover all services.
|
||||
STATIC bool discover_next_services(bleio_central_obj_t *self, uint16_t start_handle, ble_uuid_t *service_uuid) {
|
||||
m_discovery_successful = false;
|
||||
m_discovery_in_process = true;
|
||||
|
||||
uint32_t err_code = sd_ble_gattc_primary_services_discover(self->conn_handle, start_handle, service_uuid);
|
||||
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to discover services"));
|
||||
}
|
||||
|
||||
// Wait for a discovery event.
|
||||
while (m_discovery_in_process) {
|
||||
MICROPY_VM_HOOK_LOOP;
|
||||
}
|
||||
return m_discovery_successful;
|
||||
}
|
||||
|
||||
STATIC bool discover_next_characteristics(bleio_central_obj_t *self, bleio_service_obj_t *service, uint16_t start_handle) {
|
||||
m_char_discovery_service = service;
|
||||
|
||||
ble_gattc_handle_range_t handle_range;
|
||||
handle_range.start_handle = start_handle;
|
||||
handle_range.end_handle = service->end_handle;
|
||||
|
||||
m_discovery_successful = false;
|
||||
m_discovery_in_process = true;
|
||||
|
||||
uint32_t err_code = sd_ble_gattc_characteristics_discover(self->conn_handle, &handle_range);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Wait for a discovery event.
|
||||
while (m_discovery_in_process) {
|
||||
MICROPY_VM_HOOK_LOOP;
|
||||
}
|
||||
return m_discovery_successful;
|
||||
}
|
||||
|
||||
STATIC bool discover_next_descriptors(bleio_central_obj_t *self, bleio_characteristic_obj_t *characteristic, uint16_t start_handle, uint16_t end_handle) {
|
||||
m_desc_discovery_characteristic = characteristic;
|
||||
|
||||
ble_gattc_handle_range_t handle_range;
|
||||
handle_range.start_handle = start_handle;
|
||||
handle_range.end_handle = end_handle;
|
||||
|
||||
m_discovery_successful = false;
|
||||
m_discovery_in_process = true;
|
||||
|
||||
uint32_t err_code = sd_ble_gattc_descriptors_discover(self->conn_handle, &handle_range);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Wait for a discovery event.
|
||||
while (m_discovery_in_process) {
|
||||
MICROPY_VM_HOOK_LOOP;
|
||||
}
|
||||
return m_discovery_successful;
|
||||
}
|
||||
|
||||
STATIC void on_primary_srv_discovery_rsp(ble_gattc_evt_prim_srvc_disc_rsp_t *response, bleio_central_obj_t *central) {
|
||||
for (size_t i = 0; i < response->count; ++i) {
|
||||
ble_gattc_service_t *gattc_service = &response->services[i];
|
||||
|
||||
bleio_service_obj_t *service = m_new_obj(bleio_service_obj_t);
|
||||
service->base.type = &bleio_service_type;
|
||||
|
||||
// Initialize several fields at once.
|
||||
common_hal_bleio_service_construct(service, NULL, mp_obj_new_list(0, NULL), false);
|
||||
|
||||
service->device = MP_OBJ_FROM_PTR(central);
|
||||
service->start_handle = gattc_service->handle_range.start_handle;
|
||||
service->end_handle = gattc_service->handle_range.end_handle;
|
||||
service->handle = gattc_service->handle_range.start_handle;
|
||||
|
||||
if (gattc_service->uuid.type != BLE_UUID_TYPE_UNKNOWN) {
|
||||
// Known service UUID.
|
||||
bleio_uuid_obj_t *uuid = m_new_obj(bleio_uuid_obj_t);
|
||||
uuid->base.type = &bleio_uuid_type;
|
||||
bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_service->uuid);
|
||||
service->uuid = uuid;
|
||||
service->device = MP_OBJ_FROM_PTR(central);
|
||||
} else {
|
||||
// The discovery response contained a 128-bit UUID that has not yet been registered with the
|
||||
// softdevice via sd_ble_uuid_vs_add(). We need to fetch the 128-bit value and register it.
|
||||
// For now, just set the UUID to NULL.
|
||||
service->uuid = NULL;
|
||||
}
|
||||
|
||||
mp_obj_list_append(central->service_list, service);
|
||||
}
|
||||
|
||||
if (response->count > 0) {
|
||||
m_discovery_successful = true;
|
||||
}
|
||||
m_discovery_in_process = false;
|
||||
}
|
||||
|
||||
STATIC void on_char_discovery_rsp(ble_gattc_evt_char_disc_rsp_t *response, bleio_central_obj_t *central) {
|
||||
for (size_t i = 0; i < response->count; ++i) {
|
||||
ble_gattc_char_t *gattc_char = &response->chars[i];
|
||||
|
||||
bleio_characteristic_obj_t *characteristic = m_new_obj(bleio_characteristic_obj_t);
|
||||
characteristic->base.type = &bleio_characteristic_type;
|
||||
|
||||
characteristic->descriptor_list = mp_obj_new_list(0, NULL);
|
||||
|
||||
bleio_uuid_obj_t *uuid = NULL;
|
||||
|
||||
if (gattc_char->uuid.type != BLE_UUID_TYPE_UNKNOWN) {
|
||||
// Known characteristic UUID.
|
||||
uuid = m_new_obj(bleio_uuid_obj_t);
|
||||
uuid->base.type = &bleio_uuid_type;
|
||||
bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_char->uuid);
|
||||
} else {
|
||||
// The discovery response contained a 128-bit UUID that has not yet been registered with the
|
||||
// softdevice via sd_ble_uuid_vs_add(). We need to fetch the 128-bit value and register it.
|
||||
// For now, just leave the UUID as NULL.
|
||||
}
|
||||
|
||||
bleio_characteristic_properties_t props;
|
||||
|
||||
props.broadcast = gattc_char->char_props.broadcast;
|
||||
props.indicate = gattc_char->char_props.indicate;
|
||||
props.notify = gattc_char->char_props.notify;
|
||||
props.read = gattc_char->char_props.read;
|
||||
props.write = gattc_char->char_props.write;
|
||||
props.write_no_response = gattc_char->char_props.write_wo_resp;
|
||||
|
||||
// Call common_hal_bleio_characteristic_construct() to initalize some fields and set up evt handler.
|
||||
common_hal_bleio_characteristic_construct(characteristic, uuid, props, mp_obj_new_list(0, NULL));
|
||||
characteristic->handle = gattc_char->handle_value;
|
||||
characteristic->service = m_char_discovery_service;
|
||||
|
||||
mp_obj_list_append(m_char_discovery_service->characteristic_list, MP_OBJ_FROM_PTR(characteristic));
|
||||
}
|
||||
|
||||
if (response->count > 0) {
|
||||
m_discovery_successful = true;
|
||||
}
|
||||
m_discovery_in_process = false;
|
||||
}
|
||||
|
||||
STATIC void on_desc_discovery_rsp(ble_gattc_evt_desc_disc_rsp_t *response, bleio_central_obj_t *central) {
|
||||
for (size_t i = 0; i < response->count; ++i) {
|
||||
ble_gattc_desc_t *gattc_desc = &response->descs[i];
|
||||
|
||||
// Remember handles for certain well-known descriptors.
|
||||
switch (gattc_desc->uuid.uuid) {
|
||||
case DESCRIPTOR_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION:
|
||||
m_desc_discovery_characteristic->cccd_handle = gattc_desc->handle;
|
||||
break;
|
||||
|
||||
case DESCRIPTOR_UUID_SERVER_CHARACTERISTIC_CONFIGURATION:
|
||||
m_desc_discovery_characteristic->sccd_handle = gattc_desc->handle;
|
||||
break;
|
||||
|
||||
case DESCRIPTOR_UUID_CHARACTERISTIC_USER_DESCRIPTION:
|
||||
m_desc_discovery_characteristic->user_desc_handle = gattc_desc->handle;
|
||||
break;
|
||||
|
||||
default:
|
||||
// TODO: sd_ble_gattc_descriptors_discover() can return things that are not descriptors,
|
||||
// so ignore those.
|
||||
// https://devzone.nordicsemi.com/f/nordic-q-a/49500/sd_ble_gattc_descriptors_discover-is-returning-attributes-that-are-not-descriptors
|
||||
break;
|
||||
}
|
||||
|
||||
bleio_descriptor_obj_t *descriptor = m_new_obj(bleio_descriptor_obj_t);
|
||||
descriptor->base.type = &bleio_descriptor_type;
|
||||
|
||||
bleio_uuid_obj_t *uuid = NULL;
|
||||
|
||||
if (gattc_desc->uuid.type != BLE_UUID_TYPE_UNKNOWN) {
|
||||
// Known descriptor UUID.
|
||||
uuid = m_new_obj(bleio_uuid_obj_t);
|
||||
uuid->base.type = &bleio_uuid_type;
|
||||
bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_desc->uuid);
|
||||
} else {
|
||||
// The discovery response contained a 128-bit UUID that has not yet been registered with the
|
||||
// softdevice via sd_ble_uuid_vs_add(). We need to fetch the 128-bit value and register it.
|
||||
// For now, just leave the UUID as NULL.
|
||||
}
|
||||
|
||||
common_hal_bleio_descriptor_construct(descriptor, uuid);
|
||||
descriptor->handle = gattc_desc->handle;
|
||||
descriptor->characteristic = m_desc_discovery_characteristic;
|
||||
|
||||
mp_obj_list_append(m_desc_discovery_characteristic->descriptor_list, MP_OBJ_FROM_PTR(descriptor));
|
||||
}
|
||||
|
||||
if (response->count > 0) {
|
||||
m_discovery_successful = true;
|
||||
}
|
||||
m_discovery_in_process = false;
|
||||
}
|
||||
|
||||
STATIC void central_on_ble_evt(ble_evt_t *ble_evt, void *central_in) {
|
||||
bleio_central_obj_t *central = (bleio_central_obj_t*)central_in;
|
||||
|
||||
switch (ble_evt->header.evt_id) {
|
||||
case BLE_GAP_EVT_CONNECTED:
|
||||
central->conn_handle = ble_evt->evt.gap_evt.conn_handle;
|
||||
central->waiting_to_connect = false;
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_TIMEOUT:
|
||||
// Handle will be invalid.
|
||||
central->waiting_to_connect = false;
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_DISCONNECTED:
|
||||
central->conn_handle = BLE_CONN_HANDLE_INVALID;
|
||||
m_discovery_successful = false;
|
||||
m_discovery_in_process = false;
|
||||
break;
|
||||
|
||||
case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP:
|
||||
on_primary_srv_discovery_rsp(&ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp, central);
|
||||
break;
|
||||
|
||||
case BLE_GATTC_EVT_CHAR_DISC_RSP:
|
||||
on_char_discovery_rsp(&ble_evt->evt.gattc_evt.params.char_disc_rsp, central);
|
||||
break;
|
||||
|
||||
case BLE_GATTC_EVT_DESC_DISC_RSP:
|
||||
on_desc_discovery_rsp(&ble_evt->evt.gattc_evt.params.desc_disc_rsp, central);
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
|
||||
sd_ble_gap_sec_params_reply(central->conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: {
|
||||
ble_gap_evt_conn_param_update_request_t *request =
|
||||
&ble_evt->evt.gap_evt.params.conn_param_update_request;
|
||||
sd_ble_gap_conn_param_update(central->conn_handle, &request->conn_params);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
// For debugging.
|
||||
// mp_printf(&mp_plat_print, "Unhandled central event: 0x%04x\n", ble_evt->header.evt_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_bleio_central_construct(bleio_central_obj_t *self) {
|
||||
common_hal_bleio_adapter_set_enabled(true);
|
||||
|
||||
self->service_list = mp_obj_new_list(0, NULL);
|
||||
self->gatt_role = GATT_ROLE_CLIENT;
|
||||
self->conn_handle = BLE_CONN_HANDLE_INVALID;
|
||||
}
|
||||
|
||||
void common_hal_bleio_central_connect(bleio_central_obj_t *self, bleio_address_obj_t *address, mp_float_t timeout, mp_obj_t service_uuids) {
|
||||
common_hal_bleio_adapter_set_enabled(true);
|
||||
ble_drv_add_event_handler(central_on_ble_evt, self);
|
||||
|
||||
ble_gap_addr_t addr;
|
||||
|
||||
addr.addr_type = address->type;
|
||||
mp_buffer_info_t address_buf_info;
|
||||
mp_get_buffer_raise(address->bytes, &address_buf_info, MP_BUFFER_READ);
|
||||
memcpy(addr.addr, (uint8_t *) address_buf_info.buf, NUM_BLEIO_ADDRESS_BYTES);
|
||||
|
||||
ble_gap_scan_params_t scan_params = {
|
||||
.interval = MSEC_TO_UNITS(100, UNIT_0_625_MS),
|
||||
.window = MSEC_TO_UNITS(100, UNIT_0_625_MS),
|
||||
.scan_phys = BLE_GAP_PHY_1MBPS,
|
||||
// timeout of 0 means no timeout
|
||||
.timeout = SEC_TO_UNITS(timeout, UNIT_10_MS),
|
||||
};
|
||||
|
||||
ble_gap_conn_params_t conn_params = {
|
||||
.conn_sup_timeout = MSEC_TO_UNITS(4000, UNIT_10_MS),
|
||||
.min_conn_interval = MSEC_TO_UNITS(15, UNIT_1_25_MS),
|
||||
.max_conn_interval = MSEC_TO_UNITS(300, UNIT_1_25_MS),
|
||||
.slave_latency = 0, // number of conn events
|
||||
};
|
||||
|
||||
self->waiting_to_connect = true;
|
||||
|
||||
uint32_t err_code = sd_ble_gap_connect(&addr, &scan_params, &conn_params, BLE_CONN_CFG_TAG_CUSTOM);
|
||||
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to start connecting, error 0x%04x"), err_code);
|
||||
}
|
||||
|
||||
while (self->waiting_to_connect) {
|
||||
MICROPY_VM_HOOK_LOOP;
|
||||
}
|
||||
|
||||
if (self->conn_handle == BLE_CONN_HANDLE_INVALID) {
|
||||
mp_raise_OSError_msg(translate("Failed to connect: timeout"));
|
||||
}
|
||||
|
||||
// Connection successful.
|
||||
// Now discover services on the remote peripheral.
|
||||
|
||||
if (service_uuids == mp_const_none) {
|
||||
|
||||
// List of service UUID's not given, so discover all available services.
|
||||
|
||||
uint16_t next_service_start_handle = BLE_GATT_HANDLE_START;
|
||||
|
||||
while (discover_next_services(self, next_service_start_handle, MP_OBJ_NULL)) {
|
||||
// discover_next_services() appends to service_list.
|
||||
|
||||
// Get the most recently discovered service, and then ask for services
|
||||
// whose handles start after the last attribute handle inside that service.
|
||||
const bleio_service_obj_t *service =
|
||||
MP_OBJ_TO_PTR(self->service_list->items[self->service_list->len - 1]);
|
||||
next_service_start_handle = service->end_handle + 1;
|
||||
}
|
||||
} else {
|
||||
mp_obj_iter_buf_t iter_buf;
|
||||
mp_obj_t iterable = mp_getiter(service_uuids, &iter_buf);
|
||||
mp_obj_t uuid_obj;
|
||||
while ((uuid_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
|
||||
if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) {
|
||||
mp_raise_ValueError(translate("non-UUID found in service_uuids"));
|
||||
}
|
||||
bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj);
|
||||
|
||||
ble_uuid_t nrf_uuid;
|
||||
bleio_uuid_convert_to_nrf_ble_uuid(uuid, &nrf_uuid);
|
||||
|
||||
// Service might or might not be discovered; that's ok. Caller has to check
|
||||
// Central.remote_services to find out.
|
||||
// We only need to call this once for each service to discover.
|
||||
discover_next_services(self, BLE_GATT_HANDLE_START, &nrf_uuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (size_t service_idx = 0; service_idx < self->service_list->len; ++service_idx) {
|
||||
bleio_service_obj_t *service = MP_OBJ_TO_PTR(self->service_list->items[service_idx]);
|
||||
|
||||
// Skip the service if it had an unknown (unregistered) UUID.
|
||||
if (service->uuid == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint16_t next_char_start_handle = service->start_handle;
|
||||
|
||||
// Stop when we go past the end of the range of handles for this service or
|
||||
// discovery call returns nothing.
|
||||
// discover_next_characteristics() appends to the characteristic_list.
|
||||
while (next_char_start_handle <= service->end_handle &&
|
||||
discover_next_characteristics(self, service, next_char_start_handle)) {
|
||||
|
||||
|
||||
// Get the most recently discovered characteristic, and then ask for characteristics
|
||||
// whose handles start after the last attribute handle inside that characteristic.
|
||||
const bleio_characteristic_obj_t *characteristic =
|
||||
MP_OBJ_TO_PTR(service->characteristic_list->items[service->characteristic_list->len - 1]);
|
||||
next_char_start_handle = characteristic->handle + 1;
|
||||
}
|
||||
|
||||
// Got characteristics for this service. Now discover descriptors for each characteristic.
|
||||
size_t char_list_len = service->characteristic_list->len;
|
||||
for (size_t char_idx = 0; char_idx < char_list_len; ++char_idx) {
|
||||
bleio_characteristic_obj_t *characteristic =
|
||||
MP_OBJ_TO_PTR(service->characteristic_list->items[char_idx]);
|
||||
const bool last_characteristic = char_idx == char_list_len - 1;
|
||||
bleio_characteristic_obj_t *next_characteristic = last_characteristic
|
||||
? NULL
|
||||
: MP_OBJ_TO_PTR(service->characteristic_list->items[char_idx + 1]);
|
||||
|
||||
// Skip the characteristic if it had an unknown (unregistered) UUID.
|
||||
if (characteristic->uuid == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint16_t next_desc_start_handle = characteristic->handle + 1;
|
||||
|
||||
// Don't run past the end of this service or the beginning of the next characteristic.
|
||||
uint16_t next_desc_end_handle = next_characteristic == NULL
|
||||
? service->end_handle
|
||||
: next_characteristic->handle - 1;
|
||||
|
||||
// Stop when we go past the end of the range of handles for this service or
|
||||
// discovery call returns nothing.
|
||||
// discover_next_descriptors() appends to the descriptor_list.
|
||||
while (next_desc_start_handle <= service->end_handle &&
|
||||
next_desc_start_handle < next_desc_end_handle &&
|
||||
discover_next_descriptors(self, characteristic,
|
||||
next_desc_start_handle, next_desc_end_handle)) {
|
||||
|
||||
// Get the most recently discovered descriptor, and then ask for descriptors
|
||||
// whose handles start after that descriptor's handle.
|
||||
const bleio_descriptor_obj_t *descriptor =
|
||||
MP_OBJ_TO_PTR(characteristic->descriptor_list->items[characteristic->descriptor_list->len - 1]);
|
||||
next_desc_start_handle = descriptor->handle + 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_bleio_central_disconnect(bleio_central_obj_t *self) {
|
||||
sd_ble_gap_disconnect(self->conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
|
||||
}
|
||||
|
||||
bool common_hal_bleio_central_get_connected(bleio_central_obj_t *self) {
|
||||
return self->conn_handle != BLE_CONN_HANDLE_INVALID;
|
||||
}
|
||||
|
||||
mp_obj_list_t *common_hal_bleio_central_get_remote_services(bleio_central_obj_t *self) {
|
||||
return self->service_list;
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -24,22 +25,21 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_BLEIO_DEVICE_H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_DEVICE_H
|
||||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_BLEIO_CENTRAL_H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_CENTRAL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "py/objlist.h"
|
||||
#include "shared-module/bleio/__init__.h"
|
||||
#include "shared-module/bleio/Address.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
bool is_peripheral;
|
||||
mp_obj_t name;
|
||||
bleio_address_obj_t address;
|
||||
gatt_role_t gatt_role;
|
||||
volatile bool waiting_to_connect;
|
||||
volatile uint16_t conn_handle;
|
||||
mp_obj_t service_list;
|
||||
mp_obj_t notif_handler;
|
||||
mp_obj_t conn_handler;
|
||||
} bleio_device_obj_t;
|
||||
mp_obj_list_t *service_list;
|
||||
} bleio_central_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_DEVICE_H
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_CENTRAL_H
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -34,12 +35,8 @@
|
||||
#include "py/runtime.h"
|
||||
#include "common-hal/bleio/__init__.h"
|
||||
#include "common-hal/bleio/Characteristic.h"
|
||||
#include "shared-module/bleio/Characteristic.h"
|
||||
|
||||
STATIC volatile bleio_characteristic_obj_t *m_read_characteristic;
|
||||
STATIC volatile uint8_t m_tx_in_progress;
|
||||
// Serialize gattc writes that send a response. This might be done per object?
|
||||
STATIC nrf_mutex_t *m_write_mutex;
|
||||
|
||||
STATIC uint16_t get_cccd(bleio_characteristic_obj_t *characteristic) {
|
||||
const uint16_t conn_handle = common_hal_bleio_device_get_conn_handle(characteristic->service->device);
|
||||
@ -63,7 +60,7 @@ STATIC uint16_t get_cccd(bleio_characteristic_obj_t *characteristic) {
|
||||
}
|
||||
|
||||
STATIC void gatts_read(bleio_characteristic_obj_t *characteristic) {
|
||||
// This might be BLE_CONN_HANDLE_INVALID if we're not conected, but that's OK, because
|
||||
// This might be BLE_CONN_HANDLE_INVALID if we're not connected, but that's OK, because
|
||||
// we can still read and write the local value.
|
||||
const uint16_t conn_handle = common_hal_bleio_device_get_conn_handle(characteristic->service->device);
|
||||
|
||||
@ -118,24 +115,35 @@ STATIC void gatts_notify_indicate(bleio_characteristic_obj_t *characteristic, mp
|
||||
.p_data = bufinfo->buf,
|
||||
};
|
||||
|
||||
while (m_tx_in_progress >= MAX_TX_IN_PROGRESS) {
|
||||
#ifdef MICROPY_VM_HOOK_LOOP
|
||||
MICROPY_VM_HOOK_LOOP
|
||||
#endif
|
||||
}
|
||||
|
||||
const uint16_t conn_handle = common_hal_bleio_device_get_conn_handle(characteristic->service->device);
|
||||
m_tx_in_progress++;
|
||||
const uint32_t err_code = sd_ble_gatts_hvx(conn_handle, &hvx_params);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
m_tx_in_progress--;
|
||||
|
||||
while (1) {
|
||||
const uint32_t err_code = sd_ble_gatts_hvx(conn_handle, &hvx_params);
|
||||
if (err_code == NRF_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
// TX buffer is full
|
||||
// We could wait for an event indicating the write is complete, but just retrying is easier.
|
||||
if (err_code == NRF_ERROR_RESOURCES) {
|
||||
MICROPY_VM_HOOK_LOOP;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Some real error has occurred.
|
||||
mp_raise_OSError_msg_varg(translate("Failed to notify or indicate attribute value, err 0x%04x"), err_code);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
STATIC void check_connected(uint16_t conn_handle) {
|
||||
if (conn_handle == BLE_CONN_HANDLE_INVALID) {
|
||||
mp_raise_OSError_msg(translate("Not connected"));
|
||||
}
|
||||
}
|
||||
|
||||
STATIC void gattc_read(bleio_characteristic_obj_t *characteristic) {
|
||||
const uint16_t conn_handle = common_hal_bleio_device_get_conn_handle(characteristic->service->device);
|
||||
check_connected(conn_handle);
|
||||
|
||||
m_read_characteristic = characteristic;
|
||||
|
||||
@ -144,100 +152,79 @@ STATIC void gattc_read(bleio_characteristic_obj_t *characteristic) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to read attribute value, err 0x%04x"), err_code);
|
||||
}
|
||||
|
||||
//
|
||||
while (m_read_characteristic != NULL) {
|
||||
#ifdef MICROPY_VM_HOOK_LOOP
|
||||
MICROPY_VM_HOOK_LOOP
|
||||
#endif
|
||||
MICROPY_VM_HOOK_LOOP;
|
||||
}
|
||||
}
|
||||
|
||||
STATIC void gattc_write(bleio_characteristic_obj_t *characteristic, mp_buffer_info_t *bufinfo) {
|
||||
const uint16_t conn_handle = common_hal_bleio_device_get_conn_handle(characteristic->service->device);
|
||||
uint32_t err_code;
|
||||
check_connected(conn_handle);
|
||||
|
||||
ble_gattc_write_params_t write_params = {
|
||||
.flags = BLE_GATT_EXEC_WRITE_FLAG_PREPARED_CANCEL,
|
||||
.write_op = BLE_GATT_OP_WRITE_REQ,
|
||||
.write_op = characteristic->props.write_no_response ? BLE_GATT_OP_WRITE_CMD : BLE_GATT_OP_WRITE_REQ,
|
||||
.handle = characteristic->handle,
|
||||
.p_value = bufinfo->buf,
|
||||
.len = bufinfo->len,
|
||||
};
|
||||
|
||||
if (characteristic->props.write_no_response) {
|
||||
write_params.write_op = BLE_GATT_OP_WRITE_CMD;
|
||||
|
||||
err_code = sd_mutex_acquire(m_write_mutex);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to acquire mutex, err 0x%04x"), err_code);
|
||||
while (1) {
|
||||
uint32_t err_code = sd_ble_gattc_write(conn_handle, &write_params);
|
||||
if (err_code == NRF_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
err_code = sd_ble_gattc_write(conn_handle, &write_params);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
// Write with response will return NRF_ERROR_BUSY if the response has not been received.
|
||||
// Write without reponse will return NRF_ERROR_RESOURCES if too many writes are pending.
|
||||
if (err_code == NRF_ERROR_BUSY || err_code == NRF_ERROR_RESOURCES) {
|
||||
// We could wait for an event indicating the write is complete, but just retrying is easier.
|
||||
MICROPY_VM_HOOK_LOOP;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Some real error occurred.
|
||||
mp_raise_OSError_msg_varg(translate("Failed to write attribute value, err 0x%04x"), err_code);
|
||||
}
|
||||
|
||||
while (sd_mutex_acquire(m_write_mutex) == NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN) {
|
||||
#ifdef MICROPY_VM_HOOK_LOOP
|
||||
MICROPY_VM_HOOK_LOOP
|
||||
#endif
|
||||
}
|
||||
|
||||
err_code = sd_mutex_release(m_write_mutex);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to release mutex, err 0x%04x"), err_code);
|
||||
}
|
||||
}
|
||||
|
||||
STATIC void characteristic_on_ble_evt(ble_evt_t *ble_evt, void *param) {
|
||||
switch (ble_evt->header.evt_id) {
|
||||
case BLE_GATTS_EVT_HVN_TX_COMPLETE:
|
||||
{
|
||||
uint8_t count = ble_evt->evt.gatts_evt.params.hvn_tx_complete.count;
|
||||
// Don't underflow the count.
|
||||
if (count >= m_tx_in_progress) {
|
||||
m_tx_in_progress = 0;
|
||||
} else {
|
||||
m_tx_in_progress -= count;
|
||||
|
||||
// More events may be handled later, so keep this as a switch.
|
||||
|
||||
case BLE_GATTC_EVT_READ_RSP: {
|
||||
ble_gattc_evt_read_rsp_t *response = &ble_evt->evt.gattc_evt.params.read_rsp;
|
||||
m_read_characteristic->value_data = mp_obj_new_bytearray(response->len, response->data);
|
||||
// Indicate to busy-wait loop that we've read the characteristic.
|
||||
m_read_characteristic = NULL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_GATTC_EVT_READ_RSP:
|
||||
{
|
||||
ble_gattc_evt_read_rsp_t *response = &ble_evt->evt.gattc_evt.params.read_rsp;
|
||||
m_read_characteristic->value_data = mp_obj_new_bytearray(response->len, response->data);
|
||||
// Flag to busy-wait loop that we've read the characteristic.
|
||||
m_read_characteristic = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_GATTC_EVT_WRITE_RSP:
|
||||
// Someone else can write now.
|
||||
sd_mutex_release(m_write_mutex);
|
||||
break;
|
||||
|
||||
// For debugging.
|
||||
default:
|
||||
// mp_printf(&mp_plat_print, "Unhandled characteristic event: 0x%04x\n", ble_evt->header.evt_id);
|
||||
break;
|
||||
// For debugging.
|
||||
default:
|
||||
// mp_printf(&mp_plat_print, "Unhandled characteristic event: 0x%04x\n", ble_evt->header.evt_id);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props) {
|
||||
self->service = NULL;
|
||||
void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, mp_obj_list_t *descriptor_list) {
|
||||
self->service = mp_const_none;
|
||||
self->uuid = uuid;
|
||||
self->value_data = NULL;
|
||||
self->value_data = mp_const_none;
|
||||
self->props = props;
|
||||
self->descriptor_list = descriptor_list;
|
||||
self->handle = BLE_GATT_HANDLE_INVALID;
|
||||
|
||||
ble_drv_add_event_handler(characteristic_on_ble_evt, self);
|
||||
|
||||
}
|
||||
|
||||
void common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *self) {
|
||||
mp_obj_list_t *common_hal_bleio_characteristic_get_descriptor_list(bleio_characteristic_obj_t *self) {
|
||||
return self->descriptor_list;
|
||||
}
|
||||
|
||||
mp_obj_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *self) {
|
||||
switch (common_hal_bleio_device_get_gatt_role(self->service->device)) {
|
||||
case GATT_ROLE_CLIENT:
|
||||
gattc_read(self);
|
||||
@ -251,6 +238,8 @@ void common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *self)
|
||||
mp_raise_RuntimeError(translate("bad GATT role"));
|
||||
break;
|
||||
}
|
||||
|
||||
return self->value_data;
|
||||
}
|
||||
|
||||
void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, mp_buffer_info_t *bufinfo) {
|
||||
@ -258,30 +247,83 @@ void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self,
|
||||
uint16_t cccd = 0;
|
||||
|
||||
switch (common_hal_bleio_device_get_gatt_role(self->service->device)) {
|
||||
case GATT_ROLE_SERVER:
|
||||
if (self->props.notify || self->props.indicate) {
|
||||
cccd = get_cccd(self);
|
||||
}
|
||||
// It's possible that both notify and indicate are set.
|
||||
if (self->props.notify && (cccd & BLE_GATT_HVX_NOTIFICATION)) {
|
||||
gatts_notify_indicate(self, bufinfo, BLE_GATT_HVX_NOTIFICATION);
|
||||
sent = true;
|
||||
}
|
||||
if (self->props.indicate && (cccd & BLE_GATT_HVX_INDICATION)) {
|
||||
gatts_notify_indicate(self, bufinfo, BLE_GATT_HVX_INDICATION);
|
||||
sent = true;
|
||||
}
|
||||
if (!sent) {
|
||||
gatts_write(self, bufinfo);
|
||||
}
|
||||
break;
|
||||
case GATT_ROLE_SERVER:
|
||||
if (self->props.notify || self->props.indicate) {
|
||||
cccd = get_cccd(self);
|
||||
}
|
||||
// It's possible that both notify and indicate are set.
|
||||
if (self->props.notify && (cccd & BLE_GATT_HVX_NOTIFICATION)) {
|
||||
gatts_notify_indicate(self, bufinfo, BLE_GATT_HVX_NOTIFICATION);
|
||||
sent = true;
|
||||
}
|
||||
if (self->props.indicate && (cccd & BLE_GATT_HVX_INDICATION)) {
|
||||
gatts_notify_indicate(self, bufinfo, BLE_GATT_HVX_INDICATION);
|
||||
sent = true;
|
||||
}
|
||||
if (!sent) {
|
||||
gatts_write(self, bufinfo);
|
||||
}
|
||||
break;
|
||||
|
||||
case GATT_ROLE_CLIENT:
|
||||
gattc_write(self, bufinfo);
|
||||
break;
|
||||
case GATT_ROLE_CLIENT:
|
||||
gattc_write(self, bufinfo);
|
||||
break;
|
||||
|
||||
default:
|
||||
mp_raise_RuntimeError(translate("bad GATT role"));
|
||||
break;
|
||||
default:
|
||||
mp_raise_RuntimeError(translate("bad GATT role"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bleio_uuid_obj_t *common_hal_bleio_characteristic_get_uuid(bleio_characteristic_obj_t *self) {
|
||||
return self->uuid;
|
||||
}
|
||||
|
||||
bleio_characteristic_properties_t common_hal_bleio_characteristic_get_properties(bleio_characteristic_obj_t *self) {
|
||||
return self->props;
|
||||
}
|
||||
|
||||
void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self, bool notify, bool indicate) {
|
||||
if (self->cccd_handle == BLE_GATT_HANDLE_INVALID) {
|
||||
mp_raise_ValueError(translate("No CCCD for this Characteristic"));
|
||||
}
|
||||
|
||||
if (common_hal_bleio_device_get_gatt_role(self->service->device) != GATT_ROLE_CLIENT) {
|
||||
mp_raise_ValueError(translate("Can't set CCCD for local Characteristic"));
|
||||
}
|
||||
|
||||
uint16_t cccd_value =
|
||||
(notify ? BLE_GATT_HVX_NOTIFICATION : 0) |
|
||||
(indicate ? BLE_GATT_HVX_INDICATION : 0);
|
||||
|
||||
const uint16_t conn_handle = common_hal_bleio_device_get_conn_handle(self->service->device);
|
||||
check_connected(conn_handle);
|
||||
|
||||
|
||||
ble_gattc_write_params_t write_params = {
|
||||
.write_op = BLE_GATT_OP_WRITE_REQ,
|
||||
.handle = self->cccd_handle,
|
||||
.p_value = (uint8_t *) &cccd_value,
|
||||
.len = 2,
|
||||
};
|
||||
|
||||
while (1) {
|
||||
uint32_t err_code = sd_ble_gattc_write(conn_handle, &write_params);
|
||||
if (err_code == NRF_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Write with response will return NRF_ERROR_BUSY if the response has not been received.
|
||||
// Write without reponse will return NRF_ERROR_RESOURCES if too many writes are pending.
|
||||
if (err_code == NRF_ERROR_BUSY || err_code == NRF_ERROR_RESOURCES) {
|
||||
// We could wait for an event indicating the write is complete, but just retrying is easier.
|
||||
MICROPY_VM_HOOK_LOOP;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Some real error occurred.
|
||||
mp_raise_OSError_msg_varg(translate("Failed to write CCCD, err 0x%04x"), err_code);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -24,23 +25,24 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_COMMON_HAL_BLEIO_CHARACTERISTIC_H
|
||||
#define MICROPY_INCLUDED_COMMON_HAL_BLEIO_CHARACTERISTIC_H
|
||||
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTIC_H
|
||||
#define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTIC_H
|
||||
|
||||
#include "shared-module/bleio/Characteristic.h"
|
||||
#include "shared-module/bleio/Service.h"
|
||||
#include "common-hal/bleio/Service.h"
|
||||
#include "common-hal/bleio/UUID.h"
|
||||
#include "shared-module/bleio/Characteristic.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
bleio_service_obj_t *service;
|
||||
bleio_uuid_obj_t *uuid;
|
||||
mp_obj_t value_data;
|
||||
volatile mp_obj_t value_data;
|
||||
uint16_t handle;
|
||||
bleio_characteristic_properties_t props;
|
||||
mp_obj_list_t *descriptor_list;
|
||||
uint16_t user_desc_handle;
|
||||
uint16_t cccd_handle;
|
||||
uint16_t sccd_handle;
|
||||
} bleio_characteristic_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_COMMON_HAL_BLEIO_CHARACTERISTIC_H
|
||||
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTIC_H
|
||||
|
@ -40,25 +40,42 @@
|
||||
#include "common-hal/bleio/__init__.h"
|
||||
#include "common-hal/bleio/CharacteristicBuffer.h"
|
||||
|
||||
STATIC void write_to_ringbuf(bleio_characteristic_buffer_obj_t *self, uint8_t *data, uint16_t len) {
|
||||
// Push all the data onto the ring buffer.
|
||||
uint8_t is_nested_critical_region;
|
||||
sd_nvic_critical_region_enter(&is_nested_critical_region);
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
ringbuf_put(&self->ringbuf, data[i]);
|
||||
}
|
||||
sd_nvic_critical_region_exit(is_nested_critical_region);
|
||||
}
|
||||
|
||||
STATIC void characteristic_buffer_on_ble_evt(ble_evt_t *ble_evt, void *param) {
|
||||
bleio_characteristic_buffer_obj_t *self = (bleio_characteristic_buffer_obj_t *) param;
|
||||
switch (ble_evt->header.evt_id) {
|
||||
case BLE_GATTS_EVT_WRITE: {
|
||||
ble_gatts_evt_write_t *evt_write = &ble_evt->evt.gatts_evt.params.write;
|
||||
// Event handle must match the handle for my characteristic.
|
||||
if (evt_write->handle == self->characteristic->handle) {
|
||||
// Push all the data onto the ring buffer.
|
||||
uint8_t is_nested_critical_region;
|
||||
sd_nvic_critical_region_enter(&is_nested_critical_region);
|
||||
for (size_t i = 0; i < evt_write->len; i++) {
|
||||
ringbuf_put(&self->ringbuf, evt_write->data[i]);
|
||||
case BLE_GATTS_EVT_WRITE: {
|
||||
// A client wrote to this server characteristic.
|
||||
|
||||
ble_gatts_evt_write_t *evt_write = &ble_evt->evt.gatts_evt.params.write;
|
||||
// Event handle must match the handle for my characteristic.
|
||||
if (evt_write->handle == self->characteristic->handle) {
|
||||
write_to_ringbuf(self, evt_write->data, evt_write->len);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_GATTC_EVT_HVX: {
|
||||
// A remote service wrote to this characteristic.
|
||||
|
||||
ble_gattc_evt_hvx_t* evt_hvx = &ble_evt->evt.gattc_evt.params.hvx;
|
||||
// Must be a notification, and event handle must match the handle for my characteristic.
|
||||
if (evt_hvx->type == BLE_GATT_HVX_NOTIFICATION &&
|
||||
evt_hvx->handle == self->characteristic->handle) {
|
||||
write_to_ringbuf(self, evt_hvx->data, evt_hvx->len);
|
||||
}
|
||||
sd_nvic_critical_region_exit(is_nested_critical_region);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Assumes that timeout and buffer_size have been validated before call.
|
||||
@ -82,13 +99,11 @@ int common_hal_bleio_characteristic_buffer_read(bleio_characteristic_buffer_obj_
|
||||
|
||||
// Wait for all bytes received or timeout
|
||||
while ( (ringbuf_count(&self->ringbuf) < len) && (ticks_ms - start_ticks < self->timeout_ms) ) {
|
||||
#ifdef MICROPY_VM_HOOK_LOOP
|
||||
MICROPY_VM_HOOK_LOOP ;
|
||||
MICROPY_VM_HOOK_LOOP;
|
||||
// Allow user to break out of a timeout with a KeyboardInterrupt.
|
||||
if ( mp_hal_is_interrupted() ) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Copy received data. Lock out write interrupt handler while copying.
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -24,8 +24,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H
|
||||
#define MICROPY_INCLUDED_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H
|
||||
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H
|
||||
#define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H
|
||||
|
||||
#include "nrf_soc.h"
|
||||
|
||||
@ -40,4 +40,4 @@ typedef struct {
|
||||
ringbuf_t ringbuf;
|
||||
} bleio_characteristic_buffer_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H
|
||||
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -29,7 +30,6 @@
|
||||
#include "shared-bindings/bleio/UUID.h"
|
||||
|
||||
void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_uuid_obj_t *uuid) {
|
||||
// TODO: set handle ???
|
||||
self->uuid = uuid;
|
||||
}
|
||||
|
||||
@ -37,6 +37,6 @@ mp_int_t common_hal_bleio_descriptor_get_handle(bleio_descriptor_obj_t *self) {
|
||||
return self->handle;
|
||||
}
|
||||
|
||||
mp_obj_t common_hal_bleio_descriptor_get_uuid(bleio_descriptor_obj_t *self) {
|
||||
return MP_OBJ_FROM_PTR(self->uuid);
|
||||
bleio_uuid_obj_t *common_hal_bleio_descriptor_get_uuid(bleio_descriptor_obj_t *self) {
|
||||
return self->uuid;
|
||||
}
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -29,11 +30,13 @@
|
||||
#define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_DESCRIPTOR_H
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "common-hal/bleio/Characteristic.h"
|
||||
#include "common-hal/bleio/UUID.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
uint16_t handle;
|
||||
bleio_characteristic_obj_t *characteristic;
|
||||
bleio_uuid_obj_t *uuid;
|
||||
} bleio_descriptor_obj_t;
|
||||
|
||||
|
@ -1,601 +0,0 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ble.h"
|
||||
#include "ble_drv.h"
|
||||
#include "ble_hci.h"
|
||||
#include "nrf_soc.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/bleio/Adapter.h"
|
||||
#include "shared-bindings/bleio/Characteristic.h"
|
||||
#include "shared-bindings/bleio/Device.h"
|
||||
#include "shared-bindings/bleio/Service.h"
|
||||
#include "shared-bindings/bleio/UUID.h"
|
||||
|
||||
#define BLE_MIN_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_0_625_MS)
|
||||
#define BLE_MAX_CONN_INTERVAL MSEC_TO_UNITS(300, UNIT_0_625_MS)
|
||||
#define BLE_SLAVE_LATENCY 0
|
||||
#define BLE_CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS)
|
||||
|
||||
#define BLE_ADV_LENGTH_FIELD_SIZE 1
|
||||
#define BLE_ADV_AD_TYPE_FIELD_SIZE 1
|
||||
#define BLE_AD_TYPE_FLAGS_DATA_SIZE 1
|
||||
|
||||
#ifndef BLE_GAP_ADV_MAX_SIZE
|
||||
#define BLE_GAP_ADV_MAX_SIZE 31
|
||||
#endif
|
||||
|
||||
static bleio_service_obj_t *m_char_discovery_service;
|
||||
static volatile bool m_discovery_successful;
|
||||
static nrf_mutex_t *m_discovery_mutex;
|
||||
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
static uint8_t m_adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;
|
||||
|
||||
static uint8_t m_scan_buffer_data[BLE_GAP_SCAN_BUFFER_MIN];
|
||||
|
||||
static ble_data_t m_scan_buffer = {
|
||||
.p_data = m_scan_buffer_data,
|
||||
.len = BLE_GAP_SCAN_BUFFER_MIN
|
||||
};
|
||||
#endif
|
||||
|
||||
STATIC uint32_t set_advertisement_data(bleio_device_obj_t *device, bool connectable, mp_buffer_info_t *raw_data) {
|
||||
common_hal_bleio_adapter_set_enabled(true);
|
||||
|
||||
uint8_t adv_data[BLE_GAP_ADV_MAX_SIZE];
|
||||
uint8_t byte_pos = 0;
|
||||
uint32_t err_code;
|
||||
|
||||
#define ADD_FIELD(field, len) \
|
||||
do { \
|
||||
if (byte_pos + (len) > BLE_GAP_ADV_MAX_SIZE) { \
|
||||
mp_raise_ValueError(translate("Data too large for the advertisement packet")); \
|
||||
} \
|
||||
adv_data[byte_pos] = (field); \
|
||||
byte_pos += (len); \
|
||||
} while (0)
|
||||
|
||||
GET_STR_DATA_LEN(device->name, name_data, name_len);
|
||||
if (name_len > 0) {
|
||||
ble_gap_conn_sec_mode_t sec_mode;
|
||||
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
|
||||
|
||||
err_code = sd_ble_gap_device_name_set(&sec_mode, name_data, name_len);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return err_code;
|
||||
}
|
||||
|
||||
// TODO: Shorten if too long
|
||||
|
||||
ADD_FIELD(BLE_ADV_AD_TYPE_FIELD_SIZE + name_len, BLE_ADV_LENGTH_FIELD_SIZE);
|
||||
ADD_FIELD(BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME, BLE_ADV_AD_TYPE_FIELD_SIZE);
|
||||
|
||||
memcpy(&adv_data[byte_pos], name_data, name_len);
|
||||
byte_pos += name_len;
|
||||
}
|
||||
|
||||
// set flags, default to disc mode
|
||||
if (raw_data->len == 0) {
|
||||
ADD_FIELD(BLE_ADV_AD_TYPE_FIELD_SIZE + BLE_AD_TYPE_FLAGS_DATA_SIZE, BLE_ADV_LENGTH_FIELD_SIZE);
|
||||
ADD_FIELD(BLE_GAP_AD_TYPE_FLAGS, BLE_AD_TYPE_FLAGS_DATA_SIZE);
|
||||
ADD_FIELD(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE, BLE_AD_TYPE_FLAGS_DATA_SIZE);
|
||||
} else {
|
||||
if (byte_pos + raw_data->len > BLE_GAP_ADV_MAX_SIZE) {
|
||||
mp_raise_ValueError(translate("Data too large for the advertisement packet"));
|
||||
}
|
||||
|
||||
memcpy(&adv_data[byte_pos], raw_data->buf, raw_data->len);
|
||||
byte_pos += raw_data->len;
|
||||
}
|
||||
|
||||
const mp_obj_list_t *service_list = MP_OBJ_TO_PTR(device->service_list);
|
||||
if (service_list->len > 0) {
|
||||
bool has_128bit_services = false;
|
||||
bool has_16bit_services = false;
|
||||
|
||||
for (size_t i = 0; i < service_list->len; ++i) {
|
||||
const bleio_service_obj_t *service = MP_OBJ_TO_PTR(service_list->items[i]);
|
||||
|
||||
if (service->is_secondary) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (common_hal_bleio_uuid_get_size(service->uuid)) {
|
||||
case 16:
|
||||
has_16bit_services = true;
|
||||
break;
|
||||
case 128:
|
||||
has_128bit_services = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (has_16bit_services) {
|
||||
const uint8_t size_byte_pos = byte_pos;
|
||||
uint8_t uuid_total_size = 0;
|
||||
|
||||
// skip length byte for now, apply total length post calculation
|
||||
byte_pos += BLE_ADV_LENGTH_FIELD_SIZE;
|
||||
|
||||
ADD_FIELD(BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE, BLE_ADV_AD_TYPE_FIELD_SIZE);
|
||||
|
||||
for (size_t i = 0; i < service_list->len; ++i) {
|
||||
const bleio_service_obj_t *service = MP_OBJ_TO_PTR(service_list->items[i]);
|
||||
uint8_t encoded_size = 0;
|
||||
|
||||
if (common_hal_bleio_uuid_get_size(service->uuid) != 16 || service->is_secondary) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ble_uuid_t uuid;
|
||||
bleio_uuid_convert_to_nrf_ble_uuid(service->uuid, &uuid);
|
||||
|
||||
err_code = sd_ble_uuid_encode(&uuid, &encoded_size, &adv_data[byte_pos]);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return err_code;
|
||||
}
|
||||
|
||||
uuid_total_size += encoded_size;
|
||||
byte_pos += encoded_size;
|
||||
}
|
||||
|
||||
adv_data[size_byte_pos] = (BLE_ADV_AD_TYPE_FIELD_SIZE + uuid_total_size);
|
||||
}
|
||||
|
||||
if (has_128bit_services) {
|
||||
const uint8_t size_byte_pos = byte_pos;
|
||||
uint8_t uuid_total_size = 0;
|
||||
|
||||
// skip length byte for now, apply total length post calculation
|
||||
byte_pos += BLE_ADV_LENGTH_FIELD_SIZE;
|
||||
|
||||
ADD_FIELD(BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE, BLE_ADV_AD_TYPE_FIELD_SIZE);
|
||||
|
||||
for (size_t i = 0; i < service_list->len; ++i) {
|
||||
const bleio_service_obj_t *service = MP_OBJ_TO_PTR(service_list->items[i]);
|
||||
uint8_t encoded_size = 0;
|
||||
|
||||
if (common_hal_bleio_uuid_get_size(service->uuid) != 16 || service->is_secondary) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ble_uuid_t uuid;
|
||||
bleio_uuid_convert_to_nrf_ble_uuid(service->uuid, &uuid);
|
||||
|
||||
err_code = sd_ble_uuid_encode(&uuid, &encoded_size, &adv_data[byte_pos]);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return err_code;
|
||||
}
|
||||
|
||||
uuid_total_size += encoded_size;
|
||||
byte_pos += encoded_size;
|
||||
}
|
||||
|
||||
adv_data[size_byte_pos] = (BLE_ADV_AD_TYPE_FIELD_SIZE + uuid_total_size);
|
||||
}
|
||||
}
|
||||
|
||||
#if (BLUETOOTH_SD == 132)
|
||||
err_code = sd_ble_gap_adv_data_set(adv_data, byte_pos, NULL, 0);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return err_code;
|
||||
}
|
||||
#endif
|
||||
|
||||
static ble_gap_adv_params_t m_adv_params = {
|
||||
.interval = MSEC_TO_UNITS(100, UNIT_0_625_MS),
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED,
|
||||
.duration = BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED,
|
||||
.filter_policy = BLE_GAP_ADV_FP_ANY,
|
||||
.primary_phy = BLE_GAP_PHY_1MBPS,
|
||||
#else
|
||||
.type = BLE_GAP_ADV_TYPE_ADV_IND,
|
||||
.fp = BLE_GAP_ADV_FP_ANY,
|
||||
#endif
|
||||
};
|
||||
|
||||
if (!connectable) {
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
m_adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
|
||||
#else
|
||||
m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_NONCONN_IND;
|
||||
#endif
|
||||
}
|
||||
|
||||
common_hal_bleio_device_stop_advertising(device);
|
||||
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
const ble_gap_adv_data_t ble_gap_adv_data = {
|
||||
.adv_data.p_data = adv_data,
|
||||
.adv_data.len = byte_pos,
|
||||
};
|
||||
|
||||
err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &ble_gap_adv_data, &m_adv_params);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return err_code;
|
||||
}
|
||||
|
||||
err_code = sd_ble_gap_adv_start(m_adv_handle, BLE_CONN_CFG_TAG_CUSTOM);
|
||||
#elif (BLUETOOTH_SD == 132 && BLE_API_VERSION == 4)
|
||||
err_code = sd_ble_gap_adv_start(&m_adv_params, BLE_CONN_CFG_TAG_CUSTOM);
|
||||
#else
|
||||
err_code = sd_ble_gap_adv_start(&m_adv_params);
|
||||
#endif
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
STATIC bool discover_services(bleio_device_obj_t *device, uint16_t start_handle) {
|
||||
m_discovery_successful = false;
|
||||
|
||||
uint32_t err_code = sd_ble_gattc_primary_services_discover(device->conn_handle, start_handle, NULL);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to discover services"));
|
||||
}
|
||||
|
||||
// Serialize discovery.
|
||||
err_code = sd_mutex_acquire(m_discovery_mutex);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to acquire mutex"));
|
||||
}
|
||||
|
||||
// Wait for someone else to release m_discovery_mutex.
|
||||
while (sd_mutex_acquire(m_discovery_mutex) == NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN) {
|
||||
#ifdef MICROPY_VM_HOOK_LOOP
|
||||
MICROPY_VM_HOOK_LOOP
|
||||
#endif
|
||||
}
|
||||
|
||||
err_code = sd_mutex_release(m_discovery_mutex);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to release mutex"));
|
||||
}
|
||||
|
||||
return m_discovery_successful;
|
||||
}
|
||||
|
||||
STATIC bool discover_characteristics(bleio_device_obj_t *device, bleio_service_obj_t *service, uint16_t start_handle) {
|
||||
m_char_discovery_service = service;
|
||||
|
||||
ble_gattc_handle_range_t handle_range;
|
||||
handle_range.start_handle = start_handle;
|
||||
handle_range.end_handle = service->end_handle;
|
||||
|
||||
m_discovery_successful = false;
|
||||
|
||||
uint32_t err_code = sd_ble_gattc_characteristics_discover(device->conn_handle, &handle_range);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
err_code = sd_mutex_acquire(m_discovery_mutex);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to acquire mutex"));
|
||||
}
|
||||
|
||||
while (sd_mutex_acquire(m_discovery_mutex) == NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN) {
|
||||
#ifdef MICROPY_VM_HOOK_LOOP
|
||||
MICROPY_VM_HOOK_LOOP
|
||||
#endif
|
||||
}
|
||||
|
||||
err_code = sd_mutex_release(m_discovery_mutex);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to release mutex"));
|
||||
}
|
||||
|
||||
return m_discovery_successful;
|
||||
}
|
||||
|
||||
STATIC void on_primary_srv_discovery_rsp(ble_gattc_evt_prim_srvc_disc_rsp_t *response, bleio_device_obj_t *device) {
|
||||
for (size_t i = 0; i < response->count; ++i) {
|
||||
ble_gattc_service_t *gattc_service = &response->services[i];
|
||||
|
||||
bleio_service_obj_t *service = m_new_obj(bleio_service_obj_t);
|
||||
service->base.type = &bleio_service_type;
|
||||
service->device = device;
|
||||
service->char_list = mp_obj_new_list(0, NULL);
|
||||
service->start_handle = gattc_service->handle_range.start_handle;
|
||||
service->end_handle = gattc_service->handle_range.end_handle;
|
||||
service->handle = gattc_service->handle_range.start_handle;
|
||||
|
||||
bleio_uuid_obj_t *uuid = m_new_obj(bleio_uuid_obj_t);
|
||||
bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_service->uuid);
|
||||
service->uuid = uuid;
|
||||
|
||||
mp_obj_list_append(device->service_list, service);
|
||||
}
|
||||
|
||||
if (response->count > 0) {
|
||||
m_discovery_successful = true;
|
||||
}
|
||||
|
||||
const uint32_t err_code = sd_mutex_release(m_discovery_mutex);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to release mutex"));
|
||||
}
|
||||
}
|
||||
|
||||
STATIC void on_char_discovery_rsp(ble_gattc_evt_char_disc_rsp_t *response, bleio_device_obj_t *device) {
|
||||
for (size_t i = 0; i < response->count; ++i) {
|
||||
ble_gattc_char_t *gattc_char = &response->chars[i];
|
||||
|
||||
bleio_characteristic_obj_t *characteristic = m_new_obj(bleio_characteristic_obj_t);
|
||||
characteristic->base.type = &bleio_characteristic_type;
|
||||
|
||||
bleio_uuid_obj_t *uuid = m_new_obj(bleio_uuid_obj_t);
|
||||
uuid->base.type = &bleio_uuid_type;
|
||||
bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_char->uuid);
|
||||
characteristic->uuid = uuid;
|
||||
|
||||
characteristic->props.broadcast = gattc_char->char_props.broadcast;
|
||||
characteristic->props.indicate = gattc_char->char_props.indicate;
|
||||
characteristic->props.notify = gattc_char->char_props.notify;
|
||||
characteristic->props.read = gattc_char->char_props.read;
|
||||
characteristic->props.write = gattc_char->char_props.write;
|
||||
characteristic->props.write_no_response = gattc_char->char_props.write_wo_resp;
|
||||
characteristic->handle = gattc_char->handle_value;
|
||||
characteristic->service = m_char_discovery_service;
|
||||
|
||||
mp_obj_list_append(m_char_discovery_service->char_list, MP_OBJ_FROM_PTR(characteristic));
|
||||
}
|
||||
|
||||
if (response->count > 0) {
|
||||
m_discovery_successful = true;
|
||||
}
|
||||
|
||||
const uint32_t err_code = sd_mutex_release(m_discovery_mutex);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to release mutex"));
|
||||
}
|
||||
}
|
||||
|
||||
STATIC void on_adv_report(ble_gap_evt_adv_report_t *report, bleio_device_obj_t *device) {
|
||||
uint32_t err_code;
|
||||
|
||||
if (memcmp(report->peer_addr.addr, device->address.value, BLEIO_ADDRESS_BYTES) != 0) {
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
err_code = sd_ble_gap_scan_start(NULL, &m_scan_buffer);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to continue scanning"));
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
ble_gap_scan_params_t scan_params = {
|
||||
.active = 1,
|
||||
.interval = MSEC_TO_UNITS(100, UNIT_0_625_MS),
|
||||
.window = MSEC_TO_UNITS(100, UNIT_0_625_MS),
|
||||
};
|
||||
|
||||
ble_gap_addr_t addr;
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
|
||||
addr.addr_type = report->peer_addr.addr_type;
|
||||
memcpy(addr.addr, report->peer_addr.addr, BLEIO_ADDRESS_BYTES);
|
||||
|
||||
ble_gap_conn_params_t conn_params = {
|
||||
.min_conn_interval = BLE_MIN_CONN_INTERVAL,
|
||||
.max_conn_interval = BLE_MAX_CONN_INTERVAL,
|
||||
.conn_sup_timeout = BLE_CONN_SUP_TIMEOUT,
|
||||
.slave_latency = BLE_SLAVE_LATENCY,
|
||||
};
|
||||
|
||||
#if (BLE_API_VERSION == 2)
|
||||
err_code = sd_ble_gap_connect(&addr, &scan_params, &conn_params);
|
||||
#else
|
||||
err_code = sd_ble_gap_connect(&addr, &scan_params, &conn_params, BLE_CONN_CFG_TAG_CUSTOM);
|
||||
#endif
|
||||
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to connect:"));
|
||||
}
|
||||
}
|
||||
|
||||
STATIC void on_ble_evt(ble_evt_t *ble_evt, void *device_in) {
|
||||
bleio_device_obj_t *device = (bleio_device_obj_t*)device_in;
|
||||
|
||||
switch (ble_evt->header.evt_id) {
|
||||
case BLE_GAP_EVT_CONNECTED:
|
||||
{
|
||||
ble_gap_conn_params_t conn_params;
|
||||
device->conn_handle = ble_evt->evt.gap_evt.conn_handle;
|
||||
|
||||
sd_ble_gap_ppcp_get(&conn_params);
|
||||
sd_ble_gap_conn_param_update(ble_evt->evt.gap_evt.conn_handle, &conn_params);
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_GAP_EVT_DISCONNECTED:
|
||||
device->conn_handle = BLE_CONN_HANDLE_INVALID;
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_ADV_REPORT:
|
||||
on_adv_report(&ble_evt->evt.gap_evt.params.adv_report, device);
|
||||
break;
|
||||
|
||||
case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP:
|
||||
on_primary_srv_discovery_rsp(&ble_evt->evt.gattc_evt.params.prim_srvc_disc_rsp, device);
|
||||
break;
|
||||
|
||||
case BLE_GATTC_EVT_CHAR_DISC_RSP:
|
||||
on_char_discovery_rsp(&ble_evt->evt.gattc_evt.params.char_disc_rsp, device);
|
||||
break;
|
||||
|
||||
case BLE_GATTS_EVT_SYS_ATTR_MISSING:
|
||||
sd_ble_gatts_sys_attr_set(ble_evt->evt.gatts_evt.conn_handle, NULL, 0, 0);
|
||||
break;
|
||||
|
||||
#if (BLE_API_VERSION == 4)
|
||||
case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST:
|
||||
sd_ble_gatts_exchange_mtu_reply(device->conn_handle, BLE_GATT_ATT_MTU_DEFAULT);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
|
||||
sd_ble_gap_sec_params_reply(device->conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:
|
||||
{
|
||||
ble_gap_evt_conn_param_update_request_t *request = &ble_evt->evt.gap_evt.params.conn_param_update_request;
|
||||
sd_ble_gap_conn_param_update(device->conn_handle, &request->conn_params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_bleio_device_add_service(bleio_device_obj_t *device, bleio_service_obj_t *service) {
|
||||
ble_uuid_t uuid;
|
||||
bleio_uuid_convert_to_nrf_ble_uuid(service->uuid, &uuid);
|
||||
|
||||
uint8_t service_type = BLE_GATTS_SRVC_TYPE_PRIMARY;
|
||||
if (service->is_secondary) {
|
||||
service_type = BLE_GATTS_SRVC_TYPE_SECONDARY;
|
||||
}
|
||||
|
||||
common_hal_bleio_adapter_set_enabled(true);
|
||||
|
||||
const uint32_t err_code = sd_ble_gatts_service_add(service_type, &uuid, &service->handle);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to add service"));
|
||||
}
|
||||
|
||||
const mp_obj_list_t *char_list = MP_OBJ_TO_PTR(service->char_list);
|
||||
for (size_t i = 0; i < char_list->len; ++i) {
|
||||
bleio_characteristic_obj_t *characteristic = char_list->items[i];
|
||||
common_hal_bleio_service_add_characteristic(service, characteristic);
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_bleio_device_start_advertising(bleio_device_obj_t *device, bool connectable, mp_buffer_info_t *raw_data) {
|
||||
if (connectable) {
|
||||
ble_drv_add_event_handler(on_ble_evt, device);
|
||||
}
|
||||
|
||||
const uint32_t err_code = set_advertisement_data(device, connectable, raw_data);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to start advertising"));
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_bleio_device_stop_advertising(bleio_device_obj_t *device) {
|
||||
uint32_t err_code;
|
||||
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
if (m_adv_handle == BLE_GAP_ADV_SET_HANDLE_NOT_SET)
|
||||
return;
|
||||
|
||||
err_code = sd_ble_gap_adv_stop(m_adv_handle);
|
||||
#else
|
||||
err_code = sd_ble_gap_adv_stop();
|
||||
#endif
|
||||
|
||||
if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_INVALID_STATE)) {
|
||||
mp_raise_OSError_msg(translate("Failed to stop advertising"));
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_bleio_device_connect(bleio_device_obj_t *device) {
|
||||
ble_drv_add_event_handler(on_ble_evt, device);
|
||||
|
||||
ble_gap_scan_params_t scan_params = {
|
||||
.interval = MSEC_TO_UNITS(100, UNIT_0_625_MS),
|
||||
.window = MSEC_TO_UNITS(100, UNIT_0_625_MS),
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
.scan_phys = BLE_GAP_PHY_1MBPS,
|
||||
#endif
|
||||
};
|
||||
|
||||
common_hal_bleio_adapter_set_enabled(true);
|
||||
|
||||
uint32_t err_code;
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
err_code = sd_ble_gap_scan_start(&scan_params, &m_scan_buffer);
|
||||
#else
|
||||
err_code = sd_ble_gap_scan_start(&scan_params);
|
||||
#endif
|
||||
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to start scanning"));
|
||||
}
|
||||
|
||||
while (device->conn_handle == BLE_CONN_HANDLE_INVALID) {
|
||||
#ifdef MICROPY_VM_HOOK_LOOP
|
||||
MICROPY_VM_HOOK_LOOP
|
||||
#endif
|
||||
}
|
||||
|
||||
// TODO: read name
|
||||
|
||||
if (m_discovery_mutex == NULL) {
|
||||
m_discovery_mutex = m_new_ll(nrf_mutex_t, 1);
|
||||
|
||||
err_code = sd_mutex_new(m_discovery_mutex);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg(translate("Failed to create mutex"));
|
||||
}
|
||||
}
|
||||
|
||||
// find services
|
||||
bool found_service = discover_services(device, BLE_GATT_HANDLE_START);
|
||||
while (found_service) {
|
||||
const mp_obj_list_t *service_list = MP_OBJ_TO_PTR(device->service_list);
|
||||
const bleio_service_obj_t *service = service_list->items[service_list->len - 1];
|
||||
|
||||
found_service = discover_services(device, service->end_handle + 1);
|
||||
}
|
||||
|
||||
// find characteristics in each service
|
||||
const mp_obj_list_t *service_list = MP_OBJ_TO_PTR(device->service_list);
|
||||
for (size_t i = 0; i < service_list->len; ++i) {
|
||||
bleio_service_obj_t *service = service_list->items[i];
|
||||
|
||||
bool found_char = discover_characteristics(device, service, service->start_handle);
|
||||
while (found_char) {
|
||||
const mp_obj_list_t *char_list = MP_OBJ_TO_PTR(service->char_list);
|
||||
const bleio_characteristic_obj_t *characteristic = char_list->items[char_list->len - 1];
|
||||
|
||||
const uint16_t next_handle = characteristic->handle + 1;
|
||||
if (next_handle >= service->end_handle) {
|
||||
break;
|
||||
}
|
||||
|
||||
found_char = discover_characteristics(device, service, next_handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_bleio_device_disconnect(bleio_device_obj_t *device) {
|
||||
sd_ble_gap_disconnect(device->conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
|
||||
}
|
@ -3,8 +3,8 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -32,6 +32,8 @@
|
||||
#include "ble_drv.h"
|
||||
#include "ble_hci.h"
|
||||
#include "nrf_soc.h"
|
||||
#include "py/gc.h"
|
||||
#include "py/objlist.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/bleio/Adapter.h"
|
||||
@ -39,6 +41,7 @@
|
||||
#include "shared-bindings/bleio/Peripheral.h"
|
||||
#include "shared-bindings/bleio/Service.h"
|
||||
#include "shared-bindings/bleio/UUID.h"
|
||||
#include "common-hal/bleio/Service.h"
|
||||
|
||||
#define BLE_MIN_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_0_625_MS)
|
||||
#define BLE_MAX_CONN_INTERVAL MSEC_TO_UNITS(300, UNIT_0_625_MS)
|
||||
@ -49,261 +52,96 @@
|
||||
#define BLE_ADV_AD_TYPE_FIELD_SIZE 1
|
||||
#define BLE_AD_TYPE_FLAGS_DATA_SIZE 1
|
||||
|
||||
static uint8_t m_adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;
|
||||
|
||||
STATIC void check_data_fit(size_t pos, size_t data_len) {
|
||||
if (pos + data_len >= BLE_GAP_ADV_SET_DATA_SIZE_MAX) {
|
||||
STATIC void check_data_fit(size_t data_len) {
|
||||
if (data_len > BLE_GAP_ADV_SET_DATA_SIZE_MAX) {
|
||||
mp_raise_ValueError(translate("Data too large for advertisement packet"));
|
||||
}
|
||||
}
|
||||
|
||||
STATIC uint32_t add_services_to_advertisement(bleio_peripheral_obj_t *self, size_t* adv_data_pos_p, size_t uuid_len) {
|
||||
uint32_t uuids_total_size = 0;
|
||||
const mp_obj_list_t *service_list = MP_OBJ_TO_PTR(self->service_list);
|
||||
uint32_t err_code = NRF_SUCCESS;
|
||||
|
||||
check_data_fit(*adv_data_pos_p, 1 + 1);
|
||||
|
||||
// Remember where length byte is; fill in later when we know the size.
|
||||
const size_t length_pos = *adv_data_pos_p;
|
||||
(*adv_data_pos_p)++;
|
||||
|
||||
self->adv_data[(*adv_data_pos_p)++] = (uuid_len == 16)
|
||||
? BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE
|
||||
: BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE;
|
||||
|
||||
for (size_t i = 0; i < service_list->len; ++i) {
|
||||
const bleio_service_obj_t *service = MP_OBJ_TO_PTR(service_list->items[i]);
|
||||
uint8_t encoded_size = 0;
|
||||
|
||||
// Skip services of the wrong length and secondary services.
|
||||
if (common_hal_bleio_uuid_get_size(service->uuid) != uuid_len || service->is_secondary) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ble_uuid_t uuid;
|
||||
bleio_uuid_convert_to_nrf_ble_uuid(service->uuid, &uuid);
|
||||
|
||||
err_code = sd_ble_uuid_encode(&uuid, &encoded_size, &(self->adv_data[*adv_data_pos_p]));
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return err_code;
|
||||
}
|
||||
|
||||
check_data_fit(*adv_data_pos_p, encoded_size);
|
||||
uuids_total_size += encoded_size;
|
||||
(*adv_data_pos_p) += encoded_size;
|
||||
}
|
||||
|
||||
self->adv_data[length_pos] = 1 + uuids_total_size; // 1 for the field type.
|
||||
return err_code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if raw_data is a zero-length buffer, generate an advertising packet that advertises the
|
||||
// services passed in when this Peripheral was created.
|
||||
// If raw_data contains some bytes, use those bytes as the advertising packet.
|
||||
// TODO: Generate the advertising packet in Python, not here.
|
||||
STATIC uint32_t set_advertisement_data(bleio_peripheral_obj_t *self, bool connectable, mp_buffer_info_t *raw_data) {
|
||||
common_hal_bleio_adapter_set_enabled(true);
|
||||
|
||||
size_t adv_data_pos = 0;
|
||||
uint32_t err_code;
|
||||
|
||||
GET_STR_DATA_LEN(self->name, name_data, name_len);
|
||||
if (name_len > 0) {
|
||||
ble_gap_conn_sec_mode_t sec_mode;
|
||||
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
|
||||
|
||||
// We'll add the name after everything else, shortening it if necessary.
|
||||
err_code = sd_ble_gap_device_name_set(&sec_mode, name_data, name_len);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return err_code;
|
||||
}
|
||||
}
|
||||
|
||||
if (raw_data->len != 0) {
|
||||
// User-supplied advertising packet.
|
||||
check_data_fit(adv_data_pos, raw_data->len);
|
||||
memcpy(&(self->adv_data[adv_data_pos]), raw_data->buf, raw_data->len);
|
||||
adv_data_pos += raw_data->len;
|
||||
} else {
|
||||
// Build up advertising packet.
|
||||
check_data_fit(adv_data_pos, 1 + 1 + 1);
|
||||
self->adv_data[adv_data_pos++] = 2;
|
||||
self->adv_data[adv_data_pos++] = BLE_GAP_AD_TYPE_FLAGS;
|
||||
self->adv_data[adv_data_pos++] = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
|
||||
|
||||
// The 16-bit ids and 128-bit ids are grouped together by length, so find it whether we have
|
||||
// 16 and/or 128-bit service UUIDs.
|
||||
|
||||
const mp_obj_list_t *service_list = MP_OBJ_TO_PTR(self->service_list);
|
||||
if (service_list->len > 0) {
|
||||
bool has_128bit_services = false;
|
||||
bool has_16bit_services = false;
|
||||
|
||||
for (size_t i = 0; i < service_list->len; ++i) {
|
||||
const bleio_service_obj_t *service = MP_OBJ_TO_PTR(service_list->items[i]);
|
||||
|
||||
if (service->is_secondary) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (common_hal_bleio_uuid_get_size(service->uuid)) {
|
||||
case 16:
|
||||
has_16bit_services = true;
|
||||
break;
|
||||
case 128:
|
||||
has_128bit_services = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Add 16-bit service UUID's in a group, then 128-bit service UUID's.
|
||||
|
||||
if (has_16bit_services) {
|
||||
err_code = add_services_to_advertisement(self, &adv_data_pos, 16);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return err_code;
|
||||
}
|
||||
}
|
||||
|
||||
if (has_128bit_services) {
|
||||
err_code = add_services_to_advertisement(self, &adv_data_pos, 128);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return err_code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Always include TX power.
|
||||
check_data_fit(adv_data_pos, 1 + 1 + 1);
|
||||
self->adv_data[adv_data_pos++] = 1 + 1;
|
||||
self->adv_data[adv_data_pos++] = BLE_GAP_AD_TYPE_TX_POWER_LEVEL;
|
||||
self->adv_data[adv_data_pos++] = 0; // TODO - allow power level to be set later.
|
||||
|
||||
// We need room for at least a one-character name.
|
||||
check_data_fit(adv_data_pos, 1 + 1 + 1);
|
||||
|
||||
// How big a name can we fit?
|
||||
size_t bytes_left = BLE_GAP_ADV_SET_DATA_SIZE_MAX - adv_data_pos - 1 - 1;
|
||||
size_t partial_name_len = MIN(bytes_left, name_len);
|
||||
self->adv_data[adv_data_pos++] = 1 + partial_name_len;
|
||||
self->adv_data[adv_data_pos++] = (partial_name_len == name_len)
|
||||
? BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME
|
||||
: BLE_GAP_AD_TYPE_SHORT_LOCAL_NAME;
|
||||
memcpy(&(self->adv_data[adv_data_pos]), name_data, partial_name_len);
|
||||
adv_data_pos += partial_name_len;
|
||||
} // end of advertising packet construction
|
||||
|
||||
static ble_gap_adv_params_t m_adv_params = {
|
||||
.interval = MSEC_TO_UNITS(1000, UNIT_0_625_MS),
|
||||
.properties.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED,
|
||||
.duration = BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED,
|
||||
.filter_policy = BLE_GAP_ADV_FP_ANY,
|
||||
.primary_phy = BLE_GAP_PHY_1MBPS,
|
||||
};
|
||||
|
||||
if (!connectable) {
|
||||
m_adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;
|
||||
}
|
||||
|
||||
common_hal_bleio_peripheral_stop_advertising(self);
|
||||
|
||||
const ble_gap_adv_data_t ble_gap_adv_data = {
|
||||
.adv_data.p_data = self->adv_data,
|
||||
.adv_data.len = adv_data_pos,
|
||||
};
|
||||
|
||||
err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &ble_gap_adv_data, &m_adv_params);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
return err_code;
|
||||
}
|
||||
|
||||
err_code = sd_ble_gap_adv_start(m_adv_handle, BLE_CONN_CFG_TAG_CUSTOM);
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
|
||||
bleio_peripheral_obj_t *self = (bleio_peripheral_obj_t*)self_in;
|
||||
|
||||
switch (ble_evt->header.evt_id) {
|
||||
case BLE_GAP_EVT_CONNECTED: {
|
||||
// Central has connected.
|
||||
ble_gap_conn_params_t conn_params;
|
||||
self->conn_handle = ble_evt->evt.gap_evt.conn_handle;
|
||||
sd_ble_gap_ppcp_get(&conn_params);
|
||||
sd_ble_gap_conn_param_update(ble_evt->evt.gap_evt.conn_handle, &conn_params);
|
||||
break;
|
||||
}
|
||||
case BLE_GAP_EVT_CONNECTED: {
|
||||
// Central has connected.
|
||||
ble_gap_conn_params_t conn_params;
|
||||
self->conn_handle = ble_evt->evt.gap_evt.conn_handle;
|
||||
sd_ble_gap_ppcp_get(&conn_params);
|
||||
sd_ble_gap_conn_param_update(ble_evt->evt.gap_evt.conn_handle, &conn_params);
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_GAP_EVT_DISCONNECTED:
|
||||
// Central has disconnected.
|
||||
self->conn_handle = BLE_CONN_HANDLE_INVALID;
|
||||
break;
|
||||
case BLE_GAP_EVT_DISCONNECTED:
|
||||
// Central has disconnected.
|
||||
self->conn_handle = BLE_CONN_HANDLE_INVALID;
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_PHY_UPDATE_REQUEST: {
|
||||
ble_gap_phys_t const phys = {
|
||||
.rx_phys = BLE_GAP_PHY_AUTO,
|
||||
.tx_phys = BLE_GAP_PHY_AUTO,
|
||||
};
|
||||
sd_ble_gap_phy_update(ble_evt->evt.gap_evt.conn_handle, &phys);
|
||||
break;
|
||||
}
|
||||
case BLE_GAP_EVT_PHY_UPDATE_REQUEST: {
|
||||
ble_gap_phys_t const phys = {
|
||||
.rx_phys = BLE_GAP_PHY_AUTO,
|
||||
.tx_phys = BLE_GAP_PHY_AUTO,
|
||||
};
|
||||
sd_ble_gap_phy_update(ble_evt->evt.gap_evt.conn_handle, &phys);
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_GAP_EVT_ADV_SET_TERMINATED:
|
||||
// Someday may handle timeouts or limit reached.
|
||||
break;
|
||||
case BLE_GAP_EVT_ADV_SET_TERMINATED:
|
||||
// Someday may handle timeouts or limit reached.
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
|
||||
sd_ble_gap_sec_params_reply(self->conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
|
||||
break;
|
||||
case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
|
||||
sd_ble_gap_sec_params_reply(self->conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: {
|
||||
ble_gap_evt_conn_param_update_request_t *request = &ble_evt->evt.gap_evt.params.conn_param_update_request;
|
||||
sd_ble_gap_conn_param_update(self->conn_handle, &request->conn_params);
|
||||
break;
|
||||
}
|
||||
case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST: {
|
||||
ble_gap_evt_conn_param_update_request_t *request =
|
||||
&ble_evt->evt.gap_evt.params.conn_param_update_request;
|
||||
sd_ble_gap_conn_param_update(self->conn_handle, &request->conn_params);
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST:
|
||||
sd_ble_gap_data_length_update(self->conn_handle, NULL, NULL);
|
||||
break;
|
||||
case BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST:
|
||||
sd_ble_gap_data_length_update(self->conn_handle, NULL, NULL);
|
||||
break;
|
||||
|
||||
case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST: {
|
||||
sd_ble_gatts_exchange_mtu_reply(self->conn_handle, BLE_GATT_ATT_MTU_DEFAULT);
|
||||
break;
|
||||
}
|
||||
case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST: {
|
||||
sd_ble_gatts_exchange_mtu_reply(self->conn_handle, BLE_GATT_ATT_MTU_DEFAULT);
|
||||
break;
|
||||
}
|
||||
|
||||
case BLE_GATTS_EVT_SYS_ATTR_MISSING:
|
||||
sd_ble_gatts_sys_attr_set(self->conn_handle, NULL, 0, 0);
|
||||
break;
|
||||
case BLE_GATTS_EVT_SYS_ATTR_MISSING:
|
||||
sd_ble_gatts_sys_attr_set(self->conn_handle, NULL, 0, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
// For debugging.
|
||||
// mp_printf(&mp_plat_print, "Unhandled peripheral event: 0x%04x\n", ble_evt->header.evt_id);
|
||||
break;
|
||||
default:
|
||||
// For debugging.
|
||||
// mp_printf(&mp_plat_print, "Unhandled peripheral event: 0x%04x\n", ble_evt->header.evt_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self, mp_obj_list_t *service_list, mp_obj_t name) {
|
||||
common_hal_bleio_adapter_set_enabled(true);
|
||||
|
||||
void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self) {
|
||||
common_hal_bleio_adapter_set_enabled(true); // TODO -- Do this somewhere else maybe bleio __init__
|
||||
self->service_list = service_list;
|
||||
self->name = name;
|
||||
|
||||
self->gatt_role = GATT_ROLE_SERVER;
|
||||
self->conn_handle = BLE_CONN_HANDLE_INVALID;
|
||||
self->adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;
|
||||
|
||||
// Add all the services.
|
||||
|
||||
mp_obj_list_t *service_list = MP_OBJ_TO_PTR(self->service_list);
|
||||
for (size_t service_idx = 0; service_idx < service_list->len; ++service_idx) {
|
||||
bleio_service_obj_t *service = MP_OBJ_TO_PTR(service_list->items[service_idx]);
|
||||
|
||||
service->device = MP_OBJ_FROM_PTR(self);
|
||||
|
||||
ble_uuid_t uuid;
|
||||
bleio_uuid_convert_to_nrf_ble_uuid(service->uuid, &uuid);
|
||||
|
||||
uint8_t service_type = BLE_GATTS_SRVC_TYPE_PRIMARY;
|
||||
if (service->is_secondary) {
|
||||
if (common_hal_bleio_service_get_is_secondary(service)) {
|
||||
service_type = BLE_GATTS_SRVC_TYPE_SECONDARY;
|
||||
}
|
||||
|
||||
@ -318,29 +156,94 @@ void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self) {
|
||||
}
|
||||
|
||||
|
||||
mp_obj_list_t *common_hal_bleio_peripheral_get_service_list(bleio_peripheral_obj_t *self) {
|
||||
return self->service_list;
|
||||
}
|
||||
|
||||
bool common_hal_bleio_peripheral_get_connected(bleio_peripheral_obj_t *self) {
|
||||
return self->conn_handle != BLE_CONN_HANDLE_INVALID;
|
||||
}
|
||||
|
||||
void common_hal_bleio_peripheral_start_advertising(bleio_peripheral_obj_t *self, bool connectable, mp_buffer_info_t *raw_data) {
|
||||
mp_obj_t common_hal_bleio_peripheral_get_name(bleio_peripheral_obj_t *self) {
|
||||
return self->name;
|
||||
}
|
||||
|
||||
void common_hal_bleio_peripheral_start_advertising(bleio_peripheral_obj_t *self, bool connectable, mp_float_t interval, mp_buffer_info_t *advertising_data_bufinfo, mp_buffer_info_t *scan_response_data_bufinfo) {
|
||||
|
||||
// interval value has already been validated.
|
||||
|
||||
if (connectable) {
|
||||
ble_drv_add_event_handler(peripheral_on_ble_evt, self);
|
||||
}
|
||||
|
||||
const uint32_t err_code = set_advertisement_data(self, connectable, raw_data);
|
||||
common_hal_bleio_adapter_set_enabled(true);
|
||||
|
||||
uint32_t err_code;
|
||||
|
||||
GET_STR_DATA_LEN(self->name, name_data, name_len);
|
||||
if (name_len > 0) {
|
||||
ble_gap_conn_sec_mode_t sec_mode;
|
||||
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
|
||||
|
||||
err_code = sd_ble_gap_device_name_set(&sec_mode, name_data, name_len);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to set device name, err 0x%04x"), err_code);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
check_data_fit(advertising_data_bufinfo->len);
|
||||
// The advertising data buffers must not move, because the SoftDevice depends on them.
|
||||
// So make them long-lived.
|
||||
self->advertising_data = (uint8_t *) gc_alloc(BLE_GAP_ADV_SET_DATA_SIZE_MAX * sizeof(uint8_t), false, true);
|
||||
memcpy(self->advertising_data, advertising_data_bufinfo->buf, advertising_data_bufinfo->len);
|
||||
|
||||
check_data_fit(scan_response_data_bufinfo->len);
|
||||
self->scan_response_data = (uint8_t *) gc_alloc(BLE_GAP_ADV_SET_DATA_SIZE_MAX * sizeof(uint8_t), false, true);
|
||||
memcpy(self->scan_response_data, scan_response_data_bufinfo->buf, scan_response_data_bufinfo->len);
|
||||
|
||||
|
||||
ble_gap_adv_params_t adv_params = {
|
||||
.interval = SEC_TO_UNITS(interval, UNIT_0_625_MS),
|
||||
.properties.type = connectable ? BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED
|
||||
: BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED,
|
||||
.duration = BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED,
|
||||
.filter_policy = BLE_GAP_ADV_FP_ANY,
|
||||
.primary_phy = BLE_GAP_PHY_1MBPS,
|
||||
};
|
||||
|
||||
common_hal_bleio_peripheral_stop_advertising(self);
|
||||
|
||||
const ble_gap_adv_data_t ble_gap_adv_data = {
|
||||
.adv_data.p_data = self->advertising_data,
|
||||
.adv_data.len = advertising_data_bufinfo->len,
|
||||
.scan_rsp_data.p_data = scan_response_data_bufinfo-> len > 0 ? self->scan_response_data : NULL,
|
||||
.scan_rsp_data.len = scan_response_data_bufinfo->len,
|
||||
};
|
||||
|
||||
err_code = sd_ble_gap_adv_set_configure(&self->adv_handle, &ble_gap_adv_data, &adv_params);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to configure advertising, err 0x%04x"), err_code);
|
||||
}
|
||||
|
||||
err_code = sd_ble_gap_adv_start(self->adv_handle, BLE_CONN_CFG_TAG_CUSTOM);
|
||||
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to start advertising, err 0x%04x"), err_code);
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_bleio_peripheral_stop_advertising(bleio_peripheral_obj_t *self) {
|
||||
|
||||
if (m_adv_handle == BLE_GAP_ADV_SET_HANDLE_NOT_SET)
|
||||
if (self->adv_handle == BLE_GAP_ADV_SET_HANDLE_NOT_SET)
|
||||
return;
|
||||
|
||||
const uint32_t err_code = sd_ble_gap_adv_stop(m_adv_handle);
|
||||
const uint32_t err_code = sd_ble_gap_adv_stop(self->adv_handle);
|
||||
|
||||
if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_INVALID_STATE)) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to stop advertising, err 0x%04x"), err_code);
|
||||
}
|
||||
}
|
||||
|
||||
void common_hal_bleio_peripheral_disconnect(bleio_peripheral_obj_t *self) {
|
||||
sd_ble_gap_disconnect(self->conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -25,13 +25,16 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_COMMON_HAL_BLEIO_PERIPHERAL_H
|
||||
#define MICROPY_INCLUDED_COMMON_HAL_BLEIO_PERIPHERAL_H
|
||||
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_PERIPHERAL_H
|
||||
#define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_PERIPHERAL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "ble.h"
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "py/objlist.h"
|
||||
|
||||
#include "shared-module/bleio/__init__.h"
|
||||
#include "shared-module/bleio/Address.h"
|
||||
|
||||
@ -40,14 +43,14 @@ typedef struct {
|
||||
mp_obj_t name;
|
||||
gatt_role_t gatt_role;
|
||||
volatile uint16_t conn_handle;
|
||||
mp_obj_t service_list;
|
||||
mp_obj_t notif_handler;
|
||||
mp_obj_t conn_handler;
|
||||
// The advertising data buffer is held by us, not by the SD, so we must
|
||||
// maintain it and not change it. If we need to change its contents during advertising,
|
||||
mp_obj_list_t *service_list;
|
||||
// The advertising data and scan response buffers are held by us, not by the SD, so we must
|
||||
// maintain them and not change it. If we need to change the contents during advertising,
|
||||
// there are tricks to get the SD to notice (see DevZone - TBS).
|
||||
uint8_t adv_data[BLE_GAP_ADV_SET_DATA_SIZE_MAX];
|
||||
uint8_t* advertising_data;
|
||||
uint8_t* scan_response_data;
|
||||
uint8_t adv_handle;
|
||||
|
||||
} bleio_peripheral_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_COMMON_HAL_BLEIO_PERIPHERAL_H
|
||||
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_PERIPHERAL_H
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -30,22 +31,21 @@
|
||||
#include "ble_drv.h"
|
||||
#include "ble_gap.h"
|
||||
#include "py/mphal.h"
|
||||
#include "py/objlist.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/bleio/Adapter.h"
|
||||
#include "shared-bindings/bleio/ScanEntry.h"
|
||||
#include "shared-bindings/bleio/Scanner.h"
|
||||
#include "shared-module/bleio/ScanEntry.h"
|
||||
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
static uint8_t m_scan_buffer_data[BLE_GAP_SCAN_BUFFER_MIN];
|
||||
|
||||
static ble_data_t m_scan_buffer = {
|
||||
m_scan_buffer_data,
|
||||
BLE_GAP_SCAN_BUFFER_MIN
|
||||
};
|
||||
#endif
|
||||
|
||||
STATIC void on_ble_evt(ble_evt_t *ble_evt, void *scanner_in) {
|
||||
STATIC void scanner_on_ble_evt(ble_evt_t *ble_evt, void *scanner_in) {
|
||||
bleio_scanner_obj_t *scanner = (bleio_scanner_obj_t*)scanner_in;
|
||||
ble_gap_evt_adv_report_t *report = &ble_evt->evt.gap_evt.params.adv_report;
|
||||
|
||||
@ -53,56 +53,53 @@ STATIC void on_ble_evt(ble_evt_t *ble_evt, void *scanner_in) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Don't add new entry for each item, group by address and update
|
||||
bleio_scanentry_obj_t *entry = m_new_obj(bleio_scanentry_obj_t);
|
||||
entry->base.type = &bleio_scanentry_type;
|
||||
entry->rssi = report->rssi;
|
||||
|
||||
entry->address.type = report->peer_addr.addr_type;
|
||||
memcpy(entry->address.value, report->peer_addr.addr, BLEIO_ADDRESS_BYTES);
|
||||
bleio_address_obj_t *address = m_new_obj(bleio_address_obj_t);
|
||||
address->base.type = &bleio_address_type;
|
||||
common_hal_bleio_address_construct(MP_OBJ_TO_PTR(address),
|
||||
report->peer_addr.addr, report->peer_addr.addr_type);
|
||||
entry->address = address;
|
||||
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
entry->data = mp_obj_new_bytearray(report->data.len, report->data.p_data);
|
||||
#else
|
||||
entry->data = mp_obj_new_bytearray(report->dlen, report->data);
|
||||
#endif
|
||||
entry->data = mp_obj_new_bytes(report->data.p_data, report->data.len);
|
||||
|
||||
mp_obj_list_append(scanner->adv_reports, entry);
|
||||
mp_obj_list_append(scanner->scan_entries, MP_OBJ_FROM_PTR(entry));
|
||||
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
const uint32_t err_code = sd_ble_gap_scan_start(NULL, &m_scan_buffer);
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to continue scanning, err 0x%04x"), err_code);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void common_hal_bleio_scanner_scan(bleio_scanner_obj_t *self, mp_int_t timeout) {
|
||||
ble_drv_add_event_handler(on_ble_evt, self);
|
||||
void common_hal_bleio_scanner_construct(bleio_scanner_obj_t *self) {
|
||||
}
|
||||
|
||||
mp_obj_t common_hal_bleio_scanner_scan(bleio_scanner_obj_t *self, mp_float_t timeout, mp_float_t interval, mp_float_t window) {
|
||||
common_hal_bleio_adapter_set_enabled(true);
|
||||
ble_drv_add_event_handler(scanner_on_ble_evt, self);
|
||||
|
||||
ble_gap_scan_params_t scan_params = {
|
||||
.interval = MSEC_TO_UNITS(self->interval, UNIT_0_625_MS),
|
||||
.window = MSEC_TO_UNITS(self->window, UNIT_0_625_MS),
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
.interval = SEC_TO_UNITS(interval, UNIT_0_625_MS),
|
||||
.window = SEC_TO_UNITS(window, UNIT_0_625_MS),
|
||||
.scan_phys = BLE_GAP_PHY_1MBPS,
|
||||
#endif
|
||||
};
|
||||
|
||||
common_hal_bleio_adapter_set_enabled(true);
|
||||
self->scan_entries = mp_obj_new_list(0, NULL);
|
||||
|
||||
uint32_t err_code;
|
||||
#if (BLUETOOTH_SD == 140)
|
||||
err_code = sd_ble_gap_scan_start(&scan_params, &m_scan_buffer);
|
||||
#else
|
||||
err_code = sd_ble_gap_scan_start(&scan_params);
|
||||
#endif
|
||||
|
||||
if (err_code != NRF_SUCCESS) {
|
||||
mp_raise_OSError_msg_varg(translate("Failed to start scanning, err 0x%04x"), err_code);
|
||||
}
|
||||
|
||||
if (timeout > 0) {
|
||||
mp_hal_delay_ms(timeout);
|
||||
sd_ble_gap_scan_stop();
|
||||
}
|
||||
mp_hal_delay_ms(timeout * 1000);
|
||||
sd_ble_gap_scan_stop();
|
||||
|
||||
// Return list, and don't hang on to it, so it can be GC'd.
|
||||
mp_obj_t entries = self->scan_entries;
|
||||
self->scan_entries = MP_OBJ_NULL;
|
||||
return entries;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -24,16 +25,16 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SCANNER_H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SCANNER_H
|
||||
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_SCANNER_H
|
||||
#define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_SCANNER_H
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
mp_obj_t adv_reports;
|
||||
mp_obj_t scan_entries;
|
||||
uint16_t interval;
|
||||
uint16_t window;
|
||||
} bleio_scanner_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SCANNER_H
|
||||
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_SCANNER_H
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -29,18 +30,43 @@
|
||||
#include "py/runtime.h"
|
||||
#include "common-hal/bleio/__init__.h"
|
||||
#include "common-hal/bleio/Characteristic.h"
|
||||
#include "shared-bindings/bleio/Characteristic.h"
|
||||
#include "shared-bindings/bleio/Service.h"
|
||||
#include "shared-bindings/bleio/Adapter.h"
|
||||
|
||||
void common_hal_bleio_service_construct(bleio_service_obj_t *self) {
|
||||
void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, mp_obj_list_t *characteristic_list, bool is_secondary) {
|
||||
self->device = mp_const_none;
|
||||
self->handle = 0xFFFF;
|
||||
self->uuid = uuid;
|
||||
self->characteristic_list = characteristic_list;
|
||||
self->is_secondary = is_secondary;
|
||||
|
||||
for (size_t characteristic_idx = 0; characteristic_idx < characteristic_list->len; ++characteristic_idx) {
|
||||
bleio_characteristic_obj_t *characteristic =
|
||||
MP_OBJ_TO_PTR(characteristic_list->items[characteristic_idx]);
|
||||
characteristic->service = self;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bleio_uuid_obj_t *common_hal_bleio_service_get_uuid(bleio_service_obj_t *self) {
|
||||
return self->uuid;
|
||||
}
|
||||
|
||||
mp_obj_list_t *common_hal_bleio_service_get_characteristic_list(bleio_service_obj_t *self) {
|
||||
return self->characteristic_list;
|
||||
}
|
||||
|
||||
bool common_hal_bleio_service_get_is_secondary(bleio_service_obj_t *self) {
|
||||
return self->is_secondary;
|
||||
}
|
||||
|
||||
// Call this after the Service has been added to the Peripheral.
|
||||
void common_hal_bleio_service_add_all_characteristics(bleio_service_obj_t *self) {
|
||||
// Add all the characteristics.
|
||||
const mp_obj_list_t *char_list = MP_OBJ_TO_PTR(self->char_list);
|
||||
for (size_t char_idx = 0; char_idx < char_list->len; ++char_idx) {
|
||||
bleio_characteristic_obj_t *characteristic = char_list->items[char_idx];
|
||||
for (size_t characteristic_idx = 0; characteristic_idx < self->characteristic_list->len; ++characteristic_idx) {
|
||||
bleio_characteristic_obj_t *characteristic =
|
||||
MP_OBJ_TO_PTR(self->characteristic_list->items[characteristic_idx]);
|
||||
|
||||
ble_gatts_char_md_t char_md = {
|
||||
.char_props.broadcast = characteristic->props.broadcast,
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -24,21 +25,24 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SERVICE_H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SERVICE_H
|
||||
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_SERVICE_H
|
||||
#define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_SERVICE_H
|
||||
|
||||
#include "py/objlist.h"
|
||||
#include "common-hal/bleio/UUID.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
// Handle for this service.
|
||||
uint16_t handle;
|
||||
bool is_secondary;
|
||||
bleio_uuid_obj_t *uuid;
|
||||
// May be a Peripheral, Central, etc.
|
||||
mp_obj_t *device;
|
||||
mp_obj_t char_list;
|
||||
mp_obj_t device;
|
||||
mp_obj_list_t *characteristic_list;
|
||||
// Range of attribute handles of this service.
|
||||
uint16_t start_handle;
|
||||
uint16_t end_handle;
|
||||
} bleio_service_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SERVICE_H
|
||||
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_SERVICE_H
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -27,6 +28,7 @@
|
||||
|
||||
#include "shared-bindings/bleio/__init__.h"
|
||||
#include "shared-bindings/bleio/Adapter.h"
|
||||
#include "shared-bindings/bleio/Central.h"
|
||||
#include "shared-bindings/bleio/Peripheral.h"
|
||||
#include "common-hal/bleio/__init__.h"
|
||||
|
||||
@ -48,9 +50,8 @@ const super_adapter_obj_t common_hal_bleio_adapter_obj = {
|
||||
gatt_role_t common_hal_bleio_device_get_gatt_role(mp_obj_t device) {
|
||||
if (MP_OBJ_IS_TYPE(device, &bleio_peripheral_type)) {
|
||||
return ((bleio_peripheral_obj_t*) MP_OBJ_TO_PTR(device))->gatt_role;
|
||||
// Does not exist yet.
|
||||
// } else if (MP_OBJ_IS_TYPE(device, &bleio_central_type)) {
|
||||
// return ((bleio_central_obj_t*) MP_OBJ_TO_PTR(device))->gatt_role;
|
||||
} else if (MP_OBJ_IS_TYPE(device, &bleio_central_type)) {
|
||||
return ((bleio_central_obj_t*) MP_OBJ_TO_PTR(device))->gatt_role;
|
||||
} else {
|
||||
return GATT_ROLE_NONE;
|
||||
}
|
||||
@ -59,9 +60,8 @@ gatt_role_t common_hal_bleio_device_get_gatt_role(mp_obj_t device) {
|
||||
uint16_t common_hal_bleio_device_get_conn_handle(mp_obj_t device) {
|
||||
if (MP_OBJ_IS_TYPE(device, &bleio_peripheral_type)) {
|
||||
return ((bleio_peripheral_obj_t*) MP_OBJ_TO_PTR(device))->conn_handle;
|
||||
// Does not exist yet.
|
||||
// } else if (MP_OBJ_IS_TYPE(device, &bleio_central_type)) {
|
||||
// return ((bleio_central_obj_t*) MP_OBJ_TO_PTR(device))->conn_handle;
|
||||
} else if (MP_OBJ_IS_TYPE(device, &bleio_central_type)) {
|
||||
return ((bleio_central_obj_t*) MP_OBJ_TO_PTR(device))->conn_handle;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -24,8 +24,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_COMMON_HAL_BLEIO_INIT_H
|
||||
#define MICROPY_INCLUDED_COMMON_HAL_BLEIO_INIT_H
|
||||
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_INIT_H
|
||||
#define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_INIT_H
|
||||
|
||||
#include "shared-bindings/bleio/__init__.h"
|
||||
#include "shared-bindings/bleio/Adapter.h"
|
||||
@ -39,4 +39,4 @@
|
||||
gatt_role_t common_hal_bleio_device_get_gatt_role(mp_obj_t device);
|
||||
uint16_t common_hal_bleio_device_get_conn_handle(mp_obj_t device);
|
||||
|
||||
#endif // MICROPY_INCLUDED_COMMON_HAL_BLEIO_INIT_H
|
||||
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_INIT_H
|
||||
|
@ -3,9 +3,10 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Sandeep Mistry All right reserved.
|
||||
* Copyright (c) 2017 hathach
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2017 hathach
|
||||
* Copyright (c) 2016 Sandeep Mistry All right reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,9 +1,11 @@
|
||||
/*
|
||||
* SPI Master library for nRF5x.
|
||||
* Copyright (c) 2015 Arduino LLC
|
||||
* Copyright (c) 2016 Sandeep Mistry All right reserved.
|
||||
* Copyright (c) 2017 hathach
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2017 hathach
|
||||
* Copyright (c) 2016 Sandeep Mistry All right reserved.
|
||||
* Copyright (c) 2015 Arduino LLC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2015 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -224,7 +224,7 @@ $(filter $(SRC_PATTERNS), \
|
||||
audioio/AudioOut.c \
|
||||
bleio/__init__.c \
|
||||
bleio/Adapter.c \
|
||||
bleio/Broadcaster.c \
|
||||
bleio/Central.c \
|
||||
bleio/Characteristic.c \
|
||||
bleio/CharacteristicBuffer.c \
|
||||
bleio/Descriptor.c \
|
||||
@ -289,8 +289,6 @@ SRC_BINDINGS_ENUMS += \
|
||||
SRC_BINDINGS_ENUMS += \
|
||||
$(filter $(SRC_PATTERNS), \
|
||||
bleio/Address.c \
|
||||
bleio/AddressType.c \
|
||||
bleio/AdvertisementData.c \
|
||||
bleio/ScanEntry.c \
|
||||
)
|
||||
|
||||
@ -311,6 +309,8 @@ $(filter $(SRC_PATTERNS), \
|
||||
bitbangio/SPI.c \
|
||||
bitbangio/__init__.c \
|
||||
board/__init__.c \
|
||||
bleio/Address.c \
|
||||
bleio/ScanEntry.c \
|
||||
busio/OneWire.c \
|
||||
displayio/Bitmap.c \
|
||||
displayio/ColorConverter.c \
|
||||
|
1
py/obj.h
1
py/obj.h
@ -763,6 +763,7 @@ void mp_obj_tuple_del(mp_obj_t self_in);
|
||||
mp_int_t mp_obj_tuple_hash(mp_obj_t self_in);
|
||||
|
||||
// list
|
||||
mp_obj_t mp_obj_list_clear(mp_obj_t self_in);
|
||||
mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg);
|
||||
mp_obj_t mp_obj_list_remove(mp_obj_t self_in, mp_obj_t value);
|
||||
void mp_obj_list_get(mp_obj_t self_in, size_t *len, mp_obj_t **items);
|
||||
|
@ -340,7 +340,7 @@ mp_obj_t mp_obj_list_sort(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
STATIC mp_obj_t list_clear(mp_obj_t self_in) {
|
||||
mp_obj_t mp_obj_list_clear(mp_obj_t self_in) {
|
||||
mp_check_self(MP_OBJ_IS_TYPE(self_in, &mp_type_list));
|
||||
mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
self->len = 0;
|
||||
@ -418,7 +418,7 @@ STATIC mp_obj_t list_reverse(mp_obj_t self_in) {
|
||||
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(list_append_obj, mp_obj_list_append);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(list_extend_obj, list_extend);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(list_clear_obj, list_clear);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(list_clear_obj, mp_obj_list_clear);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(list_copy_obj, list_copy);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(list_count_obj, list_count);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(list_index_obj, 2, 4, list_index);
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -33,13 +34,6 @@
|
||||
#include "shared-bindings/bleio/Address.h"
|
||||
#include "shared-module/bleio/Address.h"
|
||||
|
||||
#define ADDRESS_BYTE_LEN 12
|
||||
|
||||
STATIC uint8_t xdigit_8b_value(byte nibble1, byte nibble2) {
|
||||
return unichar_xdigit_value(nibble1) | (unichar_xdigit_value(nibble2) << 4);
|
||||
}
|
||||
|
||||
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`Address` -- BLE address
|
||||
@ -48,31 +42,20 @@ STATIC uint8_t xdigit_8b_value(byte nibble1, byte nibble2) {
|
||||
//| Encapsulates the address of a BLE device.
|
||||
//|
|
||||
|
||||
//| .. class:: Address(address)
|
||||
//| .. class:: Address(address, address_type)
|
||||
//|
|
||||
//| Create a new Address object encapsulating the address value.
|
||||
//| The value itself can be one of:
|
||||
//|
|
||||
//| - a `str` value in the format of 'XXXXXXXXXXXX' or 'XX:XX:XX:XX:XX:XX' (12 hex digits)
|
||||
//| - a `bytes` or `bytearray` containing 6 bytes
|
||||
//| - another Address object
|
||||
//|
|
||||
//| :param address: The address to encapsulate
|
||||
//|
|
||||
|
||||
//| .. attribute:: type
|
||||
//|
|
||||
//| The address type. One of:
|
||||
//|
|
||||
//| - `bleio.AddressType.PUBLIC`
|
||||
//| - `bleio.AddressType.RANDOM_STATIC`
|
||||
//| - `bleio.AddressType.RANDOM_PRIVATE_RESOLVABLE`
|
||||
//| - `bleio.AddressType.RANDOM_PRIVATE_NON_RESOLVABLE`
|
||||
//| :param buf address: The address value to encapsulate. A buffer object (bytearray, bytes) of 6 bytes.
|
||||
//| :param int address_type: one of the integer values: `PUBLIC`, `RANDOM_STATIC`,
|
||||
//| `RANDOM_PRIVATE_RESOLVABLE`, or `RANDOM_PRIVATE_NON_RESOLVABLE`.
|
||||
//|
|
||||
STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_address };
|
||||
enum { ARG_address, ARG_address_type };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_address, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_address, MP_ARG_OBJ | MP_ARG_REQUIRED },
|
||||
{ MP_QSTR_address_type, MP_ARG_INT, {.u_int = BLEIO_ADDRESS_TYPE_PUBLIC } },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
@ -80,83 +63,52 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args,
|
||||
|
||||
bleio_address_obj_t *self = m_new_obj(bleio_address_obj_t);
|
||||
self->base.type = &bleio_address_type;
|
||||
self->type = ADDRESS_PUBLIC;
|
||||
|
||||
const mp_obj_t address = args[ARG_address].u_obj;
|
||||
|
||||
if (MP_OBJ_IS_STR(address)) {
|
||||
GET_STR_DATA_LEN(address, str, str_len);
|
||||
|
||||
size_t value_index = 0;
|
||||
int str_index = str_len;
|
||||
bool error = false;
|
||||
|
||||
// Loop until fewer than two characters left.
|
||||
while (str_index >= 1 && value_index < sizeof(self->value)) {
|
||||
if (str[str_index] == ':') {
|
||||
// Skip colon separators.
|
||||
str_index--;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!unichar_isxdigit(str[str_index]) ||
|
||||
!unichar_isxdigit(str[str_index-1])) {
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
self->value[value_index] = xdigit_8b_value(str[str_index],
|
||||
str[str_index-1]);
|
||||
value_index += 1;
|
||||
str_index -= 2;
|
||||
}
|
||||
// Check for correct number of hex digits and no parsing errors.
|
||||
if (error || value_index != ADDRESS_BYTE_LEN || str_index != -1) {
|
||||
mp_raise_ValueError_varg(translate("Address is not %d bytes long or is in wrong format"),
|
||||
ADDRESS_BYTE_LEN);
|
||||
}
|
||||
} else if (MP_OBJ_IS_TYPE(address, &mp_type_bytearray) || MP_OBJ_IS_TYPE(address, &mp_type_bytes)) {
|
||||
mp_buffer_info_t buf_info;
|
||||
mp_get_buffer_raise(address, &buf_info, MP_BUFFER_READ);
|
||||
if (buf_info.len != BLEIO_ADDRESS_BYTES) {
|
||||
mp_raise_ValueError_varg(translate("Address must be %d bytes long"), BLEIO_ADDRESS_BYTES);
|
||||
}
|
||||
|
||||
for (size_t b = 0; b < BLEIO_ADDRESS_BYTES; ++b) {
|
||||
self->value[BLEIO_ADDRESS_BYTES - b - 1] = ((uint8_t*)buf_info.buf)[b];
|
||||
}
|
||||
} else if (MP_OBJ_IS_TYPE(address, &bleio_address_type)) {
|
||||
// deep copy
|
||||
bleio_address_obj_t *other = MP_OBJ_TO_PTR(address);
|
||||
self->type = other->type;
|
||||
memcpy(self->value, other->value, BLEIO_ADDRESS_BYTES);
|
||||
mp_buffer_info_t buf_info;
|
||||
mp_get_buffer_raise(address, &buf_info, MP_BUFFER_READ);
|
||||
if (buf_info.len != NUM_BLEIO_ADDRESS_BYTES) {
|
||||
mp_raise_ValueError_varg(translate("Address must be %d bytes long"), NUM_BLEIO_ADDRESS_BYTES);
|
||||
}
|
||||
|
||||
const mp_int_t address_type = args[ARG_address_type].u_int;
|
||||
if (address_type < BLEIO_ADDRESS_TYPE_MIN || address_type > BLEIO_ADDRESS_TYPE_MAX) {
|
||||
mp_raise_ValueError(translate("Address type out of range"));
|
||||
}
|
||||
|
||||
common_hal_bleio_address_construct(self, buf_info.buf, address_type);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
STATIC void bleio_address_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
//| .. attribute:: address_bytes
|
||||
//|
|
||||
//| The bytes that make up the device address (read-only)
|
||||
//|
|
||||
STATIC mp_obj_t bleio_address_get_address_bytes(mp_obj_t self_in) {
|
||||
bleio_address_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
mp_printf(print, "Address('%02x:%02x:%02x:%02x:%02x:%02x')",
|
||||
self->value[5], self->value[4], self->value[3],
|
||||
self->value[2], self->value[1], self->value[0]);
|
||||
return common_hal_bleio_address_get_address_bytes(self);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(bleio_address_get_address_bytes_obj, bleio_address_get_address_bytes);
|
||||
|
||||
const mp_obj_property_t bleio_address_address_bytes_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = {(mp_obj_t)&bleio_address_get_address_bytes_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| .. attribute:: type
|
||||
//|
|
||||
//| The address type (read-only).
|
||||
//| One of the integer values: `PUBLIC`, `RANDOM_STATIC`,
|
||||
//| `RANDOM_PRIVATE_RESOLVABLE`, or `RANDOM_PRIVATE_NON_RESOLVABLE`.
|
||||
//|
|
||||
STATIC mp_obj_t bleio_address_get_type(mp_obj_t self_in) {
|
||||
bleio_address_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
if (self->type == ADDRESS_PUBLIC) {
|
||||
return (mp_obj_t)&bleio_addresstype_public_obj;
|
||||
} else if (self->type == ADDRESS_RANDOM_STATIC) {
|
||||
return (mp_obj_t)&bleio_addresstype_random_static_obj;
|
||||
} else if (self->type == ADDRESS_RANDOM_PRIVATE_RESOLVABLE) {
|
||||
return (mp_obj_t)&bleio_addresstype_random_private_resolvable_obj;
|
||||
} else if (self->type == ADDRESS_RANDOM_PRIVATE_NON_RESOLVABLE) {
|
||||
return (mp_obj_t)&bleio_addresstype_random_private_non_resolvable_obj;
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
return MP_OBJ_NEW_SMALL_INT(common_hal_bleio_address_get_type(self));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(bleio_address_get_type_obj, bleio_address_get_type);
|
||||
|
||||
@ -167,8 +119,74 @@ const mp_obj_property_t bleio_address_type_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj},
|
||||
};
|
||||
|
||||
//| .. method:: __eq__(other)
|
||||
//|
|
||||
//| Two Address objects are equal if their addresses and address types are equal.
|
||||
//|
|
||||
STATIC mp_obj_t bleio_address_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
|
||||
switch (op) {
|
||||
// Two Addresses are equal if their address bytes and address_type are equal
|
||||
case MP_BINARY_OP_EQUAL:
|
||||
if (MP_OBJ_IS_TYPE(rhs_in, &bleio_address_type)) {
|
||||
bleio_address_obj_t *lhs = MP_OBJ_TO_PTR(lhs_in);
|
||||
bleio_address_obj_t *rhs = MP_OBJ_TO_PTR(rhs_in);
|
||||
return mp_obj_new_bool(
|
||||
mp_obj_equal(common_hal_bleio_address_get_address_bytes(lhs),
|
||||
common_hal_bleio_address_get_address_bytes(rhs)) &&
|
||||
common_hal_bleio_address_get_type(lhs) ==
|
||||
common_hal_bleio_address_get_type(rhs));
|
||||
|
||||
} else {
|
||||
return mp_const_false;
|
||||
}
|
||||
|
||||
default:
|
||||
return MP_OBJ_NULL; // op not supported
|
||||
}
|
||||
}
|
||||
|
||||
STATIC void bleio_address_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
bleio_address_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
if (kind == PRINT_STR) {
|
||||
mp_buffer_info_t buf_info;
|
||||
mp_obj_t address_bytes = common_hal_bleio_address_get_address_bytes(self);
|
||||
mp_get_buffer_raise(address_bytes, &buf_info, MP_BUFFER_READ);
|
||||
|
||||
const uint8_t *buf = (uint8_t *) buf_info.buf;
|
||||
mp_printf(print,
|
||||
"%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]);
|
||||
} else {
|
||||
mp_printf(print, "<Address>");
|
||||
}
|
||||
}
|
||||
|
||||
//| .. data:: PUBLIC
|
||||
//|
|
||||
//| A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits).
|
||||
//|
|
||||
//| .. data:: RANDOM_STATIC
|
||||
//|
|
||||
//| A randomly generated address that does not change often. It may never change or may change after
|
||||
//| a power cycle.
|
||||
//|
|
||||
//| .. data:: RANDOM_PRIVATE_RESOLVABLE
|
||||
//|
|
||||
//| An address that is usable when the peer knows the other device's secret Identity Resolving Key (IRK).
|
||||
//|
|
||||
//| .. data:: RANDOM_PRIVATE_NON_RESOLVABLE
|
||||
//|
|
||||
//| A randomly generated address that changes on every connection.
|
||||
//|
|
||||
STATIC const mp_rom_map_elem_t bleio_address_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_address_bytes), MP_ROM_PTR(&bleio_address_address_bytes_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_type), MP_ROM_PTR(&bleio_address_type_obj) },
|
||||
// These match the BLE_GAP_ADDR_TYPES values used by the nRF library.
|
||||
{ MP_ROM_QSTR(MP_QSTR_PUBLIC), MP_OBJ_NEW_SMALL_INT(0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RANDOM_STATIC), MP_OBJ_NEW_SMALL_INT(1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RANDOM_PRIVATE_RESOLVABLE), MP_OBJ_NEW_SMALL_INT(2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RANDOM_PRIVATE_NON_RESOLVABLE), MP_OBJ_NEW_SMALL_INT(3) },
|
||||
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_address_locals_dict, bleio_address_locals_dict_table);
|
||||
@ -176,7 +194,8 @@ STATIC MP_DEFINE_CONST_DICT(bleio_address_locals_dict, bleio_address_locals_dict
|
||||
const mp_obj_type_t bleio_address_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Address,
|
||||
.print = bleio_address_print,
|
||||
.make_new = bleio_address_make_new,
|
||||
.print = bleio_address_print,
|
||||
.binary_op = bleio_address_binary_op,
|
||||
.locals_dict = (mp_obj_dict_t*)&bleio_address_locals_dict
|
||||
};
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -28,7 +29,20 @@
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADDRESS_H
|
||||
|
||||
#include "py/objtype.h"
|
||||
#include "shared-module/bleio/Address.h"
|
||||
|
||||
#define BLEIO_ADDRESS_TYPE_PUBLIC (0)
|
||||
#define BLEIO_ADDRESS_TYPE_RANDOM_STATIC (1)
|
||||
#define BLEIO_ADDRESS_TYPE_RANDOM_PRIVATE_RESOLVABLE (2)
|
||||
#define BLEIO_ADDRESS_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE (3)
|
||||
|
||||
#define BLEIO_ADDRESS_TYPE_MIN BLEIO_ADDRESS_TYPE_PUBLIC
|
||||
#define BLEIO_ADDRESS_TYPE_MAX BLEIO_ADDRESS_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE
|
||||
|
||||
extern const mp_obj_type_t bleio_address_type;
|
||||
|
||||
extern void common_hal_bleio_address_construct(bleio_address_obj_t *self, uint8_t *bytes, uint8_t address_type);
|
||||
extern mp_obj_t common_hal_bleio_address_get_address_bytes(bleio_address_obj_t *self);
|
||||
extern uint8_t common_hal_bleio_address_get_type(bleio_address_obj_t *self);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADDRESS_H
|
||||
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-bindings/bleio/AddressType.h"
|
||||
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`AddressType` -- defines the type of a BLE address
|
||||
//| =============================================================
|
||||
//|
|
||||
//| .. class:: AddressType()
|
||||
//|
|
||||
//| Enum-like class to define the type of a BLE address, see also `bleio.Address`.
|
||||
//|
|
||||
//| .. data:: PUBLIC
|
||||
//|
|
||||
//| The address is public
|
||||
//|
|
||||
//| .. data:: RANDOM_STATIC
|
||||
//|
|
||||
//| The address is random static
|
||||
//|
|
||||
//| .. data:: RANDOM_PRIVATE_RESOLVABLE
|
||||
//|
|
||||
//| The address is random private resolvable
|
||||
//|
|
||||
//| .. data:: RANDOM_PRIVATE_NON_RESOLVABLE
|
||||
//|
|
||||
//| The address is private non-resolvable
|
||||
//|
|
||||
const mp_obj_type_t bleio_addresstype_type;
|
||||
|
||||
const bleio_addresstype_obj_t bleio_addresstype_public_obj = {
|
||||
{ &bleio_addresstype_type },
|
||||
};
|
||||
|
||||
const bleio_addresstype_obj_t bleio_addresstype_random_static_obj = {
|
||||
{ &bleio_addresstype_type },
|
||||
};
|
||||
|
||||
const bleio_addresstype_obj_t bleio_addresstype_random_private_resolvable_obj = {
|
||||
{ &bleio_addresstype_type },
|
||||
};
|
||||
|
||||
const bleio_addresstype_obj_t bleio_addresstype_random_private_non_resolvable_obj = {
|
||||
{ &bleio_addresstype_type },
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t bleio_addresstype_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_PUBLIC), MP_ROM_PTR(&bleio_addresstype_public_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RANDOM_STATIC), MP_ROM_PTR(&bleio_addresstype_random_static_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RANDOM_PRIVATE_RESOLVABLE), MP_ROM_PTR(&bleio_addresstype_random_private_resolvable_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RANDOM_PRIVATE_NON_RESOLVABLE), MP_ROM_PTR(&bleio_addresstype_random_private_non_resolvable_obj) },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_addresstype_locals_dict, bleio_addresstype_locals_dict_table);
|
||||
|
||||
STATIC void bleio_addresstype_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
qstr type = MP_QSTR_PUBLIC;
|
||||
|
||||
if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&bleio_addresstype_random_static_obj)) {
|
||||
type = MP_QSTR_RANDOM_STATIC;
|
||||
} else if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&bleio_addresstype_random_private_resolvable_obj)) {
|
||||
type = MP_QSTR_RANDOM_PRIVATE_RESOLVABLE;
|
||||
} else if (MP_OBJ_TO_PTR(self_in) == MP_ROM_PTR(&bleio_addresstype_random_private_non_resolvable_obj)) {
|
||||
type = MP_QSTR_RANDOM_PRIVATE_NON_RESOLVABLE;
|
||||
}
|
||||
|
||||
mp_printf(print, "%q.%q.%q", MP_QSTR_bleio, MP_QSTR_AddressType, type);
|
||||
}
|
||||
|
||||
const mp_obj_type_t bleio_addresstype_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_AddressType,
|
||||
.print = bleio_addresstype_print,
|
||||
.locals_dict = (mp_obj_t)&bleio_addresstype_locals_dict,
|
||||
};
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADDRESSTYPE_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADDRESSTYPE_H
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
typedef enum {
|
||||
ADDRESS_PUBLIC,
|
||||
ADDRESS_RANDOM_STATIC,
|
||||
ADDRESS_RANDOM_PRIVATE_RESOLVABLE,
|
||||
ADDRESS_RANDOM_PRIVATE_NON_RESOLVABLE
|
||||
} bleio_address_type_t;
|
||||
|
||||
extern const mp_obj_type_t bleio_addresstype_type;
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
} bleio_addresstype_obj_t;
|
||||
|
||||
extern const bleio_addresstype_obj_t bleio_addresstype_public_obj;
|
||||
extern const bleio_addresstype_obj_t bleio_addresstype_random_static_obj;
|
||||
extern const bleio_addresstype_obj_t bleio_addresstype_random_private_resolvable_obj;
|
||||
extern const bleio_addresstype_obj_t bleio_addresstype_random_private_non_resolvable_obj;
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADDRESSTYPE_H
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "shared-module/bleio/AdvertisementData.h"
|
||||
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`AdvertisementData` -- data used during BLE advertising
|
||||
//| ==============================================================
|
||||
//|
|
||||
//| Represents the data to be broadcast during BLE advertising.
|
||||
//|
|
||||
|
||||
STATIC const mp_rom_map_elem_t bleio_advertisementdata_locals_dict_table[] = {
|
||||
// Static variables
|
||||
{ MP_ROM_QSTR(MP_QSTR_FLAGS), MP_ROM_INT(AdFlags) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_INCOMPLETE_LIST_OF_16BIT_SERVICE_CLASS_UUIDS), MP_ROM_INT(AdIncompleteListOf16BitServiceClassUUIDs) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_COMPLETE_LIST_OF_16BIT_SERVICE_CLASS_UUIDS), MP_ROM_INT(AdCompleteListOf16BitServiceClassUUIDs) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_INCOMPLETE_LIST_OF_32BIT_SERVICE_CLASS_UUIDS), MP_ROM_INT(AdIncompleteListOf32BitServiceClassUUIDs) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_COMPLETE_LIST_OF_32BIT_SERVICE_CLASS_UUIDS), MP_ROM_INT(AdCompleteListOf32BitServiceClassUUIDs) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_INCOMPLETE_LIST_OF_128BIT_SERVICE_CLASS_UUIDS), MP_ROM_INT(AdIncompleteListOf128BitServiceClassUUIDs) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_COMPLETE_LIST_OF_128BIT_SERVICE_CLASS_UUIDS), MP_ROM_INT(AdCompleteListOf128BitServiceClassUUIDs) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SHORTENED_LOCAL_NAME), MP_ROM_INT(AdShortenedLocalName) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_COMPLETE_LOCAL_NAME), MP_ROM_INT(AdCompleteLocalName) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX_POWER_LEVEL), MP_ROM_INT(AdTxPowerLevel) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CLASS_OF_DEVICE), MP_ROM_INT(AdClassOfDevice) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SIMPLE_PAIRING_HASH_C), MP_ROM_INT(AdSimplePairingHashC) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SIMPLE_PAIRING_RANDOMIZER_R), MP_ROM_INT(AdSimplePairingRandomizerR) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SECURITY_MANAGER_TK_VALUE), MP_ROM_INT(AdSecurityManagerTKValue) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SECURITY_MANAGER_OOB_FLAGS), MP_ROM_INT(AdSecurityManagerOOBFlags) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SLAVE_CONNECTION_INTERVAL_RANGE), MP_ROM_INT(AdSlaveConnectionIntervalRange) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LIST_OF_16BIT_SERVICE_SOLICITATION_UUIDS), MP_ROM_INT(AdListOf16BitServiceSolicitationUUIDs) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LIST_OF_128BIT_SERVICE_SOLICITATION_UUIDS), MP_ROM_INT(AdListOf128BitServiceSolicitationUUIDs) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SERVICE_DATA), MP_ROM_INT(AdServiceData) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PUBLIC_TARGET_ADDRESS), MP_ROM_INT(AdPublicTargetAddress) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RANDOM_TARGET_ADDRESS), MP_ROM_INT(AdRandomTargetAddress) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_APPEARANCE), MP_ROM_INT(AdAppearance) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ADVERTISING_INTERNAL), MP_ROM_INT(AdAdvertisingInterval) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LE_BLUETOOTH_DEVICE_ADDRESS), MP_ROM_INT(AdLEBluetoothDeviceAddress) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LE_ROLE), MP_ROM_INT(AdLERole) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SIMPLE_PAIRING_HASH_C256), MP_ROM_INT(AdSimplePairingHashC256) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SIMPLE_PAIRING_RANDOMIZER_R256), MP_ROM_INT(AdSimplePairingRandomizerR256) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LIST_OF_32BIT_SERVICE_SOLICITATION_UUIDS), MP_ROM_INT(AdListOf32BitServiceSolicitationUUIDs) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SERVICE_DATA_32BIT_UUID), MP_ROM_INT(AdServiceData32BitUUID) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SERVICE_DATA_128BIT_UUID), MP_ROM_INT(AdServiceData128BitUUID) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE), MP_ROM_INT(AdLESecureConnectionsConfirmationValue) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LE_SECURE_CONNECTIONS_RANDOM_VALUE), MP_ROM_INT(AdLESecureConnectionsRandomValue) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_URI), MP_ROM_INT(AdURI) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_INDOOR_POSITIONING), MP_ROM_INT(AdIndoorPositioning) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TRANSPORT_DISCOVERY_DATA), MP_ROM_INT(AdTransportDiscoveryData) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LE_SUPPORTED_FEATURES), MP_ROM_INT(AdLESupportedFeatures) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CHANNEL_MAP_UPDATE_INDICATION), MP_ROM_INT(AdChannelMapUpdateIndication) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PB_ADV), MP_ROM_INT(AdPBADV) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MESH_MESSAGE), MP_ROM_INT(AdMeshMessage) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MESH_BEACON), MP_ROM_INT(AdMeshBeacon) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_3D_INFORMATION_DATA), MP_ROM_INT(Ad3DInformationData) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MANUFACTURER_SPECIFIC_DATA), MP_ROM_INT(AdManufacturerSpecificData) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_advertisementdata_locals_dict, bleio_advertisementdata_locals_dict_table);
|
||||
|
||||
const mp_obj_type_t bleio_advertisementdata_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_AdvertisementData,
|
||||
.locals_dict = (mp_obj_dict_t*)&bleio_advertisementdata_locals_dict
|
||||
};
|
@ -1,132 +0,0 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "ble_drv.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "shared-bindings/bleio/Broadcaster.h"
|
||||
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`Broadcaster` -- Broadcast advertising packets.
|
||||
//| =========================================================
|
||||
//|
|
||||
//| Implement a BLE broadcaster which sends data in advertising packets and does not connect.
|
||||
//| Used for beacons and other one-way data transmission.
|
||||
//|
|
||||
//| Usage::
|
||||
//|
|
||||
//| import bleio
|
||||
//| import time
|
||||
//|
|
||||
//| # Broadcast once a second.
|
||||
//| broadcaster = bleio.Broadcaster(interval=1)
|
||||
//| data = 0
|
||||
//| # Broadcast a byte of data that's incremented once a minute
|
||||
//| while True:
|
||||
//| # data is an entire advertising data packet, starting with flags.
|
||||
//| broadcaster.start_advertising(data)
|
||||
//| time.sleep(60)
|
||||
//| data += 1
|
||||
//|
|
||||
//| .. class:: Broadcaster(interval=1)
|
||||
//|
|
||||
//| Create a new Broadcaster object.
|
||||
|
||||
//| :param float interval: how often to broadcast
|
||||
//|
|
||||
|
||||
STATIC mp_obj_t bleio_broadcaster_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_interval };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_interval, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(1)} },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
mp_float_t interval = mp_obj_get_float(args[ARG_interval].u_obj);
|
||||
|
||||
bleio_broadcaster_obj_t *self = m_new_obj(bleio_broadcaster_obj_t);
|
||||
self->base.type = &bleio_broadcaster_type;
|
||||
// Do port-specific initialization. interval will be validated.
|
||||
common_hal_bleio_broadcaster_construct(self, interval);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
//| .. method:: start_advertising(data)
|
||||
//|
|
||||
//| Start advertising using the given data packet.
|
||||
//|
|
||||
//| :param buf data: advertising data packet, starting with advertising data flags (0x01)
|
||||
//|
|
||||
STATIC mp_obj_t bleio_broadcaster_start_advertising(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
bleio_broadcaster_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
|
||||
enum { ARG_data };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(args[ARG_data].u_obj, &bufinfo, MP_BUFFER_READ);
|
||||
|
||||
common_hal_bleio_broadcaster_start_advertising(self, &bufinfo);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_broadcaster_start_advertising_obj, 0, bleio_broadcaster_start_advertising);
|
||||
|
||||
//| .. method:: stop_advertising()
|
||||
//|
|
||||
//| Stop sending advertising packets.
|
||||
STATIC mp_obj_t bleio_broadcaster_stop_advertising(mp_obj_t self_in) {
|
||||
bleio_broadcaster_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
common_hal_bleio_broadcaster_stop_advertising(self);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_broadcaster_stop_advertising_obj, bleio_broadcaster_stop_advertising);
|
||||
|
||||
STATIC const mp_rom_map_elem_t bleio_broadcaster_locals_dict_table[] = {
|
||||
// Methods
|
||||
{ MP_ROM_QSTR(MP_QSTR_start_advertising), MP_ROM_PTR(&bleio_broadcaster_start_advertising_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_stop_advertising), MP_ROM_PTR(&bleio_broadcaster_stop_advertising_obj) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_broadcaster_locals_dict, bleio_broadcaster_locals_dict_table);
|
||||
|
||||
const mp_obj_type_t bleio_broadcaster_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Broadcaster,
|
||||
.make_new = bleio_broadcaster_make_new,
|
||||
.locals_dict = (mp_obj_dict_t*)&bleio_broadcaster_locals_dict
|
||||
};
|
199
shared-bindings/bleio/Central.c
Normal file
199
shared-bindings/bleio/Central.c
Normal file
@ -0,0 +1,199 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ble_drv.h"
|
||||
#include "py/objarray.h"
|
||||
#include "py/objproperty.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/bleio/Adapter.h"
|
||||
#include "shared-bindings/bleio/Address.h"
|
||||
#include "shared-bindings/bleio/Characteristic.h"
|
||||
#include "shared-bindings/bleio/Central.h"
|
||||
#include "shared-bindings/bleio/Service.h"
|
||||
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`Central` -- A BLE central device
|
||||
//| =========================================================
|
||||
//|
|
||||
//| Implement a BLE central, which runs locally. Can connect to a given address.
|
||||
//|
|
||||
//| Usage::
|
||||
//|
|
||||
//| import bleio
|
||||
//|
|
||||
//| scanner = bleio.Scanner()
|
||||
//| entries = scanner.scan(2.5)
|
||||
//|
|
||||
//| my_entry = None
|
||||
//| for entry in entries:
|
||||
//| if entry.name is not None and entry.name == 'MyPeripheral':
|
||||
//| my_entry = entry
|
||||
//| break
|
||||
//|
|
||||
//| central = bleio.Central(my_entry.address)
|
||||
//| central.connect(10.0) # timeout after 10 seconds
|
||||
//|
|
||||
|
||||
//| .. class:: Central()
|
||||
//|
|
||||
//| Create a new Central object.
|
||||
//|
|
||||
STATIC mp_obj_t bleio_central_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 0, 0, false);
|
||||
|
||||
bleio_central_obj_t *self = m_new_obj(bleio_central_obj_t);
|
||||
self->base.type = &bleio_central_type;
|
||||
|
||||
common_hal_bleio_central_construct(self);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
//| .. method:: connect(address, timeout, *, service_uuids=None)
|
||||
//| Attempts a connection to the remote peripheral. If the connection is successful,
|
||||
//| Do BLE discovery for the listed services, to find their handles and characteristics.
|
||||
//| The attribute `remote_services` will contain a list of all discovered services.
|
||||
//|
|
||||
//| :param bleio.Address address: The address of the peripheral to connect to
|
||||
//| :param float/int timeout: Try to connect for timeout seconds.
|
||||
//| :param iterable service_uuids_whitelist: an iterable of :py:class:~`UUID` objects for the services
|
||||
//| provided by the peripheral that you want to use.
|
||||
//| The peripheral may provide more services, but services not listed are ignored.
|
||||
//| If a service in service_uuids is not found during discovery, it will not
|
||||
//| appear in `remote_services`.
|
||||
//|
|
||||
//| If service_uuids_whitelist is None, then all services will undergo discovery, which can be slow.
|
||||
//|
|
||||
//| If the service UUID is 128-bit, or its characteristic UUID's are 128-bit, you
|
||||
//| you must have already created a :py:class:~`UUID` object for that UUID in order for the
|
||||
//| service or characteristic to be discovered. (This restriction may be lifted in the future.)
|
||||
//|
|
||||
STATIC mp_obj_t bleio_central_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
bleio_central_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
|
||||
enum { ARG_address, ARG_timeout, ARG_service_uuids_whitelist };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_address, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_timeout, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_service_uuids_whitelist, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
if (!MP_OBJ_IS_TYPE(args[ARG_address].u_obj, &bleio_address_type)) {
|
||||
mp_raise_ValueError(translate("Expected an Address"));
|
||||
}
|
||||
|
||||
bleio_address_obj_t *address = MP_OBJ_TO_PTR(args[ARG_address].u_obj);
|
||||
mp_float_t timeout = mp_obj_get_float(args[ARG_timeout].u_obj);
|
||||
|
||||
// common_hal_bleio_central_connect() will validate that services is an iterable or None.
|
||||
common_hal_bleio_central_connect(self, address, timeout, args[ARG_service_uuids_whitelist].u_obj);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_central_connect_obj, 3, bleio_central_connect);
|
||||
|
||||
|
||||
//| .. method:: disconnect()
|
||||
//|
|
||||
//| Disconnects from the remote peripheral.
|
||||
//|
|
||||
STATIC mp_obj_t bleio_central_disconnect(mp_obj_t self_in) {
|
||||
bleio_central_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
common_hal_bleio_central_disconnect(self);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_central_disconnect_obj, bleio_central_disconnect);
|
||||
|
||||
//| .. attribute:: connected
|
||||
//|
|
||||
//| True if connected to a remove peripheral.
|
||||
//|
|
||||
STATIC mp_obj_t bleio_central_get_connected(mp_obj_t self_in) {
|
||||
bleio_central_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return mp_obj_new_bool(common_hal_bleio_central_get_connected(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_central_get_connected_obj, bleio_central_get_connected);
|
||||
|
||||
const mp_obj_property_t bleio_central_connected_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bleio_central_get_connected_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
|
||||
//| .. attribute:: remote_services (read-only)
|
||||
//|
|
||||
//| A tuple of services provided by the remote peripheral.
|
||||
//| If the Central is not connected, an empty tuple will be returned.
|
||||
//|
|
||||
STATIC mp_obj_t bleio_central_get_remote_services(mp_obj_t self_in) {
|
||||
bleio_central_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
// Return list as a tuple so user won't be able to change it.
|
||||
mp_obj_list_t *service_list = common_hal_bleio_central_get_remote_services(self);
|
||||
return mp_obj_new_tuple(service_list->len, service_list->items);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_central_get_remote_services_obj, bleio_central_get_remote_services);
|
||||
|
||||
const mp_obj_property_t bleio_central_remote_services_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bleio_central_get_remote_services_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t bleio_central_locals_dict_table[] = {
|
||||
// Methods
|
||||
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&bleio_central_connect_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&bleio_central_disconnect_obj) },
|
||||
|
||||
// Properties
|
||||
{ MP_ROM_QSTR(MP_QSTR_connected), MP_ROM_PTR(&bleio_central_connected_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_remote_services), MP_ROM_PTR(&bleio_central_remote_services_obj) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_central_locals_dict, bleio_central_locals_dict_table);
|
||||
|
||||
const mp_obj_type_t bleio_central_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Central,
|
||||
.make_new = bleio_central_make_new,
|
||||
.locals_dict = (mp_obj_dict_t*)&bleio_central_locals_dict
|
||||
};
|
@ -3,8 +3,8 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -25,23 +25,18 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_COMMON_HAL_BLEIO_BROADCASTER_H
|
||||
#define MICROPY_INCLUDED_COMMON_HAL_BLEIO_BROADCASTER_H
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CENTRAL_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CENTRAL_H
|
||||
|
||||
#include "ble.h"
|
||||
#include "common-hal/bleio/Central.h"
|
||||
#include "common-hal/bleio/Service.h"
|
||||
|
||||
#include "shared-module/bleio/__init__.h"
|
||||
#include "shared-module/bleio/Address.h"
|
||||
extern const mp_obj_type_t bleio_central_type;
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
// In seconds.
|
||||
mp_float_t interval;
|
||||
// The advertising data buffer is held by us, not by the SD, so we must
|
||||
// maintain it and not change it. If we need to change its contents during advertising,
|
||||
// there are tricks to get the SD to notice (see DevZone - TBS).
|
||||
uint8_t adv_data[BLE_GAP_ADV_SET_DATA_SIZE_MAX];
|
||||
extern void common_hal_bleio_central_construct(bleio_central_obj_t *self);
|
||||
extern void common_hal_bleio_central_connect(bleio_central_obj_t *self, bleio_address_obj_t *address, mp_float_t timeout, mp_obj_t service_uuids);
|
||||
extern void common_hal_bleio_central_disconnect(bleio_central_obj_t *self);
|
||||
extern bool common_hal_bleio_central_get_connected(bleio_central_obj_t *self);
|
||||
extern mp_obj_list_t *common_hal_bleio_central_get_remote_services(bleio_central_obj_t *self);
|
||||
|
||||
} bleio_broadcaster_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_COMMON_HAL_BLEIO_BROADCASTER_H
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CENTRAL_H
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -68,15 +69,15 @@ STATIC mp_obj_t bleio_characteristic_make_new(const mp_obj_type_t *type, size_t
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
const mp_obj_t uuid = args[ARG_uuid].u_obj;
|
||||
const mp_obj_t uuid_obj = args[ARG_uuid].u_obj;
|
||||
|
||||
if (!MP_OBJ_IS_TYPE(uuid, &bleio_uuid_type)) {
|
||||
if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) {
|
||||
mp_raise_ValueError(translate("Expected a UUID"));
|
||||
}
|
||||
bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj);
|
||||
|
||||
bleio_characteristic_obj_t *self = m_new_obj(bleio_characteristic_obj_t);
|
||||
self->base.type = &bleio_characteristic_type;
|
||||
self->uuid = MP_OBJ_TO_PTR(uuid);
|
||||
|
||||
bleio_characteristic_properties_t properties;
|
||||
|
||||
@ -87,7 +88,8 @@ STATIC mp_obj_t bleio_characteristic_make_new(const mp_obj_type_t *type, size_t
|
||||
properties.write = args[ARG_write].u_bool;
|
||||
properties.write_no_response = args[ARG_write_no_response].u_bool;
|
||||
|
||||
common_hal_bleio_characteristic_construct(self, uuid, properties);
|
||||
// Initialize, with an empty descriptor list.
|
||||
common_hal_bleio_characteristic_construct(self, uuid, properties, mp_obj_new_list(0, NULL));
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
@ -99,7 +101,7 @@ STATIC mp_obj_t bleio_characteristic_make_new(const mp_obj_type_t *type, size_t
|
||||
STATIC mp_obj_t bleio_characteristic_get_broadcast(mp_obj_t self_in) {
|
||||
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return mp_obj_new_bool(self->props.broadcast);
|
||||
return mp_obj_new_bool(common_hal_bleio_characteristic_get_properties(self).broadcast);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_get_broadcast_obj, bleio_characteristic_get_broadcast);
|
||||
|
||||
@ -117,7 +119,7 @@ const mp_obj_property_t bleio_characteristic_broadcast_obj = {
|
||||
STATIC mp_obj_t bleio_characteristic_get_indicate(mp_obj_t self_in) {
|
||||
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return mp_obj_new_bool(self->props.indicate);
|
||||
return mp_obj_new_bool(common_hal_bleio_characteristic_get_properties(self).indicate);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_get_indicate_obj, bleio_characteristic_get_indicate);
|
||||
|
||||
@ -136,7 +138,7 @@ const mp_obj_property_t bleio_characteristic_indicate_obj = {
|
||||
STATIC mp_obj_t bleio_characteristic_get_notify(mp_obj_t self_in) {
|
||||
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return mp_obj_new_bool(self->props.notify);
|
||||
return mp_obj_new_bool(common_hal_bleio_characteristic_get_properties(self).notify);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_get_notify_obj, bleio_characteristic_get_notify);
|
||||
|
||||
@ -154,7 +156,7 @@ const mp_obj_property_t bleio_characteristic_notify_obj = {
|
||||
STATIC mp_obj_t bleio_characteristic_get_read(mp_obj_t self_in) {
|
||||
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return mp_obj_new_bool(self->props.read);
|
||||
return mp_obj_new_bool(common_hal_bleio_characteristic_get_properties(self).read);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_get_read_obj, bleio_characteristic_get_read);
|
||||
|
||||
@ -172,7 +174,7 @@ const mp_obj_property_t bleio_characteristic_read_obj = {
|
||||
STATIC mp_obj_t bleio_characteristic_get_write(mp_obj_t self_in) {
|
||||
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return mp_obj_new_bool(self->props.write);
|
||||
return mp_obj_new_bool(common_hal_bleio_characteristic_get_properties(self).write);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_get_write_obj, bleio_characteristic_get_write);
|
||||
|
||||
@ -190,7 +192,7 @@ const mp_obj_property_t bleio_characteristic_write_obj = {
|
||||
STATIC mp_obj_t bleio_characteristic_get_write_no_response(mp_obj_t self_in) {
|
||||
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return mp_obj_new_bool(self->props.write_no_response);
|
||||
return mp_obj_new_bool(common_hal_bleio_characteristic_get_properties(self).write_no_response);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_get_write_no_response_obj, bleio_characteristic_get_write_no_response);
|
||||
|
||||
@ -204,11 +206,13 @@ const mp_obj_property_t bleio_characteristic_write_no_response_obj = {
|
||||
//| .. attribute:: uuid
|
||||
//|
|
||||
//| The UUID of this characteristic. (read-only)
|
||||
//| Will be ``None`` if the 128-bit UUID for this characteristic is not known.
|
||||
//|
|
||||
STATIC mp_obj_t bleio_characteristic_get_uuid(mp_obj_t self_in) {
|
||||
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self->uuid);
|
||||
bleio_uuid_obj_t *uuid = common_hal_bleio_characteristic_get_uuid(self);
|
||||
return uuid ? MP_OBJ_FROM_PTR(uuid) : mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_get_uuid_obj, bleio_characteristic_get_uuid);
|
||||
|
||||
@ -228,9 +232,7 @@ const mp_obj_property_t bleio_characteristic_uuid_obj = {
|
||||
STATIC mp_obj_t bleio_characteristic_get_value(mp_obj_t self_in) {
|
||||
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
common_hal_bleio_characteristic_get_value(self);
|
||||
|
||||
return self->value_data;
|
||||
return common_hal_bleio_characteristic_get_value(self);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_get_value_obj, bleio_characteristic_get_value);
|
||||
|
||||
@ -253,22 +255,80 @@ const mp_obj_property_t bleio_characteristic_value_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
//| .. attribute:: descriptors
|
||||
//|
|
||||
//| A tuple of `bleio.Descriptor` that describe this characteristic. (read-only)
|
||||
//|
|
||||
STATIC mp_obj_t bleio_characteristic_get_descriptors(mp_obj_t self_in) {
|
||||
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
// Return list as a tuple so user won't be able to change it.
|
||||
mp_obj_list_t *char_list = common_hal_bleio_characteristic_get_descriptor_list(self);
|
||||
return mp_obj_new_tuple(char_list->len, char_list->items);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_characteristic_get_descriptors_obj, bleio_characteristic_get_descriptors);
|
||||
|
||||
const mp_obj_property_t bleio_characteristic_descriptors_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bleio_characteristic_get_descriptors_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
//| .. method:: set_cccd(*, notify=False, indicate=False)
|
||||
//|
|
||||
//| Set the remote characteristic's CCCD to enable or disable notification and indication.
|
||||
//|
|
||||
//| :param bool notify: True if Characteristic should receive notifications of remote writes
|
||||
//| :param float indicate: True if Characteristic should receive indications of remote writes
|
||||
//|
|
||||
STATIC mp_obj_t bleio_characteristic_set_cccd(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
|
||||
enum { ARG_notify, ARG_indicate };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_notify, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
|
||||
{ MP_QSTR_indicate, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
common_hal_bleio_characteristic_set_cccd(self, args[ARG_notify].u_bool, args[ARG_indicate].u_bool);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_characteristic_set_cccd_obj, 1, bleio_characteristic_set_cccd);
|
||||
|
||||
|
||||
STATIC const mp_rom_map_elem_t bleio_characteristic_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_broadcast), MP_ROM_PTR(&bleio_characteristic_broadcast_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_descriptors), MP_ROM_PTR(&bleio_characteristic_descriptors_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_indicate), MP_ROM_PTR(&bleio_characteristic_indicate_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_notify), MP_ROM_PTR(&bleio_characteristic_notify_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&bleio_characteristic_read_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_set_cccd), MP_ROM_PTR(&bleio_characteristic_set_cccd_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_uuid), MP_ROM_PTR(&bleio_characteristic_uuid_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&bleio_characteristic_value_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&bleio_characteristic_write_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_write_no_response), MP_ROM_PTR(&bleio_characteristic_write_no_response_obj) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_characteristic_locals_dict, bleio_characteristic_locals_dict_table);
|
||||
|
||||
STATIC void bleio_characteristic_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
if (self->uuid) {
|
||||
mp_printf(print, "Characteristic(");
|
||||
bleio_uuid_print(print, MP_OBJ_FROM_PTR(self->uuid), kind);
|
||||
mp_printf(print, ")");
|
||||
} else {
|
||||
mp_printf(print, "<Characteristic with Unregistered UUID>");
|
||||
}
|
||||
}
|
||||
|
||||
const mp_obj_type_t bleio_characteristic_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Characteristic,
|
||||
.make_new = bleio_characteristic_make_new,
|
||||
.print = bleio_characteristic_print,
|
||||
.locals_dict = (mp_obj_dict_t*)&bleio_characteristic_locals_dict
|
||||
};
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -27,12 +28,17 @@
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTIC_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTIC_H
|
||||
|
||||
#include "shared-module/bleio/Characteristic.h"
|
||||
#include "common-hal/bleio/Characteristic.h"
|
||||
|
||||
extern const mp_obj_type_t bleio_characteristic_type;
|
||||
|
||||
extern void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props);
|
||||
extern void common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *self);
|
||||
extern void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, bleio_uuid_obj_t *uuid, bleio_characteristic_properties_t props, mp_obj_list_t *descriptor_list);
|
||||
extern mp_obj_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *self);
|
||||
extern void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, mp_buffer_info_t *bufinfo);
|
||||
extern bleio_characteristic_properties_t common_hal_bleio_characteristic_get_properties(bleio_characteristic_obj_t *self);
|
||||
extern bleio_uuid_obj_t *common_hal_bleio_characteristic_get_uuid(bleio_characteristic_obj_t *self);
|
||||
extern mp_obj_list_t *common_hal_bleio_characteristic_get_descriptor_list(bleio_characteristic_obj_t *self);
|
||||
extern void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self, bool notify, bool indicate);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTIC_H
|
||||
|
@ -49,10 +49,13 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self
|
||||
//|
|
||||
//| .. class:: CharacteristicBuffer(characteristic, *, timeout=1, buffer_size=64)
|
||||
//|
|
||||
//| Create a new Characteristic object identified by the specified UUID.
|
||||
//| Monitor the given Characteristic. Each time a new value is written to the Characteristic
|
||||
//| add the newly-written bytes to a FIFO buffer.
|
||||
//|
|
||||
//| :param bleio.Characteristic characteristic: The characteristic to monitor
|
||||
//| :param int timeout: the timeout in seconds to wait for the first character and between subsequent characters.//|
|
||||
//| :param bleio.Characteristic characteristic: The Characteristic to monitor.
|
||||
//| It may be a local Characteristic provided by a Peripheral Service, or a remote Characteristic
|
||||
//| in a remote Service that a Central has connected to.
|
||||
//| :param int timeout: the timeout in seconds to wait for the first character and between subsequent characters.
|
||||
//| :param int buffer_size: Size of ring buffer that stores incoming data coming from client.
|
||||
//| Must be >= 1.
|
||||
//|
|
||||
@ -85,9 +88,8 @@ STATIC mp_obj_t bleio_characteristic_buffer_make_new(const mp_obj_type_t *type,
|
||||
|
||||
bleio_characteristic_buffer_obj_t *self = m_new_obj(bleio_characteristic_buffer_obj_t);
|
||||
self->base.type = &bleio_characteristic_buffer_type;
|
||||
self->characteristic = MP_OBJ_TO_PTR(characteristic);
|
||||
|
||||
common_hal_bleio_characteristic_buffer_construct(self, self->characteristic, timeout, buffer_size);
|
||||
common_hal_bleio_characteristic_buffer_construct(self, MP_OBJ_TO_PTR(characteristic), timeout, buffer_size);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -30,27 +31,6 @@
|
||||
#include "shared-bindings/bleio/Descriptor.h"
|
||||
#include "shared-bindings/bleio/UUID.h"
|
||||
|
||||
enum {
|
||||
DescriptorUuidCharacteristicExtendedProperties = 0x2900,
|
||||
DescriptorUuidCharacteristicUserDescription = 0x2901,
|
||||
DescriptorUuidClientCharacteristicConfiguration = 0x2902,
|
||||
DescriptorUuidServerCharacteristicConfiguration = 0x2903,
|
||||
DescriptorUuidCharacteristicPresentationFormat = 0x2904,
|
||||
DescriptorUuidCharacteristicAggregateFormat = 0x2905,
|
||||
DescriptorUuidValidRange = 0x2906,
|
||||
DescriptorUuidExternalReportReference = 0x2907,
|
||||
DescriptorUuidReportReference = 0x2908,
|
||||
DescriptorUuidNumberOfDigitals = 0x2909,
|
||||
DescriptorUuidValueTriggerSetting = 0x290A,
|
||||
DescriptorUuidEnvironmentalSensingConfiguration = 0x290B,
|
||||
DescriptorUuidEnvironmentalSensingMeasurement = 0x290C,
|
||||
DescriptorUuidEnvironmentalSensingTriggerSetting = 0x290D,
|
||||
DescriptorUuidTimeTriggerSetting = 0x290E,
|
||||
};
|
||||
|
||||
// Work-in-progress: orphaned for now.
|
||||
//| :orphan:
|
||||
//|
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`Descriptor` -- BLE descriptor
|
||||
@ -113,7 +93,9 @@ const mp_obj_property_t bleio_descriptor_handle_obj = {
|
||||
|
||||
STATIC mp_obj_t bleio_descriptor_get_uuid(mp_obj_t self_in) {
|
||||
bleio_descriptor_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
return common_hal_bleio_descriptor_get_uuid(self);
|
||||
|
||||
bleio_uuid_obj_t *uuid = common_hal_bleio_descriptor_get_uuid(self);
|
||||
return uuid ? MP_OBJ_FROM_PTR(uuid) : mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(bleio_descriptor_get_uuid_obj, bleio_descriptor_get_uuid);
|
||||
|
||||
@ -130,28 +112,69 @@ STATIC const mp_rom_map_elem_t bleio_descriptor_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_uuid), MP_ROM_PTR(&bleio_descriptor_uuid_obj) },
|
||||
|
||||
// Static variables
|
||||
{ MP_ROM_QSTR(MP_QSTR_CHARACTERISTIC_EXTENDED_PROPERTIES), MP_ROM_INT(DescriptorUuidCharacteristicExtendedProperties) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CHARACTERISTIC_USER_DESCRIPTION), MP_ROM_INT(DescriptorUuidCharacteristicUserDescription) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CLIENT_CHARACTERISTIC_CONFIGURATION), MP_ROM_INT(DescriptorUuidClientCharacteristicConfiguration) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SERVER_CHARACTERISTIC_CONFIGURATION), MP_ROM_INT(DescriptorUuidServerCharacteristicConfiguration) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CHARACTERISTIC_PRESENTATION_FORMAT), MP_ROM_INT(DescriptorUuidCharacteristicPresentationFormat) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CHARACTERISTIC_AGGREGATE_FORMAT), MP_ROM_INT(DescriptorUuidCharacteristicAggregateFormat) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VALID_RANGE), MP_ROM_INT(DescriptorUuidValidRange) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_EXTERNAL_REPORT_REFERENCE), MP_ROM_INT(DescriptorUuidExternalReportReference) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_REPORT_REFERENCE), MP_ROM_INT(DescriptorUuidReportReference) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_NUMBER_OF_DIGITALS), MP_ROM_INT(DescriptorUuidNumberOfDigitals) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VALUE_TRIGGER_SETTING), MP_ROM_INT(DescriptorUuidValueTriggerSetting) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ENVIRONMENTAL_SENSING_CONFIGURATION), MP_ROM_INT(DescriptorUuidEnvironmentalSensingConfiguration) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ENVIRONMENTAL_SENSING_MEASUREMENT ), MP_ROM_INT(DescriptorUuidEnvironmentalSensingMeasurement) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ENVIRONMENTAL_SENSING_TRIGGER_SETTING), MP_ROM_INT(DescriptorUuidEnvironmentalSensingTriggerSetting) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TIME_TRIGGER_SETTING), MP_ROM_INT(DescriptorUuidTimeTriggerSetting) }
|
||||
{ MP_ROM_QSTR(MP_QSTR_CHARACTERISTIC_EXTENDED_PROPERTIES),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_CHARACTERISTIC_EXTENDED_PROPERTIES) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_CHARACTERISTIC_USER_DESCRIPTION),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_CHARACTERISTIC_USER_DESCRIPTION) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_CLIENT_CHARACTERISTIC_CONFIGURATION),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SERVER_CHARACTERISTIC_CONFIGURATION),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_SERVER_CHARACTERISTIC_CONFIGURATION) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_CHARACTERISTIC_PRESENTATION_FORMAT),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_CHARACTERISTIC_PRESENTATION_FORMAT) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_CHARACTERISTIC_AGGREGATE_FORMAT),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_CHARACTERISTIC_AGGREGATE_FORMAT) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_VALID_RANGE),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_VALID_RANGE) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_EXTERNAL_REPORT_REFERENCE),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_EXTERNAL_REPORT_REFERENCE) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_REPORT_REFERENCE),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_REPORT_REFERENCE) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_NUMBER_OF_DIGITALS),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_NUMBER_OF_DIGITALS) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_VALUE_TRIGGER_SETTING),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_VALUE_TRIGGER_SETTING) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_ENVIRONMENTAL_SENSING_CONFIGURATION),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_ENVIRONMENTAL_SENSING_CONFIGURATION) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_ENVIRONMENTAL_SENSING_MEASUREMENT ),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_ENVIRONMENTAL_SENSING_MEASUREMENT) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_ENVIRONMENTAL_SENSING_TRIGGER_SETTING),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_ENVIRONMENTAL_SENSING_TRIGGER_SETTING) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_TIME_TRIGGER_SETTING),
|
||||
MP_ROM_INT(DESCRIPTOR_UUID_TIME_TRIGGER_SETTING) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_descriptor_locals_dict, bleio_descriptor_locals_dict_table);
|
||||
|
||||
STATIC void bleio_descriptor_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
bleio_descriptor_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
if (self->uuid) {
|
||||
mp_printf(print, "Descriptor(");
|
||||
bleio_uuid_print(print, MP_OBJ_FROM_PTR(self->uuid), kind);
|
||||
mp_printf(print, ")");
|
||||
} else {
|
||||
mp_printf(print, "<Descriptor with Unregistered UUID>");
|
||||
}
|
||||
}
|
||||
|
||||
const mp_obj_type_t bleio_descriptor_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Descriptor,
|
||||
.make_new = bleio_descriptor_make_new,
|
||||
.print = bleio_descriptor_print,
|
||||
.locals_dict = (mp_obj_dict_t*)&bleio_descriptor_locals_dict
|
||||
};
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -30,6 +31,24 @@
|
||||
#include "common-hal/bleio/Descriptor.h"
|
||||
#include "common-hal/bleio/UUID.h"
|
||||
|
||||
enum {
|
||||
DESCRIPTOR_UUID_CHARACTERISTIC_EXTENDED_PROPERTIES = 0x2900,
|
||||
DESCRIPTOR_UUID_CHARACTERISTIC_USER_DESCRIPTION = 0x2901,
|
||||
DESCRIPTOR_UUID_CLIENT_CHARACTERISTIC_CONFIGURATION = 0x2902,
|
||||
DESCRIPTOR_UUID_SERVER_CHARACTERISTIC_CONFIGURATION = 0x2903,
|
||||
DESCRIPTOR_UUID_CHARACTERISTIC_PRESENTATION_FORMAT = 0x2904,
|
||||
DESCRIPTOR_UUID_CHARACTERISTIC_AGGREGATE_FORMAT = 0x2905,
|
||||
DESCRIPTOR_UUID_VALID_RANGE = 0x2906,
|
||||
DESCRIPTOR_UUID_EXTERNAL_REPORT_REFERENCE = 0x2907,
|
||||
DESCRIPTOR_UUID_REPORT_REFERENCE = 0x2908,
|
||||
DESCRIPTOR_UUID_NUMBER_OF_DIGITALS = 0x2909,
|
||||
DESCRIPTOR_UUID_VALUE_TRIGGER_SETTING = 0x290A,
|
||||
DESCRIPTOR_UUID_ENVIRONMENTAL_SENSING_CONFIGURATION = 0x290B,
|
||||
DESCRIPTOR_UUID_ENVIRONMENTAL_SENSING_MEASUREMENT = 0x290C,
|
||||
DESCRIPTOR_UUID_ENVIRONMENTAL_SENSING_TRIGGER_SETTING = 0x290D,
|
||||
DESCRIPTOR_UUID_TIME_TRIGGER_SETTING = 0x290E,
|
||||
};
|
||||
|
||||
extern const mp_obj_type_t bleio_descriptor_type;
|
||||
|
||||
extern void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_uuid_obj_t *uuid);
|
||||
|
@ -1,363 +0,0 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ble_drv.h"
|
||||
#include "py/objarray.h"
|
||||
#include "py/objproperty.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/bleio/Adapter.h"
|
||||
#include "shared-bindings/bleio/AddressType.h"
|
||||
#include "shared-bindings/bleio/Characteristic.h"
|
||||
#include "shared-bindings/bleio/Device.h"
|
||||
#include "shared-bindings/bleio/Service.h"
|
||||
#include "shared-bindings/bleio/UUID.h"
|
||||
#include "shared-module/bleio/AdvertisementData.h"
|
||||
#include "shared-module/bleio/Device.h"
|
||||
#include "shared-module/bleio/ScanEntry.h"
|
||||
|
||||
// Work-in-progress: orphaned for now.
|
||||
//| :orphan:
|
||||
//|
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`Device` -- BLE device
|
||||
//| =========================================================
|
||||
//|
|
||||
//| **IGNORE ``Device`` and all its documentation.
|
||||
//| It is being replaced by `Peripheral` and other classes.**
|
||||
//|
|
||||
//| Provides access a to BLE device, either in a Peripheral or Central role.
|
||||
//| When a device is created without any parameter passed to the constructor,
|
||||
//| it will be set to the Peripheral role. If a address is passed, the device
|
||||
//| will be a Central. For a Peripheral you can set the `name`, add services
|
||||
//| via `add_service` and then start and stop advertising via `bleio.Device.start_advertising`
|
||||
//| and `bleio.Device.stop_advertising`. For the Central, you can `bleio.Device.connect` and `bleio.Device.disconnect`
|
||||
//| to the device, once a connection is established, the device's services can
|
||||
//| be accessed using `bleio.Device.services`.
|
||||
//|
|
||||
//| Usage::
|
||||
//|
|
||||
//| import bleio
|
||||
//|
|
||||
//| # Peripheral
|
||||
//| periph = bleio.Device()
|
||||
//|
|
||||
//| serv = bleio.Service(bleio.UUID(0x180f))
|
||||
//| p.add_service(serv)
|
||||
//|
|
||||
//| chara = bleio.Characteristic(bleio.UUID(0x2919))
|
||||
//| chara.read = True
|
||||
//| chara.notify = True
|
||||
//| serv.add_characteristic(chara)
|
||||
//|
|
||||
//| periph.start_advertising()
|
||||
//|
|
||||
//| # Central
|
||||
//| scanner = bleio.Scanner()
|
||||
//| entries = scanner.scan(2500)
|
||||
//|
|
||||
//| my_entry = None
|
||||
//| for entry in entries:
|
||||
//| if entry.name is not None and entry.name == 'MyDevice':
|
||||
//| my_entry = entry
|
||||
//| break
|
||||
//|
|
||||
//| central = bleio.Device(my_entry.address)
|
||||
//| central.connect()
|
||||
//|
|
||||
|
||||
//| .. class:: Device(address=None, scan_entry=None)
|
||||
//|
|
||||
//| Create a new Device object. If the `address` or :py:data:`scan_entry` parameters are not `None`,
|
||||
//| the role is set to Central, otherwise it's set to Peripheral.
|
||||
//|
|
||||
//| :param bleio.Address address: The address of the device to connect to
|
||||
//| :param bleio.ScanEntry scan_entry: The scan entry returned from `bleio.Scanner`
|
||||
//|
|
||||
|
||||
//| .. attribute:: name
|
||||
//|
|
||||
//| For the Peripheral role, this property can be used to read and write the device's name.
|
||||
//| For the Central role, this property will equal the name of the remote device, if one was
|
||||
//| advertised by the device. In the Central role this property is read-only.
|
||||
//|
|
||||
|
||||
//| .. attribute:: services
|
||||
//|
|
||||
//| A `list` of `bleio.Service` that are offered by this device. (read-only)
|
||||
//| For a Peripheral device, this list will contain services added using `add_service`,
|
||||
//| for a Central, this list will be empty until a connection is established, at which point
|
||||
//| it will be filled with the remote device's services.
|
||||
//|
|
||||
|
||||
//| .. method:: add_service(service)
|
||||
//|
|
||||
//| Appends the :py:data:`service` to the list of this devices's services.
|
||||
//| This method can only be called for Peripheral devices.
|
||||
//|
|
||||
//| :param bleio.Service service: the service to append
|
||||
//|
|
||||
|
||||
//| .. method:: connect()
|
||||
//|
|
||||
//| Attempts a connection to the remote device. If the connection is successful,
|
||||
//| the device's services are available via `services`.
|
||||
//| This method can only be called for Central devices.
|
||||
//|
|
||||
|
||||
//| .. method:: disconnect()
|
||||
//|
|
||||
//| Disconnects from the remote device.
|
||||
//| This method can only be called for Central devices.
|
||||
//|
|
||||
|
||||
//| .. method:: start_advertising(connectable=True)
|
||||
//|
|
||||
//| Starts advertising the device. The device's name and
|
||||
//| services are put into the advertisement packets.
|
||||
//| If :py:data:`connectable` is `True` then other devices are allowed to conncet to this device.
|
||||
//| This method can only be called for Peripheral devices.
|
||||
//|
|
||||
|
||||
//| .. method:: stop_advertising()
|
||||
//|
|
||||
//| Disconnects from the remote device.
|
||||
//| This method can only be called for Peripheral devices.
|
||||
//|
|
||||
|
||||
// TODO: Add unique MAC address part to name
|
||||
static const char default_name[] = "CIRCUITPY";
|
||||
|
||||
STATIC void bleio_device_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
bleio_device_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
mp_printf(print, "Device(role: %s)", self->is_peripheral ? "Peripheral" : "Central");
|
||||
}
|
||||
|
||||
STATIC mp_obj_t bleio_device_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *pos_args) {
|
||||
mp_arg_check_num(n_args, n_kw, 0, 1, true);
|
||||
bleio_device_obj_t *self = m_new_obj(bleio_device_obj_t);
|
||||
self->base.type = &bleio_device_type;
|
||||
self->service_list = mp_obj_new_list(0, NULL);
|
||||
self->notif_handler = mp_const_none;
|
||||
self->conn_handler = mp_const_none;
|
||||
self->conn_handle = 0xFFFF;
|
||||
self->is_peripheral = true;
|
||||
|
||||
mp_map_t kw_args;
|
||||
mp_map_init_fixed_table(&kw_args, n_kw, pos_args + n_args);
|
||||
|
||||
enum { ARG_address, ARG_scan_entry };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_address, MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_scan_entry, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, &kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
const mp_obj_t address_obj = args[ARG_address].u_obj;
|
||||
const mp_obj_t scan_entry_obj = args[ARG_scan_entry].u_obj;
|
||||
|
||||
if (address_obj != mp_const_none) {
|
||||
bleio_address_obj_t *address = MP_OBJ_TO_PTR(address_obj);
|
||||
|
||||
self->is_peripheral = false;
|
||||
self->address.type = address->type;
|
||||
memcpy(self->address.value, address->value, BLEIO_ADDRESS_BYTES);
|
||||
} else if (scan_entry_obj != mp_const_none) {
|
||||
bleio_scanentry_obj_t *scan_entry = MP_OBJ_TO_PTR(scan_entry_obj);
|
||||
|
||||
self->is_peripheral = false;
|
||||
self->address.type = scan_entry->address.type;
|
||||
memcpy(self->address.value, scan_entry->address.value, BLEIO_ADDRESS_BYTES);
|
||||
} else {
|
||||
self->name = mp_obj_new_str(default_name, strlen(default_name));
|
||||
common_hal_bleio_adapter_get_address(&self->address);
|
||||
}
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t bleio_device_add_service(mp_obj_t self_in, mp_obj_t service_in) {
|
||||
bleio_device_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
bleio_service_obj_t *service = MP_OBJ_TO_PTR(service_in);
|
||||
|
||||
if (!self->is_peripheral) {
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
|
||||
translate("Can't add services in Central mode")));
|
||||
}
|
||||
|
||||
service->device = self;
|
||||
|
||||
mp_obj_list_append(self->service_list, service);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_device_add_service_obj, bleio_device_add_service);
|
||||
|
||||
STATIC mp_obj_t bleio_device_connect(mp_obj_t self_in) {
|
||||
bleio_device_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
if (self->is_peripheral) {
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
|
||||
translate("Can't connect in Peripheral mode")));
|
||||
}
|
||||
|
||||
common_hal_bleio_device_connect(self);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_device_connect_obj, bleio_device_connect);
|
||||
|
||||
STATIC mp_obj_t bleio_device_disconnect(mp_obj_t self_in) {
|
||||
bleio_device_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
common_hal_bleio_device_disconnect(self);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_device_disconnect_obj, bleio_device_disconnect);
|
||||
|
||||
STATIC mp_obj_t bleio_device_get_name(mp_obj_t self_in) {
|
||||
bleio_device_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return self->name;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(bleio_device_get_name_obj, bleio_device_get_name);
|
||||
|
||||
static mp_obj_t bleio_device_set_name(mp_obj_t self_in, mp_obj_t value) {
|
||||
bleio_device_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
if (!self->is_peripheral) {
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
|
||||
translate("Can't change the name in Central mode")));
|
||||
}
|
||||
|
||||
self->name = value;
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_device_set_name_obj, bleio_device_set_name);
|
||||
|
||||
const mp_obj_property_t bleio_device_name_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bleio_device_get_name_obj,
|
||||
(mp_obj_t)&bleio_device_set_name_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
STATIC mp_obj_t bleio_device_start_advertising(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
bleio_device_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
|
||||
if (!self->is_peripheral) {
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
|
||||
translate("Can't advertise in Central mode")));
|
||||
}
|
||||
|
||||
enum { ARG_connectable, ARG_data };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_connectable, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} },
|
||||
{ MP_QSTR_data, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
mp_buffer_info_t bufinfo = { 0 };
|
||||
if (args[ARG_data].u_obj != mp_const_none) {
|
||||
mp_get_buffer_raise(args[ARG_data].u_obj, &bufinfo, MP_BUFFER_READ);
|
||||
}
|
||||
|
||||
const mp_obj_list_t *service_list = MP_OBJ_TO_PTR(self->service_list);
|
||||
for (size_t i = 0; i < service_list->len; ++i) {
|
||||
bleio_service_obj_t *service = service_list->items[i];
|
||||
if (service->handle == 0xFFFF) {
|
||||
common_hal_bleio_device_add_service(self, service);
|
||||
}
|
||||
}
|
||||
|
||||
common_hal_bleio_device_start_advertising(self, args[ARG_connectable].u_bool, &bufinfo);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_device_start_advertising_obj, 0, bleio_device_start_advertising);
|
||||
|
||||
STATIC mp_obj_t bleio_device_stop_advertising(mp_obj_t self_in) {
|
||||
bleio_device_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
if (!self->is_peripheral) {
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
|
||||
translate("Can't advertise in Central mode")));
|
||||
}
|
||||
|
||||
common_hal_bleio_device_stop_advertising(self);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_device_stop_advertising_obj, bleio_device_stop_advertising);
|
||||
|
||||
STATIC mp_obj_t bleio_device_get_services(mp_obj_t self_in) {
|
||||
bleio_device_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return self->service_list;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_device_get_services_obj, bleio_device_get_services);
|
||||
|
||||
const mp_obj_property_t bleio_device_services_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bleio_device_get_services_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t bleio_device_locals_dict_table[] = {
|
||||
// Methods
|
||||
{ MP_ROM_QSTR(MP_QSTR_add_service), MP_ROM_PTR(&bleio_device_add_service_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&bleio_device_connect_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&bleio_device_disconnect_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_start_advertising), MP_ROM_PTR(&bleio_device_start_advertising_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_stop_advertising), MP_ROM_PTR(&bleio_device_stop_advertising_obj) },
|
||||
|
||||
// Properties
|
||||
{ MP_ROM_QSTR(MP_QSTR_name), MP_ROM_PTR(&bleio_device_name_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_services), MP_ROM_PTR(&bleio_device_services_obj) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_device_locals_dict, bleio_device_locals_dict_table);
|
||||
|
||||
const mp_obj_type_t bleio_device_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Device,
|
||||
.print = bleio_device_print,
|
||||
.make_new = bleio_device_make_new,
|
||||
.locals_dict = (mp_obj_dict_t*)&bleio_device_locals_dict
|
||||
};
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_DEVICE_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_DEVICE_H
|
||||
|
||||
#include "shared-module/bleio/AdvertisementData.h"
|
||||
#include "shared-module/bleio/Device.h"
|
||||
#include "shared-module/bleio/Service.h"
|
||||
|
||||
extern const mp_obj_type_t bleio_device_type;
|
||||
|
||||
extern void common_hal_bleio_device_add_service(bleio_device_obj_t *device, bleio_service_obj_t *service);
|
||||
extern void common_hal_bleio_device_start_advertising(bleio_device_obj_t *device, bool connectable, mp_buffer_info_t *raw_data);
|
||||
extern void common_hal_bleio_device_stop_advertising(bleio_device_obj_t *device);
|
||||
extern void common_hal_bleio_device_connect(bleio_device_obj_t *device);
|
||||
extern void common_hal_bleio_device_disconnect(bleio_device_obj_t *device);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_DEVICE_H
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -35,19 +36,22 @@
|
||||
#include "py/runtime.h"
|
||||
|
||||
#include "shared-bindings/bleio/Adapter.h"
|
||||
#include "shared-bindings/bleio/AddressType.h"
|
||||
#include "shared-bindings/bleio/Characteristic.h"
|
||||
#include "shared-bindings/bleio/Peripheral.h"
|
||||
#include "shared-bindings/bleio/Service.h"
|
||||
#include "shared-bindings/bleio/UUID.h"
|
||||
#include "shared-module/bleio/AdvertisementData.h"
|
||||
#include "shared-module/bleio/ScanEntry.h"
|
||||
|
||||
#include "common-hal/bleio/Peripheral.h"
|
||||
|
||||
// TODO: Add unique MAC address part to name
|
||||
static const char default_name[] = "CIRCUITPY";
|
||||
|
||||
#define ADV_INTERVAL_DEFAULT (1.0f)
|
||||
#define ADV_INTERVAL_MIN (0.0020f)
|
||||
#define ADV_INTERVAL_MIN_STRING "0.0020"
|
||||
#define ADV_INTERVAL_MAX (10.24f)
|
||||
#define ADV_INTERVAL_MAX_STRING "10.24"
|
||||
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`Peripheral` -- A BLE peripheral device
|
||||
@ -59,6 +63,7 @@ static const char default_name[] = "CIRCUITPY";
|
||||
//| Usage::
|
||||
//|
|
||||
//| import bleio
|
||||
//| from adafruit_ble.advertising import ServerAdvertisement
|
||||
//|
|
||||
//| # Create a Characteristic.
|
||||
//| chara = bleio.Characteristic(bleio.UUID(0x2919), read=True, notify=True)
|
||||
@ -68,25 +73,27 @@ static const char default_name[] = "CIRCUITPY";
|
||||
//|
|
||||
//| # Create a peripheral and start it up.
|
||||
//| periph = bleio.Peripheral([service])
|
||||
//| periph.start_advertising()
|
||||
//| adv = ServerAdvertisement(periph)
|
||||
//| periph.start_advertising(adv.advertising_data_bytes, adv.scan_response_bytes)
|
||||
//|
|
||||
//| while not periph.connected:
|
||||
//| # Wait for connection.
|
||||
//| pass
|
||||
//|
|
||||
//| .. class:: Peripheral(services, *, name='CIRCUITPY')
|
||||
//| .. class:: Peripheral(services=(), \*, name='CIRCUITPY')
|
||||
//|
|
||||
//| Create a new Peripheral object.
|
||||
|
||||
//| :param iterable services: the Service objects representing services available from this peripheral.
|
||||
//| :param str name: The name used when advertising this peripheral
|
||||
//|
|
||||
|
||||
//| :param iterable services: the Service objects representing services available from this peripheral, if any.
|
||||
//| A non-connectable peripheral will have no services.
|
||||
//| :param str name: The name used when advertising this peripheral. Use ``None`` when a name is not needed,
|
||||
//| such as when the peripheral is a beacon
|
||||
//|
|
||||
STATIC mp_obj_t bleio_peripheral_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_services, ARG_name };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_services, MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_name, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_services, MP_ARG_OBJ, {.u_obj = mp_const_empty_tuple} },
|
||||
{ MP_QSTR_name, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL} },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
@ -95,32 +102,33 @@ STATIC mp_obj_t bleio_peripheral_make_new(const mp_obj_type_t *type, size_t n_ar
|
||||
// If services is not an iterable, an exception will be thrown.
|
||||
mp_obj_iter_buf_t iter_buf;
|
||||
mp_obj_t iterable = mp_getiter(args[ARG_services].u_obj, &iter_buf);
|
||||
mp_obj_t service;
|
||||
|
||||
bleio_peripheral_obj_t *self = m_new_obj(bleio_peripheral_obj_t);
|
||||
self->base.type = &bleio_peripheral_type;
|
||||
self->service_list = mp_obj_new_list(0, NULL);
|
||||
self->notif_handler = mp_const_none;
|
||||
|
||||
// Copy the services list and validate its items.
|
||||
mp_obj_t service_list_obj = mp_obj_new_list(0, NULL);
|
||||
mp_obj_list_t *service_list = MP_OBJ_FROM_PTR(service_list_obj);
|
||||
|
||||
mp_obj_t service;
|
||||
while ((service = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
|
||||
if (!MP_OBJ_IS_TYPE(service, &bleio_service_type)) {
|
||||
mp_raise_ValueError(translate("services includes an object that is not a Service"));
|
||||
mp_raise_ValueError(translate("non-Service found in services"));
|
||||
}
|
||||
bleio_service_obj_t *service_ptr = MP_OBJ_TO_PTR(service);
|
||||
service_ptr->device = MP_OBJ_FROM_PTR(self);
|
||||
mp_obj_list_append(self->service_list, service);
|
||||
mp_obj_list_append(service_list, service);
|
||||
}
|
||||
|
||||
const mp_obj_t name = args[ARG_name].u_obj;
|
||||
if (name == mp_const_none) {
|
||||
self->name = mp_obj_new_str(default_name, strlen(default_name));
|
||||
mp_obj_t name_str;
|
||||
if (name == MP_OBJ_NULL || name == mp_const_none) {
|
||||
name_str = mp_obj_new_str(default_name, strlen(default_name));
|
||||
} else if (MP_OBJ_IS_STR(name)) {
|
||||
self->name = name;
|
||||
name_str = name;
|
||||
} else {
|
||||
mp_raise_ValueError(translate("name must be a string"));
|
||||
}
|
||||
|
||||
// Do port-specific initialization.
|
||||
common_hal_bleio_peripheral_construct(self);
|
||||
common_hal_bleio_peripheral_construct(self, service_list, name_str);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
@ -132,7 +140,6 @@ STATIC mp_obj_t bleio_peripheral_make_new(const mp_obj_type_t *type, size_t n_ar
|
||||
STATIC mp_obj_t bleio_peripheral_get_connected(mp_obj_t self_in) {
|
||||
bleio_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
// Return list as a tuple so user won't be able to change it.
|
||||
return mp_obj_new_bool(common_hal_bleio_peripheral_get_connected(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_peripheral_get_connected_obj, bleio_peripheral_get_connected);
|
||||
@ -151,7 +158,7 @@ const mp_obj_property_t bleio_peripheral_connected_obj = {
|
||||
STATIC mp_obj_t bleio_peripheral_get_services(mp_obj_t self_in) {
|
||||
bleio_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
// Return list as a tuple so user won't be able to change it.
|
||||
mp_obj_list_t *service_list = MP_OBJ_TO_PTR(self->service_list);
|
||||
mp_obj_list_t *service_list = common_hal_bleio_peripheral_get_service_list(self);
|
||||
return mp_obj_new_tuple(service_list->len, service_list->items);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_peripheral_get_services_obj, bleio_peripheral_get_services);
|
||||
@ -170,7 +177,7 @@ const mp_obj_property_t bleio_peripheral_services_obj = {
|
||||
STATIC mp_obj_t bleio_peripheral_get_name(mp_obj_t self_in) {
|
||||
bleio_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return self->name;
|
||||
return common_hal_bleio_peripheral_get_name(self);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(bleio_peripheral_get_name_obj, bleio_peripheral_get_name);
|
||||
|
||||
@ -181,37 +188,55 @@ const mp_obj_property_t bleio_peripheral_name_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
//| .. method:: start_advertising(*, connectable=True, data=None)
|
||||
//| .. method:: start_advertising(data, *, scan_response=None, connectable=True, interval=1)
|
||||
//|
|
||||
//| Starts advertising the peripheral. The peripheral's name and
|
||||
//| services are included in the advertisement packets.
|
||||
//|
|
||||
//| :param buf data: advertising data packet bytes
|
||||
//| :param buf scan_response: scan response data packet bytes. ``None`` if no scan response is needed.
|
||||
//| :param bool connectable: If `True` then other devices are allowed to connect to this peripheral.
|
||||
//| :param buf data: If `None`, advertise the services passed to this Peripheral when it was created.
|
||||
//| If not `None`, then send the bytes in ``data`` as the advertising packet.
|
||||
//| :param float interval: advertising interval, in seconds
|
||||
//|
|
||||
STATIC mp_obj_t bleio_peripheral_start_advertising(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
bleio_peripheral_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
|
||||
enum { ARG_connectable, ARG_data };
|
||||
enum { ARG_data, ARG_scan_response, ARG_connectable, ARG_interval };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_scan_response, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_connectable, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} },
|
||||
{ MP_QSTR_data, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_interval, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
};
|
||||
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
mp_buffer_info_t bufinfo = { 0 };
|
||||
if (args[ARG_data].u_obj != mp_const_none) {
|
||||
mp_get_buffer_raise(args[ARG_data].u_obj, &bufinfo, MP_BUFFER_READ);
|
||||
mp_buffer_info_t data_bufinfo;
|
||||
mp_get_buffer_raise(args[ARG_data].u_obj, &data_bufinfo, MP_BUFFER_READ);
|
||||
|
||||
// Pass an empty buffer if scan_response not provided.
|
||||
mp_buffer_info_t scan_response_bufinfo = { 0 };
|
||||
if (args[ARG_scan_response].u_obj != mp_const_none) {
|
||||
mp_get_buffer_raise(args[ARG_scan_response].u_obj, &scan_response_bufinfo, MP_BUFFER_READ);
|
||||
}
|
||||
|
||||
common_hal_bleio_peripheral_start_advertising(self, args[ARG_connectable].u_bool, &bufinfo);
|
||||
if (args[ARG_interval].u_obj == MP_OBJ_NULL) {
|
||||
args[ARG_interval].u_obj = mp_obj_new_float(1.0F);
|
||||
}
|
||||
|
||||
const mp_float_t interval = mp_obj_float_get(args[ARG_interval].u_obj);
|
||||
if (interval < ADV_INTERVAL_MIN || interval > ADV_INTERVAL_MAX) {
|
||||
mp_raise_ValueError_varg(translate("interval must be in range %s-%s"),
|
||||
ADV_INTERVAL_MIN_STRING, ADV_INTERVAL_MAX_STRING);
|
||||
}
|
||||
|
||||
common_hal_bleio_peripheral_start_advertising(self, args[ARG_connectable].u_bool, interval,
|
||||
&data_bufinfo, &scan_response_bufinfo);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_peripheral_start_advertising_obj, 0, bleio_peripheral_start_advertising);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_peripheral_start_advertising_obj, 2, bleio_peripheral_start_advertising);
|
||||
|
||||
//| .. method:: stop_advertising()
|
||||
//|
|
||||
@ -225,10 +250,26 @@ STATIC mp_obj_t bleio_peripheral_stop_advertising(mp_obj_t self_in) {
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_peripheral_stop_advertising_obj, bleio_peripheral_stop_advertising);
|
||||
|
||||
//| .. method:: disconnect()
|
||||
//|
|
||||
//| Disconnects from the remote central.
|
||||
//| Normally the central initiates a disconnection. Use this only
|
||||
//| if necessary for your application.
|
||||
//|
|
||||
STATIC mp_obj_t bleio_peripheral_disconnect(mp_obj_t self_in) {
|
||||
bleio_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
common_hal_bleio_peripheral_disconnect(self);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_peripheral_disconnect_obj, bleio_peripheral_disconnect);
|
||||
|
||||
STATIC const mp_rom_map_elem_t bleio_peripheral_locals_dict_table[] = {
|
||||
// Methods
|
||||
{ MP_ROM_QSTR(MP_QSTR_start_advertising), MP_ROM_PTR(&bleio_peripheral_start_advertising_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_stop_advertising), MP_ROM_PTR(&bleio_peripheral_stop_advertising_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_disconnect), MP_ROM_PTR(&bleio_peripheral_disconnect_obj) },
|
||||
|
||||
// Properties
|
||||
{ MP_ROM_QSTR(MP_QSTR_connected), MP_ROM_PTR(&bleio_peripheral_connected_obj) },
|
||||
|
@ -3,8 +3,8 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -32,9 +32,12 @@
|
||||
|
||||
extern const mp_obj_type_t bleio_peripheral_type;
|
||||
|
||||
extern void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self);
|
||||
extern void common_hal_bleio_peripheral_construct(bleio_peripheral_obj_t *self, mp_obj_list_t *service_list, mp_obj_t name);
|
||||
extern mp_obj_list_t *common_hal_bleio_peripheral_get_service_list(bleio_peripheral_obj_t *self);
|
||||
extern bool common_hal_bleio_peripheral_get_connected(bleio_peripheral_obj_t *self);
|
||||
extern void common_hal_bleio_peripheral_start_advertising(bleio_peripheral_obj_t *device, bool connectable, mp_buffer_info_t *raw_data);
|
||||
extern mp_obj_t common_hal_bleio_peripheral_get_name(bleio_peripheral_obj_t *self);
|
||||
extern void common_hal_bleio_peripheral_start_advertising(bleio_peripheral_obj_t *device, bool connectable, float interval, mp_buffer_info_t *advertising_data_bufinfo, mp_buffer_info_t *scan_response_data_bufinfo);
|
||||
extern void common_hal_bleio_peripheral_stop_advertising(bleio_peripheral_obj_t *device);
|
||||
extern void common_hal_bleio_peripheral_disconnect(bleio_peripheral_obj_t *device);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_PERIPHERAL_H
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
*
|
||||
@ -27,278 +28,78 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "py/objarray.h"
|
||||
#include "py/objproperty.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/objtuple.h"
|
||||
#include "shared-bindings/bleio/Address.h"
|
||||
#include "shared-bindings/bleio/ScanEntry.h"
|
||||
#include "shared-bindings/bleio/UUID.h"
|
||||
#include "shared-module/bleio/AdvertisementData.h"
|
||||
#include "shared-module/bleio/ScanEntry.h"
|
||||
|
||||
// Work-in-progress: orphaned for now.
|
||||
//| :orphan:
|
||||
//|
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`ScanEntry` -- BLE scan response entry
|
||||
//| =========================================================
|
||||
//|
|
||||
//| Encapsulates information about a device that was received as a
|
||||
//| response to a BLE scan request.
|
||||
//| response to a BLE scan request. This object may only be created
|
||||
//| by a `bleio.Scanner`: it has no user-visible constructor.
|
||||
//|
|
||||
|
||||
//| .. attribute:: address
|
||||
//|
|
||||
//| The address of the device. (read-only)
|
||||
//| This attribute is of type `bleio.Address`.
|
||||
//| The address of the device (read-only), of type `bleio.Address`.
|
||||
//|
|
||||
|
||||
//| .. attribute:: manufacturer_specific_data
|
||||
//|
|
||||
//| The manufacturer-specific data present in the advertisement packet. (read-only)
|
||||
//|
|
||||
|
||||
//| .. attribute:: name
|
||||
//|
|
||||
//| The name of the device. (read-only)
|
||||
//| This attribute might be `None` if the data was missing from the advertisement packet.
|
||||
//|
|
||||
|
||||
//| .. attribute:: raw_data
|
||||
//|
|
||||
//| All the advertisement data present in the packet. (read-only)
|
||||
//|
|
||||
|
||||
//| .. attribute:: rssi
|
||||
//|
|
||||
//| The signal strength of the device at the time of the scan. (read-only)
|
||||
//|
|
||||
|
||||
//| .. attribute:: service_uuids
|
||||
//|
|
||||
//| The address of the device. (read-only)
|
||||
//| This attribute is a list of `bleio.UUID`.
|
||||
//| This attribute might be empty or incomplete, depending on the advertisement packet.
|
||||
//| Currently only 16-bit UUIDS are listed.
|
||||
//|
|
||||
|
||||
//| .. attribute:: tx_power_level
|
||||
//|
|
||||
//| The transmit power level of the device. (read-only)
|
||||
//| This attribute might be `None` if the data was missing from the advertisement packet.
|
||||
//|
|
||||
static uint8_t find_data_item(mp_obj_array_t *data_in, uint8_t type, uint8_t **data_out) {
|
||||
uint16_t i = 0;
|
||||
while (i < data_in->len) {
|
||||
const uint8_t item_len = ((uint8_t*)data_in->items)[i];
|
||||
const uint8_t item_type = ((uint8_t*)data_in->items)[i + 1];
|
||||
if (item_type != type) {
|
||||
i += (item_len + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
*data_out = &((uint8_t*)data_in->items)[i + 2];
|
||||
|
||||
return item_len;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
STATIC mp_obj_t scanentry_get_name(mp_obj_t self_in);
|
||||
|
||||
STATIC void bleio_scanentry_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
bleio_scanentry_obj_t *self = (bleio_scanentry_obj_t *)self_in;
|
||||
mp_printf(print, "ScanEntry(address: %02x:%02x:%02x:%02x:%02x:%02x",
|
||||
self->address.value[5], self->address.value[4], self->address.value[3],
|
||||
self->address.value[1], self->address.value[1], self->address.value[0]);
|
||||
|
||||
const mp_obj_t name_obj = scanentry_get_name(self_in);
|
||||
if (name_obj != mp_const_none) {
|
||||
mp_obj_str_t *str = MP_OBJ_TO_PTR(name_obj);
|
||||
mp_printf(print, " name: %s", str->data);
|
||||
}
|
||||
|
||||
mp_print_str(print, ")");
|
||||
}
|
||||
|
||||
STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) {
|
||||
bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
mp_obj_t obj = bleio_address_type.make_new(&bleio_address_type, 1, 0, (mp_obj_t)&mp_const_none_obj);
|
||||
bleio_address_obj_t *address = MP_OBJ_TO_PTR(obj);
|
||||
|
||||
address->type = self->address.type;
|
||||
memcpy(address->value, self->address.value, BLEIO_ADDRESS_BYTES);
|
||||
|
||||
return obj;
|
||||
return common_hal_bleio_scanentry_get_address(self);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bluepy_scanentry_get_address_obj, bleio_scanentry_get_address);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_scanentry_get_address_obj, bleio_scanentry_get_address);
|
||||
|
||||
const mp_obj_property_t bleio_scanentry_address_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bluepy_scanentry_get_address_obj,
|
||||
.proxy = { (mp_obj_t)&bleio_scanentry_get_address_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
STATIC mp_obj_t scanentry_get_manufacturer_specific_data(mp_obj_t self_in) {
|
||||
//| .. attribute:: advertisement_bytes
|
||||
//|
|
||||
//| All the advertisement data present in the packet, returned as a ``bytes`` object. (read-only)
|
||||
//|
|
||||
STATIC mp_obj_t scanentry_get_advertisement_bytes(mp_obj_t self_in) {
|
||||
bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
mp_obj_array_t *data = MP_OBJ_TO_PTR(self->data);
|
||||
uint8_t *manuf_data;
|
||||
|
||||
const uint8_t manuf_data_len = find_data_item(data, AdManufacturerSpecificData, &manuf_data);
|
||||
if (manuf_data_len == 0) {
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
return mp_obj_new_bytearray_by_ref(manuf_data_len, manuf_data);
|
||||
return common_hal_bleio_scanentry_get_advertisement_bytes(self);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(scanentry_get_manufacturer_specific_data_obj, scanentry_get_manufacturer_specific_data);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_scanentry_get_advertisement_bytes_obj, scanentry_get_advertisement_bytes);
|
||||
|
||||
const mp_obj_property_t bleio_scanentry_manufacturer_specific_data_obj = {
|
||||
const mp_obj_property_t bleio_scanentry_advertisement_bytes_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&scanentry_get_manufacturer_specific_data_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
STATIC mp_obj_t scanentry_get_name(mp_obj_t self_in) {
|
||||
bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
mp_obj_array_t *data = MP_OBJ_TO_PTR(self->data);
|
||||
uint8_t *name;
|
||||
|
||||
// Try for Complete but settle for Shortened
|
||||
uint8_t name_len = find_data_item(data, AdCompleteLocalName, &name);
|
||||
if (name_len == 0) {
|
||||
name_len = find_data_item(data, AdShortenedLocalName, &name);
|
||||
}
|
||||
|
||||
if (name_len == 0) {
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
return mp_obj_new_str((const char*)name, name_len - 1);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bluepy_scanentry_get_name_obj, scanentry_get_name);
|
||||
|
||||
const mp_obj_property_t bleio_scanentry_name_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bluepy_scanentry_get_name_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
STATIC mp_obj_t scanentry_get_raw_data(mp_obj_t self_in) {
|
||||
bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
mp_obj_t entries = mp_obj_new_list(0, NULL);
|
||||
|
||||
mp_obj_array_t *data = MP_OBJ_TO_PTR(self->data);
|
||||
|
||||
uint16_t i = 0;
|
||||
while (i < data->len) {
|
||||
mp_obj_tuple_t *entry = MP_OBJ_TO_PTR(mp_obj_new_tuple(2, NULL));
|
||||
|
||||
const uint8_t item_len = ((uint8_t*)data->items)[i];
|
||||
const uint8_t item_type = ((uint8_t*)data->items)[i + 1];
|
||||
|
||||
entry->items[0] = MP_OBJ_NEW_SMALL_INT(item_type);
|
||||
entry->items[1] = mp_obj_new_bytearray(item_len - 1, &((uint8_t*)data->items)[i + 2]);
|
||||
mp_obj_list_append(entries, MP_OBJ_FROM_PTR(entry));
|
||||
|
||||
i += (item_len + 1);
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_scanentry_get_raw_data_obj, scanentry_get_raw_data);
|
||||
|
||||
const mp_obj_property_t bleio_scanentry_raw_data_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bleio_scanentry_get_raw_data_obj,
|
||||
.proxy = { (mp_obj_t)&bleio_scanentry_get_advertisement_bytes_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
//| .. attribute:: rssi
|
||||
//|
|
||||
//| The signal strength of the device at the time of the scan, in integer dBm. (read-only)
|
||||
//|
|
||||
STATIC mp_obj_t scanentry_get_rssi(mp_obj_t self_in) {
|
||||
bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return mp_obj_new_int(self->rssi);
|
||||
return mp_obj_new_int(common_hal_bleio_scanentry_get_rssi(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bluepy_scanentry_get_rssi_obj, scanentry_get_rssi);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_scanentry_get_rssi_obj, scanentry_get_rssi);
|
||||
|
||||
const mp_obj_property_t bleio_scanentry_rssi_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bluepy_scanentry_get_rssi_obj,
|
||||
.proxy = { (mp_obj_t)&bleio_scanentry_get_rssi_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
STATIC mp_obj_t scanentry_get_service_uuids(mp_obj_t self_in) {
|
||||
bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
mp_obj_array_t *data = MP_OBJ_TO_PTR(self->data);
|
||||
uint8_t *uuids;
|
||||
|
||||
// Try for Complete but settle for Incomplete
|
||||
uint8_t uuids_len = find_data_item(data, AdCompleteListOf16BitServiceClassUUIDs, &uuids);
|
||||
if (uuids_len == 0) {
|
||||
uuids_len = find_data_item(data, AdIncompleteListOf16BitServiceClassUUIDs, &uuids);
|
||||
}
|
||||
|
||||
mp_obj_t entries = mp_obj_new_list(0, NULL);
|
||||
for (size_t i = 0; i < uuids_len / sizeof(uint16_t); ++i) {
|
||||
const mp_obj_t uuid_int = mp_obj_new_int(uuids[sizeof(uint16_t) * i] | (uuids[sizeof(uint16_t) * i + 1] << 8));
|
||||
const mp_obj_t uuid_obj = bleio_uuid_type.make_new(&bleio_uuid_type, 1, &uuid_int, NULL);
|
||||
|
||||
mp_obj_list_append(entries, uuid_obj);
|
||||
}
|
||||
|
||||
// TODO: 32-bit UUIDs
|
||||
// TODO: 128-bit UUIDs
|
||||
|
||||
return entries;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(scanentry_get_service_uuids_obj, scanentry_get_service_uuids);
|
||||
|
||||
const mp_obj_property_t bleio_scanentry_service_uuids_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&scanentry_get_service_uuids_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
STATIC mp_obj_t scanentry_get_tx_power_level(mp_obj_t self_in) {
|
||||
bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
mp_obj_array_t *data = MP_OBJ_TO_PTR(self->data);
|
||||
uint8_t *tx_power;
|
||||
|
||||
const uint8_t tx_power_len = find_data_item(data, AdTxPowerLevel, &tx_power);
|
||||
if (tx_power_len == 0) {
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
return mp_obj_new_int((int8_t)(*tx_power));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(scanentry_get_tx_power_level_obj, scanentry_get_tx_power_level);
|
||||
|
||||
const mp_obj_property_t bleio_scanentry_tx_power_level_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&scanentry_get_tx_power_level_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t bleio_scanentry_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_address), MP_ROM_PTR(&bleio_scanentry_address_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_manufacturer_specific_data), MP_ROM_PTR(&bleio_scanentry_manufacturer_specific_data_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_name), MP_ROM_PTR(&bleio_scanentry_name_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_raw_data), MP_ROM_PTR(&bleio_scanentry_raw_data_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_rssi), MP_ROM_PTR(&bleio_scanentry_rssi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_service_uuids), MP_ROM_PTR(&bleio_scanentry_service_uuids_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_tx_power_level), MP_ROM_PTR(&bleio_scanentry_tx_power_level_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_address), MP_ROM_PTR(&bleio_scanentry_address_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_advertisement_bytes), MP_ROM_PTR(&bleio_scanentry_advertisement_bytes_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_rssi), MP_ROM_PTR(&bleio_scanentry_rssi_obj) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_scanentry_locals_dict, bleio_scanentry_locals_dict_table);
|
||||
@ -306,6 +107,5 @@ STATIC MP_DEFINE_CONST_DICT(bleio_scanentry_locals_dict, bleio_scanentry_locals_
|
||||
const mp_obj_type_t bleio_scanentry_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_ScanEntry,
|
||||
.print = bleio_scanentry_print,
|
||||
.locals_dict = (mp_obj_dict_t*)&bleio_scanentry_locals_dict
|
||||
};
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
*
|
||||
@ -29,7 +30,12 @@
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SCANENTRY_H
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "shared-module/bleio/ScanEntry.h"
|
||||
|
||||
extern const mp_obj_type_t bleio_scanentry_type;
|
||||
|
||||
mp_obj_t common_hal_bleio_scanentry_get_address(bleio_scanentry_obj_t *self);
|
||||
mp_obj_t common_hal_bleio_scanentry_get_advertisement_bytes(bleio_scanentry_obj_t *self);
|
||||
mp_int_t common_hal_bleio_scanentry_get_rssi(bleio_scanentry_obj_t *self);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SCANENTRY_H
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -29,132 +30,93 @@
|
||||
#include "shared-bindings/bleio/ScanEntry.h"
|
||||
#include "shared-bindings/bleio/Scanner.h"
|
||||
|
||||
#define DEFAULT_INTERVAL 100
|
||||
#define DEFAULT_WINDOW 100
|
||||
#define INTERVAL_DEFAULT (0.1f)
|
||||
#define INTERVAL_MIN (0.0025f)
|
||||
#define INTERVAL_MIN_STRING "0.0025"
|
||||
#define INTERVAL_MAX (40.959375f)
|
||||
#define INTERVAL_MAX_STRING "40.959375"
|
||||
#define WINDOW_DEFAULT (0.1f)
|
||||
|
||||
// Work-in-progress: orphaned for now.
|
||||
//| :orphan:
|
||||
//|
|
||||
//| .. currentmodule:: bleio
|
||||
//|
|
||||
//| :class:`Scanner` -- scan for nearby BLE devices
|
||||
//| =========================================================
|
||||
//|
|
||||
//| Allows scanning for nearby BLE devices.
|
||||
//| Scan for nearby BLE devices.
|
||||
//|
|
||||
//| Usage::
|
||||
//|
|
||||
//| import bleio
|
||||
//| scanner = bleio.Scanner()
|
||||
//| entries = scanner.scan(2500)
|
||||
//| print(entries)
|
||||
//| entries = scanner.scan(2.5) # Scan for 2.5 seconds
|
||||
//|
|
||||
|
||||
//| .. class:: Scanner()
|
||||
//|
|
||||
//| Create a new Scanner object.
|
||||
//|
|
||||
|
||||
//| .. attribute:: interval
|
||||
//|
|
||||
//| The interval (in ms) between the start of two consecutive scan windows.
|
||||
//| Allowed values are between 10ms and 10.24 sec.
|
||||
//|
|
||||
|
||||
//| .. attribute:: window
|
||||
//|
|
||||
//| The duration (in ms) in which a single BLE channel is scanned.
|
||||
//| Allowed values are between 10ms and 10.24 sec.
|
||||
//|
|
||||
|
||||
//| .. method:: scan(timeout)
|
||||
//|
|
||||
//| Performs a BLE scan.
|
||||
//|
|
||||
//| :param int timeout: the scan timeout in ms
|
||||
//| :returns: advertising packets found
|
||||
//| :rtype: list of :py:class:`bleio.ScanEntry`
|
||||
//|
|
||||
STATIC void bleio_scanner_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
bleio_scanner_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
mp_printf(print, "Scanner(interval: %d window: %d)", self->interval, self->window);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t bleio_scanner_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *all_args, mp_map_t *kw_args) {
|
||||
mp_arg_check_num(n_args, kw_args, 0, 0, false);
|
||||
|
||||
bleio_scanner_obj_t *self = m_new_obj(bleio_scanner_obj_t);
|
||||
self->base.type = type;
|
||||
|
||||
self->interval = DEFAULT_INTERVAL;
|
||||
self->window = DEFAULT_WINDOW;
|
||||
common_hal_bleio_scanner_construct(self);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
STATIC mp_obj_t bleio_scanner_get_interval(mp_obj_t self_in) {
|
||||
bleio_scanner_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
//| .. method:: scan(timeout, \*, interval=0.1, window=0.1)
|
||||
//|
|
||||
//| Performs a BLE scan.
|
||||
//|
|
||||
//| :param float timeout: the scan timeout in seconds
|
||||
//| :param float interval: the interval (in seconds) between the start of two consecutive scan windows
|
||||
//| Must be in the range 0.0025 - 40.959375 seconds.
|
||||
//| :param float window: the duration (in seconds) to scan a single BLE channel.
|
||||
//| window must be <= interval.
|
||||
//| :returns: an iterable of `ScanEntry` objects
|
||||
//| :rtype: iterable
|
||||
//|
|
||||
STATIC mp_obj_t bleio_scanner_scan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
enum { ARG_timeout, ARG_interval, ARG_window };
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_timeout, MP_ARG_REQUIRED | MP_ARG_OBJ },
|
||||
{ MP_QSTR_interval, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_window, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
};
|
||||
|
||||
return mp_obj_new_int(self->interval);
|
||||
bleio_scanner_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
const mp_float_t timeout = mp_obj_get_float(args[ARG_timeout].u_obj);
|
||||
|
||||
if (args[ARG_interval].u_obj == MP_OBJ_NULL) {
|
||||
args[ARG_interval].u_obj = mp_obj_new_float(INTERVAL_DEFAULT);
|
||||
}
|
||||
|
||||
if (args[ARG_window].u_obj == MP_OBJ_NULL) {
|
||||
args[ARG_window].u_obj = mp_obj_new_float(WINDOW_DEFAULT);
|
||||
}
|
||||
|
||||
const mp_float_t interval = mp_obj_float_get(args[ARG_interval].u_obj);
|
||||
if (interval < INTERVAL_MIN || interval > INTERVAL_MAX) {
|
||||
mp_raise_ValueError_varg(translate("interval must be in range %s-%s"), INTERVAL_MIN_STRING, INTERVAL_MAX_STRING);
|
||||
}
|
||||
|
||||
const mp_float_t window = mp_obj_float_get(args[ARG_window].u_obj);
|
||||
if (window > interval) {
|
||||
mp_raise_ValueError(translate("window must be <= interval"));
|
||||
}
|
||||
|
||||
return common_hal_bleio_scanner_scan(self, timeout, interval, window);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(bleio_scanner_get_interval_obj, bleio_scanner_get_interval);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_scanner_scan_obj, 2, bleio_scanner_scan);
|
||||
|
||||
static mp_obj_t bleio_scanner_set_interval(mp_obj_t self_in, mp_obj_t value) {
|
||||
bleio_scanner_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
self->interval = mp_obj_get_int(value);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_scanner_set_interval_obj, bleio_scanner_set_interval);
|
||||
|
||||
const mp_obj_property_t bleio_scanner_interval_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bleio_scanner_get_interval_obj,
|
||||
(mp_obj_t)&bleio_scanner_set_interval_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
STATIC mp_obj_t scanner_scan(mp_obj_t self_in, mp_obj_t timeout_in) {
|
||||
bleio_scanner_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
const mp_int_t timeout = mp_obj_get_int(timeout_in);
|
||||
|
||||
self->adv_reports = mp_obj_new_list(0, NULL);
|
||||
|
||||
common_hal_bleio_scanner_scan(self, timeout);
|
||||
|
||||
return self->adv_reports;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_scanner_scan_obj, scanner_scan);
|
||||
|
||||
STATIC mp_obj_t bleio_scanner_get_window(mp_obj_t self_in) {
|
||||
bleio_scanner_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return mp_obj_new_int(self->window);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(bleio_scanner_get_window_obj, bleio_scanner_get_window);
|
||||
|
||||
static mp_obj_t bleio_scanner_set_window(mp_obj_t self_in, mp_obj_t value) {
|
||||
bleio_scanner_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
self->window = mp_obj_get_int(value);
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_scanner_set_window_obj, bleio_scanner_set_window);
|
||||
|
||||
const mp_obj_property_t bleio_scanner_window_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bleio_scanner_get_window_obj,
|
||||
(mp_obj_t)&bleio_scanner_set_window_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
STATIC const mp_rom_map_elem_t bleio_scanner_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_interval), MP_ROM_PTR(&bleio_scanner_interval_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_scan), MP_ROM_PTR(&bleio_scanner_scan_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_window), MP_ROM_PTR(&bleio_scanner_window_obj) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_scanner_locals_dict, bleio_scanner_locals_dict_table);
|
||||
@ -162,7 +124,6 @@ STATIC MP_DEFINE_CONST_DICT(bleio_scanner_locals_dict, bleio_scanner_locals_dict
|
||||
const mp_obj_type_t bleio_scanner_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Scanner,
|
||||
.print = bleio_scanner_print,
|
||||
.make_new = bleio_scanner_make_new,
|
||||
.locals_dict = (mp_obj_dict_t*)&bleio_scanner_locals_dict
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -29,11 +29,12 @@
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SCANNER_H
|
||||
|
||||
#include "py/objtype.h"
|
||||
#include "shared-module/bleio/Scanner.h"
|
||||
#include "common-hal/bleio/Scanner.h"
|
||||
|
||||
extern const mp_obj_type_t bleio_scanner_type;
|
||||
|
||||
extern void common_hal_bleio_scanner_scan(bleio_scanner_obj_t *self, mp_int_t timeout);
|
||||
extern void common_hal_bleio_scanner_construct(bleio_scanner_obj_t *self);
|
||||
extern mp_obj_t common_hal_bleio_scanner_scan(bleio_scanner_obj_t *self, mp_float_t timeout, mp_float_t interval, mp_float_t window);
|
||||
extern void common_hal_bleio_scanner_stop(bleio_scanner_obj_t *self);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SCANNER_H
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -60,53 +61,53 @@ STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args,
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
const mp_obj_t uuid = args[ARG_uuid].u_obj;
|
||||
const mp_obj_t uuid_obj = args[ARG_uuid].u_obj;
|
||||
|
||||
if (!MP_OBJ_IS_TYPE(uuid, &bleio_uuid_type)) {
|
||||
if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) {
|
||||
mp_raise_ValueError(translate("Expected a UUID"));
|
||||
}
|
||||
|
||||
bleio_service_obj_t *self = m_new_obj(bleio_service_obj_t);
|
||||
self->char_list = mp_obj_new_list(0, NULL);
|
||||
self->base.type = &bleio_service_type;
|
||||
self->device = mp_const_none;
|
||||
self->handle = 0xFFFF;
|
||||
self->is_secondary = args[ARG_secondary].u_bool;
|
||||
self->uuid = MP_OBJ_TO_PTR(uuid);
|
||||
|
||||
const bool is_secondary = args[ARG_secondary].u_bool;
|
||||
bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj);
|
||||
|
||||
// If characteristics is not an iterable, an exception will be thrown.
|
||||
mp_obj_iter_buf_t iter_buf;
|
||||
mp_obj_t iterable = mp_getiter(args[ARG_characteristics].u_obj, &iter_buf);
|
||||
mp_obj_t characteristic;
|
||||
mp_obj_t characteristic_obj;
|
||||
|
||||
while ((characteristic = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
|
||||
if (!MP_OBJ_IS_TYPE(characteristic, &bleio_characteristic_type)) {
|
||||
// Copy the characteristics list and validate its items.
|
||||
mp_obj_t char_list_obj = mp_obj_new_list(0, NULL);
|
||||
mp_obj_list_t *char_list = MP_OBJ_TO_PTR(char_list_obj);
|
||||
|
||||
while ((characteristic_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
|
||||
if (!MP_OBJ_IS_TYPE(characteristic_obj, &bleio_characteristic_type)) {
|
||||
mp_raise_ValueError(translate("characteristics includes an object that is not a Characteristic"));
|
||||
}
|
||||
bleio_characteristic_obj_t *characteristic_ptr = MP_OBJ_TO_PTR(characteristic);
|
||||
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(characteristic_obj);
|
||||
if (common_hal_bleio_uuid_get_uuid128_reference(uuid) !=
|
||||
common_hal_bleio_uuid_get_uuid128_reference(characteristic_ptr->uuid)) {
|
||||
common_hal_bleio_uuid_get_uuid128_reference(characteristic->uuid)) {
|
||||
// The descriptor base UUID doesn't match the characteristic base UUID.
|
||||
mp_raise_ValueError(translate("Characteristic UUID doesn't match Service UUID"));
|
||||
}
|
||||
characteristic_ptr->service = self;
|
||||
mp_obj_list_append(self->char_list, characteristic);
|
||||
mp_obj_list_append(char_list_obj, characteristic_obj);
|
||||
}
|
||||
|
||||
// Do port-specific initialization.
|
||||
common_hal_bleio_service_construct(self);
|
||||
common_hal_bleio_service_construct(self, uuid, char_list, is_secondary);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
||||
//| .. attribute:: characteristics
|
||||
//|
|
||||
//| A `list` of `bleio.Characteristic` that are offered by this service. (read-only)
|
||||
//| A tuple of `bleio.Characteristic` that are offered by this service. (read-only)
|
||||
//|
|
||||
STATIC mp_obj_t bleio_service_get_characteristics(mp_obj_t self_in) {
|
||||
bleio_service_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
// Return list as a tuple so user won't be able to change it.
|
||||
mp_obj_list_t *char_list = MP_OBJ_TO_PTR(self->char_list);
|
||||
mp_obj_list_t *char_list = common_hal_bleio_service_get_characteristic_list(self);
|
||||
return mp_obj_new_tuple(char_list->len, char_list->items);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_service_get_characteristics_obj, bleio_service_get_characteristics);
|
||||
@ -118,14 +119,34 @@ const mp_obj_property_t bleio_service_characteristics_obj = {
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
//| .. attribute:: secondary
|
||||
//|
|
||||
//| True if this is a secondary service. (read-only)
|
||||
//|
|
||||
STATIC mp_obj_t bleio_service_get_secondary(mp_obj_t self_in) {
|
||||
bleio_service_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return mp_obj_new_bool(common_hal_bleio_service_get_is_secondary(self));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_service_get_secondary_obj, bleio_service_get_secondary);
|
||||
|
||||
const mp_obj_property_t bleio_service_secondary_obj = {
|
||||
.base.type = &mp_type_property,
|
||||
.proxy = { (mp_obj_t)&bleio_service_get_secondary_obj,
|
||||
(mp_obj_t)&mp_const_none_obj,
|
||||
(mp_obj_t)&mp_const_none_obj },
|
||||
};
|
||||
|
||||
//| .. attribute:: uuid
|
||||
//|
|
||||
//| The UUID of this service. (read-only)
|
||||
//| Will be ``None`` if the 128-bit UUID for this service is not known.
|
||||
//|
|
||||
STATIC mp_obj_t bleio_service_get_uuid(mp_obj_t self_in) {
|
||||
bleio_service_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
||||
return MP_OBJ_FROM_PTR(self->uuid);
|
||||
bleio_uuid_obj_t *uuid = common_hal_bleio_service_get_uuid(self);
|
||||
return uuid ? MP_OBJ_FROM_PTR(uuid) : mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_service_get_uuid_obj, bleio_service_get_uuid);
|
||||
|
||||
@ -138,14 +159,26 @@ const mp_obj_property_t bleio_service_uuid_obj = {
|
||||
|
||||
STATIC const mp_rom_map_elem_t bleio_service_locals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_characteristics), MP_ROM_PTR(&bleio_service_characteristics_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_secondary), MP_ROM_PTR(&bleio_service_secondary_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_uuid), MP_ROM_PTR(&bleio_service_uuid_obj) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_service_locals_dict, bleio_service_locals_dict_table);
|
||||
|
||||
STATIC void bleio_service_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
bleio_service_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
if (self->uuid) {
|
||||
mp_printf(print, "Service(");
|
||||
bleio_uuid_print(print, MP_OBJ_FROM_PTR(self->uuid), kind);
|
||||
mp_printf(print, ")");
|
||||
} else {
|
||||
mp_printf(print, "<Service with unregistered UUID>");
|
||||
}
|
||||
}
|
||||
|
||||
const mp_obj_type_t bleio_service_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Service,
|
||||
.make_new = bleio_service_make_new,
|
||||
.print = bleio_service_print,
|
||||
.locals_dict = (mp_obj_dict_t*)&bleio_service_locals_dict
|
||||
};
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -27,12 +28,14 @@
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SERVICE_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SERVICE_H
|
||||
|
||||
#include "shared-module/bleio/Characteristic.h"
|
||||
#include "shared-module/bleio/Service.h"
|
||||
#include "common-hal/bleio/Service.h"
|
||||
|
||||
const mp_obj_type_t bleio_service_type;
|
||||
|
||||
extern void common_hal_bleio_service_construct(bleio_service_obj_t *self);
|
||||
extern void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, mp_obj_list_t *characteristic_list, bool is_secondary);
|
||||
extern bleio_uuid_obj_t *common_hal_bleio_service_get_uuid(bleio_service_obj_t *self);
|
||||
extern mp_obj_list_t *common_hal_bleio_service_get_characteristic_list(bleio_service_obj_t *self);
|
||||
extern bool common_hal_bleio_service_get_is_secondary(bleio_service_obj_t *self);
|
||||
extern void common_hal_bleio_service_add_all_characteristics(bleio_service_obj_t *self);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SERVICE_H
|
||||
|
@ -3,9 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -48,6 +48,10 @@
|
||||
//|
|
||||
//| - an `int` value in range 0 to 0xFFFF (Bluetooth SIG 16-bit UUID)
|
||||
//| - a buffer object (bytearray, bytes) of 16 bytes in little-endian order (128-bit UUID)
|
||||
//| - a string of hex digits of the form 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
|
||||
//|
|
||||
//| Creating a 128-bit UUID registers the UUID with the onboard BLE software, and provides a
|
||||
//| temporary 16-bit UUID that can be used in place of the full 128-bit UUID.
|
||||
//|
|
||||
//| :param value: The uuid value to encapsulate
|
||||
//| :type value: int or typing.ByteString
|
||||
@ -64,7 +68,7 @@ STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, co
|
||||
if (MP_OBJ_IS_INT(value)) {
|
||||
mp_int_t uuid16 = mp_obj_get_int(value);
|
||||
if (uuid16 < 0 || uuid16 > 0xffff) {
|
||||
mp_raise_ValueError(translate("UUID integer value not in range 0 to 0xffff"));
|
||||
mp_raise_ValueError(translate("UUID integer value must be 0-0xffff"));
|
||||
}
|
||||
|
||||
// NULL means no 128-bit value.
|
||||
@ -219,6 +223,12 @@ STATIC mp_obj_t bleio_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
|
||||
}
|
||||
}
|
||||
|
||||
//|
|
||||
|
||||
//| .. method:: __eq__(other)
|
||||
//|
|
||||
//| Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit.
|
||||
//|
|
||||
STATIC mp_obj_t bleio_uuid_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
|
||||
switch (op) {
|
||||
// Two UUID's are equal if their uuid16 values and uuid128 references match.
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -27,12 +28,10 @@
|
||||
|
||||
#include "shared-bindings/bleio/__init__.h"
|
||||
#include "shared-bindings/bleio/Address.h"
|
||||
#include "shared-bindings/bleio/AddressType.h"
|
||||
#include "shared-bindings/bleio/AdvertisementData.h"
|
||||
#include "shared-bindings/bleio/Broadcaster.h"
|
||||
#include "shared-bindings/bleio/Central.h"
|
||||
#include "shared-bindings/bleio/Characteristic.h"
|
||||
#include "shared-bindings/bleio/CharacteristicBuffer.h"
|
||||
#include "shared-bindings/bleio/Descriptor.h"
|
||||
// #include "shared-bindings/bleio/Descriptor.h"
|
||||
#include "shared-bindings/bleio/Peripheral.h"
|
||||
#include "shared-bindings/bleio/ScanEntry.h"
|
||||
#include "shared-bindings/bleio/Scanner.h"
|
||||
@ -54,18 +53,14 @@
|
||||
//| :maxdepth: 3
|
||||
//|
|
||||
//| Address
|
||||
//| AddressType
|
||||
//| AdvertisementData
|
||||
//| Adapter
|
||||
//| Broadcaster
|
||||
//| Central
|
||||
//| Characteristic
|
||||
//| CharacteristicBuffer
|
||||
// Work-in-progress classes are omitted, and marked as :orphan: in their files.
|
||||
// Descriptor
|
||||
// Device
|
||||
//| Descriptor
|
||||
//| Peripheral
|
||||
// ScanEntry
|
||||
// Scanner
|
||||
//| ScanEntry
|
||||
//| Scanner
|
||||
//| Service
|
||||
//| UUID
|
||||
//|
|
||||
@ -79,23 +74,18 @@
|
||||
STATIC const mp_rom_map_elem_t bleio_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bleio) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Address), MP_ROM_PTR(&bleio_address_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_AdvertisementData), MP_ROM_PTR(&bleio_advertisementdata_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Broadcaster), MP_ROM_PTR(&bleio_broadcaster_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Central), MP_ROM_PTR(&bleio_central_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Characteristic), MP_ROM_PTR(&bleio_characteristic_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CharacteristicBuffer), MP_ROM_PTR(&bleio_characteristic_buffer_type) },
|
||||
// { MP_ROM_QSTR(MP_QSTR_Descriptor), MP_ROM_PTR(&bleio_descriptor_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Peripheral), MP_ROM_PTR(&bleio_peripheral_type) },
|
||||
// Hide work-in-progress.
|
||||
// { MP_ROM_QSTR(MP_QSTR_ScanEntry), MP_ROM_PTR(&bleio_scanentry_type) },
|
||||
// { MP_ROM_QSTR(MP_QSTR_Scanner), MP_ROM_PTR(&bleio_scanner_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ScanEntry), MP_ROM_PTR(&bleio_scanentry_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Scanner), MP_ROM_PTR(&bleio_scanner_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_Service), MP_ROM_PTR(&bleio_service_type) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UUID), MP_ROM_PTR(&bleio_uuid_type) },
|
||||
|
||||
// Properties
|
||||
{ MP_ROM_QSTR(MP_QSTR_adapter), MP_ROM_PTR(&common_hal_bleio_adapter_obj) },
|
||||
|
||||
// Enum-like Classes.
|
||||
{ MP_ROM_QSTR(MP_QSTR_AddressType), MP_ROM_PTR(&bleio_addresstype_type) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(bleio_module_globals, bleio_module_globals_table);
|
||||
|
@ -3,8 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -24,11 +25,21 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADVERTISEMENTDATA_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADVERTISEMENTDATA_H
|
||||
#include <string.h>
|
||||
|
||||
#include "py/obj.h"
|
||||
#include "py/objstr.h"
|
||||
#include "shared-bindings/bleio/Address.h"
|
||||
#include "shared-module/bleio/Address.h"
|
||||
|
||||
extern const mp_obj_type_t bleio_advertisementdata_type;
|
||||
void common_hal_bleio_address_construct(bleio_address_obj_t *self, uint8_t *bytes, uint8_t address_type) {
|
||||
self->bytes = mp_obj_new_bytes(bytes, NUM_BLEIO_ADDRESS_BYTES);
|
||||
self->type = address_type;
|
||||
}
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADVERTISEMENTDATA_H
|
||||
mp_obj_t common_hal_bleio_address_get_address_bytes(bleio_address_obj_t *self) {
|
||||
return self->bytes;
|
||||
}
|
||||
|
||||
uint8_t common_hal_bleio_address_get_type(bleio_address_obj_t *self) {
|
||||
return self->type;
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -27,14 +28,14 @@
|
||||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ADDRESS_H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ADDRESS_H
|
||||
|
||||
#include "shared-bindings/bleio/AddressType.h"
|
||||
#include "py/obj.h"
|
||||
|
||||
#define BLEIO_ADDRESS_BYTES 6
|
||||
#define NUM_BLEIO_ADDRESS_BYTES 6
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
bleio_address_type_t type;
|
||||
uint8_t value[BLEIO_ADDRESS_BYTES];
|
||||
uint8_t type;
|
||||
mp_obj_t bytes; // a bytes() object
|
||||
} bleio_address_obj_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ADDRESS_H
|
||||
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ADVERTISEMENTDATA_H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ADVERTISEMENTDATA_H
|
||||
|
||||
#include "py/obj.h"
|
||||
|
||||
// Taken from https://www.bluetooth.com/specifications/assigned-numbers/generic-access-profile
|
||||
enum {
|
||||
AdFlags = 0x01,
|
||||
AdIncompleteListOf16BitServiceClassUUIDs = 0x02,
|
||||
AdCompleteListOf16BitServiceClassUUIDs = 0x03,
|
||||
AdIncompleteListOf32BitServiceClassUUIDs = 0x04,
|
||||
AdCompleteListOf32BitServiceClassUUIDs = 0x05,
|
||||
AdIncompleteListOf128BitServiceClassUUIDs = 0x06,
|
||||
AdCompleteListOf128BitServiceClassUUIDs = 0x07,
|
||||
AdShortenedLocalName = 0x08,
|
||||
AdCompleteLocalName = 0x09,
|
||||
AdTxPowerLevel = 0x0A,
|
||||
AdClassOfDevice = 0x0D,
|
||||
AdSimplePairingHashC = 0x0E,
|
||||
AdSimplePairingRandomizerR = 0x0F,
|
||||
AdSecurityManagerTKValue = 0x10,
|
||||
AdSecurityManagerOOBFlags = 0x11,
|
||||
AdSlaveConnectionIntervalRange = 0x12,
|
||||
AdListOf16BitServiceSolicitationUUIDs = 0x14,
|
||||
AdListOf128BitServiceSolicitationUUIDs = 0x15,
|
||||
AdServiceData = 0x16,
|
||||
AdPublicTargetAddress = 0x17,
|
||||
AdRandomTargetAddress = 0x18,
|
||||
AdAppearance = 0x19,
|
||||
AdAdvertisingInterval = 0x1A,
|
||||
AdLEBluetoothDeviceAddress = 0x1B,
|
||||
AdLERole = 0x1C,
|
||||
AdSimplePairingHashC256 = 0x1D,
|
||||
AdSimplePairingRandomizerR256 = 0x1E,
|
||||
AdListOf32BitServiceSolicitationUUIDs = 0x1F,
|
||||
AdServiceData32BitUUID = 0x20,
|
||||
AdServiceData128BitUUID = 0x21,
|
||||
AdLESecureConnectionsConfirmationValue = 0x22,
|
||||
AdLESecureConnectionsRandomValue = 0x23,
|
||||
AdURI = 0x24,
|
||||
AdIndoorPositioning = 0x25,
|
||||
AdTransportDiscoveryData = 0x26,
|
||||
AdLESupportedFeatures = 0x27,
|
||||
AdChannelMapUpdateIndication = 0x28,
|
||||
AdPBADV = 0x29,
|
||||
AdMeshMessage = 0x2A,
|
||||
AdMeshBeacon = 0x2B,
|
||||
Ad3DInformationData = 0x3D,
|
||||
AdManufacturerSpecificData = 0xFF,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
mp_obj_t device_name;
|
||||
mp_obj_t services;
|
||||
mp_obj_t data;
|
||||
bool connectable;
|
||||
} bleio_advertisement_data_t;
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ADVERTISEMENTDATA_H
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -37,5 +37,4 @@ typedef struct {
|
||||
bool indicate : 1;
|
||||
} bleio_characteristic_properties_t;
|
||||
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_CHARACTERISTIC_H
|
||||
|
@ -3,7 +3,9 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
* Copyright (c) 2017 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@ -24,15 +26,20 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_BROADCASTER_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_BROADCASTER_H
|
||||
#include <string.h>
|
||||
|
||||
#include "common-hal/bleio/Broadcaster.h"
|
||||
#include "shared-bindings/bleio/Address.h"
|
||||
#include "shared-module/bleio/Address.h"
|
||||
#include "shared-module/bleio/ScanEntry.h"
|
||||
|
||||
extern const mp_obj_type_t bleio_broadcaster_type;
|
||||
mp_obj_t common_hal_bleio_scanentry_get_address(bleio_scanentry_obj_t *self) {
|
||||
return MP_OBJ_FROM_PTR(self->address);
|
||||
}
|
||||
|
||||
extern void common_hal_bleio_broadcaster_construct(bleio_broadcaster_obj_t *self, mp_float_t interval);
|
||||
extern void common_hal_bleio_broadcaster_start_advertising(bleio_broadcaster_obj_t *self, mp_buffer_info_t *data);
|
||||
extern void common_hal_bleio_broadcaster_stop_advertising(bleio_broadcaster_obj_t *self);
|
||||
mp_obj_t common_hal_bleio_scanentry_get_advertisement_bytes(bleio_scanentry_obj_t *self) {
|
||||
return self->data;
|
||||
}
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_BROADCASTER_H
|
||||
mp_int_t common_hal_bleio_scanentry_get_rssi(bleio_scanentry_obj_t *self) {
|
||||
return self->rssi;
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
|
||||
* Copyright (c) 2018 Artur Pacholec
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -27,13 +28,14 @@
|
||||
#ifndef MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SCANENTRY_H
|
||||
#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SCANENTRY_H
|
||||
|
||||
#include "shared-module/bleio/Address.h"
|
||||
#include "py/obj.h"
|
||||
#include "shared-bindings/bleio/Address.h"
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
bleio_address_obj_t address;
|
||||
bool connectable;
|
||||
int8_t rssi;
|
||||
bleio_address_obj_t *address;
|
||||
mp_obj_t data;
|
||||
} bleio_scanentry_obj_t;
|
||||
|
||||
|
@ -449,7 +449,7 @@ void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) {
|
||||
displayio_area_t* displayio_tilegrid_get_refresh_areas(displayio_tilegrid_t *self, displayio_area_t* tail) {
|
||||
if (self->moved && !self->first_draw) {
|
||||
displayio_area_union(&self->previous_area, &self->current_area, &self->dirty_area);
|
||||
if (displayio_area_size(&self->dirty_area) <= 2 * self->pixel_width * self->pixel_height) {
|
||||
if (displayio_area_size(&self->dirty_area) <= 2U * self->pixel_width * self->pixel_height) {
|
||||
self->dirty_area.next = tail;
|
||||
return &self->dirty_area;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user