{"id":320759,"date":"2021-04-02T15:01:38","date_gmt":"2021-04-02T15:01:38","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=320759"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=320759","title":{"rendered":"\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0430\u0433\u0440\u0443\u0434\u043d\u044b\u0439 \u0434\u0430\u0442\u0447\u0438\u043a \u043f\u0443\u043b\u044c\u0441\u0430 \u043f\u043e Bluetooth \u043d\u0430 Swift"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<h2>\u0421 \u0447\u0435\u0433\u043e \u0432\u0441\u0435 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c?<\/h2>\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/04e\/ebd\/421\/04eebd42150735c6549e8c115ee9f7e4.jpeg\" width=\"800\" height=\"800\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u043a\u043e\u043b\u043e \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434 \u044f \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b \u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u0435\u0432\u0430\u0439\u0441 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0441\u0435\u0440\u0434\u0435\u0447\u043d\u044b\u0445 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0439 (\u0434\u0430\u043b\u0435\u0435 &#8212; \u0427\u0421\u0421) \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u043a. \u0414\u0430\u0442\u0447\u0438\u043a \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0443, \u0443\u043c\u043d\u044b\u043c \u0447\u0430\u0441\u0430\u043c \u043f\u043e Bluetooth, \u043d\u043e \u043e\u0431\u044b\u0447\u043d\u043e, \u0444\u0438\u0442\u043d\u0435\u0441\u0441-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043b\u0438\u0431\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438, \u043b\u0438\u0431\u043e \u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u0438\u0437\u043b\u0438\u0448\u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435, \u043a\u0430\u043a \u0440\u044f\u0434\u043e\u0432\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443 \u043c\u0435\u043d\u044f \u0440\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0427\u0421\u0421 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u043a \u0434\u043b\u044f IOS \u043d\u0430 Swift.<\/p>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 Bluetooth LE<\/h2>\n<p>Bluetooth Low Energy &#8212; \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u0432\u0441\u0435\u043c\u0435\u0441\u0442\u043d\u043e \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0435\u0435 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0434\u043d\u0435\u043c. \u0423 \u043c\u0435\u043d\u044f \u0434\u0430\u0436\u0435 \u0447\u0430\u0439\u043d\u0438\u043a \u043d\u0430 \u043a\u0443\u0445\u043d\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u043e\u043d\u043d\u043e \u0447\u0435\u0440\u0435\u0437 BLE. Low energy, \u043a\u0441\u0442\u0430\u0442\u0438, \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0441\u043d\u0438\u0436\u0435\u043d\u043d\u043e\u0435 \u044d\u043d\u0435\u0440\u0433\u043e\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 &#171;\u0433\u043e\u043b\u043e\u0433\u043e&#187; Bluetooth, \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043d\u0438\u0436\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0433\u043e\u0442\u043e\u0432\u043e \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0431\u0430\u0442\u0430\u0440\u0435\u0439\u043a\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432, \u0430 \u0442\u043e \u0438 \u043b\u0435\u0442. <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0446\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e <a href=\"https:\/\/www.bluetooth.com\/specifications\/specs\/core-specification\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/a> BLE 5.2 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u043f\u043e\u043d\u044f\u0442\u0438\u044f\u043c\u0438.<\/p>\n<h2>\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e <\/h2>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e Bluetooth \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u043c (\u0433\u043b\u0430\u0432\u043d\u044b\u043c) &#8212; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 (\u043d\u0430\u0448 \u0442\u0435\u043b\u0435\u0444\u043e\u043d)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u044b\u043c &#8212; \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e (\u0434\u0430\u0442\u0447\u0438\u043a \u0427\u0421\u0421)<\/p>\n<\/li>\n<\/ul>\n<h2>\u0420\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/h2>\n<p>\u0420\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0435 \u0438\u043b\u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435  \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435: \u0435\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0417\u0430\u0434\u0430\u0447\u0430 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0445, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c, \u0430 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u0435\u0432\u0430\u0439\u0441.<\/p>\n<p>\u041e\u0431\u044a\u0435\u043c \u0440\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438 \u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043d\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c \u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0432\u0438\u0434\u0435:<\/p>\n<ul>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441\u0430 (\u0443\u0441\u043b\u0443\u0433) &#8212; \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0443\u0436\u0431\u0443 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0427\u0421\u0421.<\/p>\n<\/li>\n<li>\n<p>\u0425\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a &#8212; \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0434\u0435\u0447\u043d\u043e\u0433\u043e \u0440\u0438\u0442\u043c\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435. <\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u044f \u043a \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f\u043c, \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u0438\u0439 \u0448\u043a\u0430\u0444, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u044f\u0449\u0438\u043a\u043e\u0432 &#8212; \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a. \u041f\u0440\u0438\u0447\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u0435\u043d \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c UUID, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c 16-\u0431\u0438\u0442\u043d\u044b\u043c \u0438\u043b\u0438 128-\u0431\u0438\u0442\u043d\u044b\u043c, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u043e\u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432.<\/p>\n<h2>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 Xcode \u0441 \u043e\u0434\u043d\u043e\u0438\u043c\u0451\u043d\u043d\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 Label \u0432 Main.storyboard \u0438 \u043f\u0435\u0440\u0435\u0442\u044f\u043d\u0435\u043c outlets \u044d\u0442\u0438\u0445 labels \u0432\u043e View Controller, \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u043c \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e constraints, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043a\u0440\u043e\u0435\u043c \u0438\u0445 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 viewDidLoad, \u043a\u0430\u043a \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438:<\/p>\n<figure class=\"float bordered full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9b8\/d16\/f7a\/9b8d16f7a24eb713d62ae915e44d4b79.png\" width=\"3584\" height=\"2240\"><figcaption><\/figcaption><\/figure>\n<p>\u042f \u0441\u043e\u0437\u0434\u0430\u043b outlets \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 &#171;121&#187; \u0438 &#171;\u0433\u0440\u0443\u0434\u044c&#187;, \u0434\u0440\u0443\u0433\u0438\u0435 \u0436\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u043b \u043d\u0430 view, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043d\u0438\u0445 \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u044b \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c.<\/p>\n<blockquote>\n<p>\u041e\u0442\u043b\u0430\u0434\u043a\u0443 \u0438 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0442\u044c \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 Bluetooth.<\/p>\n<\/blockquote>\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ea3\/6ec\/878\/ea36ec8789284d38602e2b786ef92919.png\" width=\"3584\" height=\"2240\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 Info.plist \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e:  Bluetooth Always Usage Description \u0438 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e Bluetooth \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a, \u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 &#171;\u0443\u043f\u0430\u0434\u0435\u0442&#187; \u0441 \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e \u044d\u0442\u043e!<\/p>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Bluetooth<\/h2>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u043e\u0439:<\/p>\n<pre><code class=\"swift\">import CoreBluetooth<\/code><\/pre>\n<p>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 \u0443 \u043d\u0430\u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u0432 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438 \u0438 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e (\u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e) \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0440\u044f\u0434\u043e\u043c \u0441 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445: <\/p>\n<pre><code class=\"swift\">var centralManager: CBCentralManager!<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c ViewController \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u043c, \u043d\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u043f\u043e\u0434 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b CBCentralManagerDelegate. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432 extension ViewController, \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0435\u0435. <\/p>\n<pre><code class=\"swift\">extension ViewController: CBCentralManagerDelegate {}<\/code><\/pre>\n<p>Xcode \u043d\u0430 \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043e\u0442\u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u043e\u0439: &#171;Type &#8216;ViewController&#8217; does not conform to protocol &#8216;CBCentralManagerDelegate'&#187;, \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u044f, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u0430: &#171;func centralManagerDidUpdateState(_ central: CBCentralManager)&#187;. \u041d\u0430\u0436\u043c\u0435\u043c &#171;fix&#187;, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430, \u0432 \u0442\u0435\u043b\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 &#171;func centralManagerDidUpdateState(_ central: CBCentralManager)&#187; \u043d\u0430\u043f\u0438\u0448\u0435\u043c:<\/p>\n<pre><code class=\"swift\"> func centralManagerDidUpdateState(_ central: CBCentralManager) {         switch central.state {         }<\/code><\/pre>\n<p>Xcode \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u0441\u043e\u0433\u043b\u0430\u0448\u0430\u0435\u043c\u0441\u044f \u0441 \u043d\u0438\u043c. \u0410 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e print(&#171;\u044d\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435&#187;):<\/p>\n<pre><code class=\"swift\">   extension ViewController: CBCentralManagerDelegate {     func centralManagerDidUpdateState(_ central: CBCentralManager) {         switch central.state {         case .unknown:             print (\"central.state is unknown\")         case .resetting:             print (\"central.state is resetting\")         case .unsupported:             print (\"central.state is unsupported\")         case .unauthorized:             print (\"central.state is unauthorized\")         case .poweredOff:             print (\"central.state is poweredOff\")         case .poweredOn:             print (\"central.state is poweredOn\")         @unknown default:             break         }     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c  \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e &#171;centralManager&#187; \u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u0435\u0439 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 &#171;viewDidLoad&#187;, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c &#171;nil&#187;, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044f \u0432\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u043e Bluetooth \u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438.<\/p>\n<pre><code class=\"swift\">override func viewDidLoad() {         super.viewDidLoad()         centralManager = CBCentralManager(delegate: self, queue: nil)         heartRateLabel.isHidden = true         bodyLocationLabel.isHidden = true     }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c Bluetooth, \u0432\u0438\u0434\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435, \u0441\u043e\u0433\u043b\u0430\u0448\u0430\u0435\u043c\u0441\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0437\u0430\u0432\u0435\u0442\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;<strong>central.state is poweredOn<\/strong>&#171;, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0433\u043e\u0442\u043e\u0432 \u043a \u0440\u0430\u0431\u043e\u0442\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c Bluetooth \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435, \u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 &#171;<strong>central.state is poweredOff<\/strong>&#171;.<\/p>\n<h2>\u041f\u043e\u0438\u0441\u043a Bluetooth \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432<\/h2>\n<p>\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0436\u0434\u0435\u0442 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0439, \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d \u0438\u0445 \u043f\u043e\u043b\u0443\u0447\u0438\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 &#171;centralManagerDidUpdateState&#187; \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 &#171;.poweredOn&#187; \u043f\u043e\u0441\u043b\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 &#171;print&#187; \u043f\u0438\u0448\u0435\u043c:<\/p>\n<pre><code class=\"swift\">centralManager.scanForPeripherals(withServices: nil)<\/code><\/pre>\n<p> \u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043d\u0430\u0447\u043d\u0435\u0442 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432\u043e\u043a\u0440\u0443\u0433 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0430 \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0445 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u0432 extension ViewController \u043d\u0438\u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 &#171;centralManagerDidUpdateState&#187; \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"swift\"> func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {         print(peripheral)     }<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435&#8230; \u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0435\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u0417\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e! \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0438\u0445 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440. \u041d\u043e \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0430, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c\u044e, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043a\u0430\u0436\u0443.<\/p>\n<h2>\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u043b\u0443\u0436\u0431 UUID<\/h2>\n<p>\u042f \u0440\u0430\u043d\u0435\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 Bluetooth \u043a\u0430\u043a \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0443 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c, \u0447\u0442\u043e \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u044b \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0442 \u0442\u0430\u043a\u0438\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c UUID \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u044b \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0427\u0421\u0421. \u0421\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 UUID \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/www.bluetooth.com\/specifications\/assigned-numbers\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/a>, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u043d\u0430\u0448\u0435\u043b \u043d\u0443\u0436\u043d\u044b\u0439: &#171;0x180D&#187;. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u0434 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u043d\u0435\u0435 outlets:<\/p>\n<pre><code class=\"swift\">let heartRateUUID = CBUUID(string: \"0x180D\")<\/code><\/pre>\n<p> \u0422\u0430\u043a\u0436\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 &#171;centralManager.scanForPeripherals(withServices: nil)&#187; \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u043d\u0435\u0433\u043e \u0432\u044b\u0448\u0435\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0430:<\/p>\n<pre><code class=\"swift\">case .poweredOn:             print (\"central.state is poweredOn\")             centralManager.scanForPeripherals(withServices: [heartRateUUID] )<\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u0438\u0441\u043a\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c UUID, \u0438 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0435\u0442\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e: <\/p>\n<blockquote>\n<p><strong>&lt;CBPeripheral: 0x280214000, identifier = D5A5CD3E-33AC-7245-4294-4FFB9B986DFC, name = COOSPO H6 0062870, state = disconnected&gt;<\/strong><\/p>\n<\/blockquote>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u044f\u0434\u043e\u043c \u0441 &#171;var centralManager: CBCentralManager!&#187; \u043d\u0430\u043f\u0438\u0448\u0435\u043c: <\/p>\n<pre><code class=\"swift\">var heartRatePeripheral: CBPeripheral!<\/code><\/pre>\n<p>\u0410 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 &#171;didDiscover peripheral&#187; \u0441\u0432\u044f\u0436\u0435\u043c \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441 \u0432\u044b\u0448\u0435\u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438 \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u043c \u043f\u043e\u0438\u0441\u043a \u043d\u043e\u0432\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<pre><code class=\"swift\"> func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {         print(peripheral)         heartRatePeripheral = peripheral         centralManager.stopScan()     }<\/code><\/pre>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0443<\/h2>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 &#171;centralManager.stopScan()&#187;:<\/p>\n<pre><code>centralManager.connect(heartRatePeripheral, options: nil)<\/code><\/pre>\n<p>\u041d\u0430\u043c \u0443\u0436\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0443, \u043d\u043e \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 &#171;didConnect peripheral&#187; \u043d\u0438\u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 &#171;didDiscover peripheral&#187;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<pre><code class=\"swift\">func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {         print(\"\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e\")     }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0438 \u0432\u0438\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0435 \u0437\u0430\u0432\u0435\u0442\u043d\u043e\u0435 &#171;\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e&#187;. \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441 \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0430<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0431 \u0443\u0441\u043b\u0443\u0433\u0430\u0445 (\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440 \u0433\u043e\u0442\u043e\u0432 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u043c\u0435\u0442\u043e\u0434 &#171;heartRatePeripheral.discoverServices()&#187; \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 &#171;didConnect&#187;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"swift\">func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {         print(\"\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e\")         heartRatePeripheral.discoverServices(nil)     }<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441\u0434\u0435\u043b\u0430\u043d, \u0430 \u0447\u0442\u043e\u0431\u044b \u0438\u0445 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043d\u0438\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c &#171;CBPeripheralDelegate&#187; \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0438\u0437\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 &#171;peripheral(_:didDiscoverServices:)&#187; \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"swift\">extension ViewController: CBPeripheralDelegate {          func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {         guard let services = peripheral.services else { return }          for service in services {             print(service)         }     } } <\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e\u0431 \u044d\u0442\u043e\u043c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0443 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0438\u0445 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u0443\u0441\u0442\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u043e\u043c\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0443 &#171;heartRatePeripheral&#187;. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0435:<\/p>\n<pre><code class=\"swift\">  func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {         print(peripheral)         heartRatePeripheral = peripheral                  heartRatePeripheral.delegate = self                  centralManager.stopScan()         centralManager.connect(heartRatePeripheral, options: nil)     }<\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0434\u0435\u043b\u0435\u0433\u0430\u0442 \u043e\u0431\u044c\u044f\u0432\u043b\u0435\u043d, \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u0443\u0436\u0431 \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0430:<\/p>\n<blockquote>\n<p><strong>&lt;CBService: 0x2824b4340, isPrimary = YES, UUID = Heart Rate&gt;<\/strong><\/p>\n<p><strong>&lt;CBService: 0x2824b4240, isPrimary = YES, UUID = Battery&gt;<\/strong><\/p>\n<p><strong>&lt;CBService: 0x2824b4280, isPrimary = YES, UUID = Device Information&gt;<\/strong><\/p>\n<p><strong>&lt;CBService: 0x2824b4200, isPrimary = YES, UUID = 8FC3FD00-F21D-11E3-976C-0002A5D5C51B&gt;<\/strong><\/p>\n<\/blockquote>\n<p>\u041d\u0435 \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043d\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043b\u0438\u0448\u044c \u043f\u0435\u0440\u0432\u044b\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 UUID \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 &#171;heartRatePeripheral.discoverServices()&#187;<\/p>\n<pre><code class=\"swift\">heartRatePeripheral.discoverServices([heartRateUUID])<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u0443\u0436\u0431 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 &#171;<strong>&lt;CBService: 0x2824b4340, isPrimary = YES, UUID = Heart Rate&gt;<\/strong>&#171;, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 &#8212; \u044f\u0449\u0438\u043a\u0438 (\u2116 \u0448\u043a\u0430\u0444\u0430 \u043c\u044b \u0443\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438).<\/p>\n<h2>\u0414\u043e\u0441\u0442\u0430\u0435\u043c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0438\u0437 \u0448\u043a\u0430\u0444\u0430<\/h2>\n<p>\u0428\u043a\u0430\u0444-\u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u043e. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0442\u0435\u043b\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 &#171;didDiscoverServices &#8212; peripheral&#187; \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 &#8212; \u043f\u043e\u0438\u0441\u043a: <\/p>\n<pre><code class=\"swift\">extension ViewController: CBPeripheralDelegate {          func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {         guard let services = peripheral.services else { return }          for service in services {             peripheral.discoverCharacteristics(nil, for: service)         }     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438, \u0430 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043c\u044b \u0438\u0445 \u0441\u043c\u043e\u0436\u0435\u043c \u0432 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 &#171;CBPeripheralDelegate&#187; \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c &#171;didDiscoverCharacteristicsFor&#187;. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438:<\/p>\n<pre><code class=\"swift\">func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {         guard let characteristics = service.characteristics else { return }         for characteristic in characteristics {             print(characteristic)         }     }<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b, \u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043b\u0430\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438:<\/p>\n<blockquote>\n<p><strong>&lt;CBCharacteristic: 0x28024c120, UUID = 2A37, properties = 0x10, value = {length = 2, bytes = 0x0469}, notifying = NO&gt;<\/strong><\/p>\n<p><strong>&lt;CBCharacteristic: 0x28024c180, UUID = 2A38, properties = 0x2, value = {length = 1, bytes = 0x01}, notifying = NO&gt;<\/strong><\/p>\n<\/blockquote>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0443 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u044b \u0434\u0432\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438, \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u0434\u0432\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430. \u0418\u0437 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430 Bluetooth \u0443\u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e UUID = 2A37 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u0427\u0421\u0421, \u0430 UUID = 2A38 \u0437\u0430 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435. \u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435 \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u0435, \u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u0435\u0435. <\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u0432\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"swift\"> let heartRateUUID = CBUUID(string: \"0x180D\")  let heartRateCharacteristicCBUUID = CBUUID(string: \"2A37\")  let bodyLocationCharacteristicCBUUID = CBUUID(string: \"2A38\")<\/code><\/pre>\n<p>\u0425\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u0442\u0438\u043f\u0430\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \u0427\u0421\u0421 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e &#171;.notify&#187; \u0442.\u0435. \u043e\u043d\u0430 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u0435\u0442 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0427\u0421\u0421, \u0430 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0442\u0435\u043b\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e  &#171;.read&#187;, \u0442.\u0435. \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. \u0414\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<h2>\u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435<\/h2>\n<p>\u0425\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u043d\u0435\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 &#171;peripheral.readValue(for: characteristic)&#187;<\/p>\n<pre><code class=\"swift\"> func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {         guard let characteristics = service.characteristics else { return }         for characteristic in characteristics {             peripheral.readValue(for: characteristic)         }     }<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d, \u043a\u0430\u043a \u0432\u044b \u0434\u043e\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0435\u0441\u044c, \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 &#171;peripheral(_:didUpdateValueFor:error:)&#187; \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 &#171;CBPeripheralDelegate&#187;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0441 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043f\u0440\u0438\u0447\u0435\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e &#171;switch &#8212; case&#187;, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u043f\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443:<\/p>\n<pre><code class=\"swift\">func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic,                 error: Error?) {   switch characteristic.uuid {     case bodySensorLocationCharacteristicCBUUID:       print(characteristic.value ?? \"no value\")     default:       print(\"Unhandled Characteristic UUID: \\(characteristic.uuid)\")   } }<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 &#171;1 bytes&#187;. \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 &#171;data&#187;.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b &#171;\u0440\u0430\u0441\u043f\u0430\u0441\u0438\u0442\u044c&#187; \u0434\u0430\u043d\u043d\u044b\u0439 \u0431\u0430\u0439\u0442, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u0438\u0431\u0435\u0433\u043d\u0443\u0442\u044c \u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0439 \u0431\u0430\u0439\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d. \u0423\u0441\u043a\u043e\u0440\u044f\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043d\u0438\u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0442\u0435\u043b\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0427\u0421\u0421 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430:<\/p>\n<pre><code class=\"swift\">      private func bodyLocation(from characteristic: CBCharacteristic) -&gt; String {         guard let characteristicData = characteristic.value,               let byte = characteristicData.first else { return \"Error\" }         switch byte {         case 0: return \"\u0414\u0440\u0443\u0433\u043e\u0435\"         case 1: return \"\u0413\u0440\u0443\u0434\u044c\"         case 2: return \"\u0417\u0430\u043f\u044f\u0441\u0442\u044c\u0435\"         case 3: return \"\u041f\u0430\u043b\u0435\u0446\"         case 4: return \"\u041b\u0430\u0434\u043e\u043d\u044c\"         case 5: return \"\u041c\u043e\u0447\u043a\u0430 \u0443\u0445\u0430\"         case 6: return \"\u041d\u043e\u0433\u0430\"         default:             return \"\u0420\u0435\u0437\u0435\u0440\u0432\"         }     }<\/code><\/pre>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0437\u043e\u0432\u0435\u043c \u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 &#171;didUpdateValueFor characteristic&#187;, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 (\u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043a\u0440\u044b\u0442\u044b\u0439 label \u0434\u043b\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430):<\/p>\n<pre><code class=\"swift\">   func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic,                     error: Error?) {                  switch characteristic.uuid {                  case bodyLocationCharacteristicCBUUID:             let bodySensorLocation = bodyLocation(from: characteristic)             bodyLocationLabel.text = bodySensorLocation             bodyLocationLabel.isHidden = false                    default:           print(\"Unhandled Characteristic UUID: \\(characteristic.uuid)\")       }              }<\/code><\/pre>\n<p>\u0423\u0440\u0430! \u0425\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0430, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u0430 \u0438 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d!<\/p>\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a59\/b30\/9a8\/a59b309a82d08dacff88232716ae6a7c.PNG\" width=\"1242\" height=\"2208\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u044f\u0441\u043d\u043e, \u0433\u0434\u0435 \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u043e\u0441\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u0430\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \ud83d\ude42<\/p>\n<hr>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0427\u0421\u0421 \u0438 \u0432\u044b\u0432\u043e\u0434 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h2>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0427\u0421\u0421. \u041a\u0430\u043a \u043c\u044b \u043f\u043e\u043c\u043d\u0438\u043c, \u0443 \u043d\u0435\u0435 \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f &#171;.notify&#187;, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a \u0431\u044b &#171;\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u0435\u0435&#187;, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u043b\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0427\u0421\u0421. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 &#171;peripheral.setNotifyValue(<strong>true<\/strong>, for: characteristic)&#187; \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 &#171;didDiscoverCharacteristicsFor service:<\/p>\n<pre><code class=\"swift\">func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {         guard let characteristics = service.characteristics else { return }         for characteristic in characteristics {             peripheral.readValue(for: characteristic)             peripheral.setNotifyValue(true, for: characteristic)         }     }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0441\u0442\u043e\u043a\u0438:<\/p>\n<blockquote>\n<p><strong>Unhandled Characteristic UUID: 2A37<\/strong><\/p>\n<p><strong>Unhandled Characteristic UUID: 2A37<\/strong><\/p>\n<p><strong>Unhandled Characteristic UUID: 2A37<\/strong><\/p>\n<\/blockquote>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u043e\u0439 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0438 \u043b\u0435\u0436\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0427\u0421\u0421. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u043a\u0443 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0431\u0440\u0430\u0449\u0430\u044f\u0441\u044c  \u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043b\u0438\u0431\u043e 1 \u043b\u0438\u0431\u043e 2 \u0431\u0430\u0439\u0442\u0430\u043c\u0438. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0443\u0437, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f &#171;\u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430&#187; \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 &#171;CBPeripheralDelegate&#187;.<\/p>\n<pre><code class=\"swift\">  private func heartRate(from characteristic: CBCharacteristic) -&gt; Int {         guard let characteristicData = characteristic.value else { return -1 }         let byteArray = [UInt8](characteristicData)                  let firstBitValue = byteArray[0] &amp; 0x01         if firstBitValue == 0 {             return Int(byteArray[1])         } else {             return (Int(byteArray[1]) &lt;&lt; 8) + Int(byteArray[2])         }     }<\/code><\/pre>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d case \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 &#171;peripheral(_:didUpdateValueFor:error:)&#187;, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0427\u0421\u0421, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0438 \u043f\u043e\u043a\u0430\u0436\u0435\u043c label \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<pre><code class=\"swift\">   func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic,                     error: Error?) {                  switch characteristic.uuid {                  case bodyLocationCharacteristicCBUUID:             let bodySensorLocation = bodyLocation(from: characteristic)             bodyLocationLabel.text = bodySensorLocation             bodyLocationLabel.isHidden = false                      case heartRateCharacteristicCBUUID:             let bpm = heartRate(from: characteristic)             heartRateLabel.text = String(bpm)             heartRateLabel.isHidden = false                      default:           print(\"Unhandled Characteristic UUID: \\(characteristic.uuid)\")       }     }<\/code><\/pre>\n<p>\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u044e! <\/p>\n<figure class=\"float full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cb5\/293\/2c5\/cb52932c5f6dec8fa8f681981d7b9c87.PNG\" width=\"1242\" height=\"2208\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0430 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u042f \u0434\u0430\u0436\u0435 \u0441\u043b\u0435\u0433\u043a\u0430 \u043d\u0435\u0440\u0432\u043d\u0438\u0447\u0430\u044e \ud83d\ude42<\/p>\n<hr>\n<h2>\u0418\u0442\u043e\u0433\u0438<\/h2>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c \u0433\u0430\u0439\u0434 \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e Bluetooth \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u0427\u0421\u0421 \u0432\u044b\u0448\u0435\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0438 \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u043c, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u043c\u044b\u0441\u043b \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u043d\u0435\u0441\u0442\u0438. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0435\u0442\u043e\u0434 \u043f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043e\u0431\u0440\u044b\u0432\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f), \u043d\u043e \u044f \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u0432 \u043c\u0435\u0440\u0443 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 swift CoreBluetooth.<\/p>\n<blockquote>\n<p>\u0412\u0441\u0435\u043c \u0443\u0441\u043f\u0435\u0445\u043e\u0432 \u0438 \u0441\u043f\u0430\u0441\u0438\u0431\u043e!<\/p>\n<\/blockquote>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/550378\/\"> https:\/\/habr.com\/ru\/post\/550378\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<h2>\u0421 \u0447\u0435\u0433\u043e \u0432\u0441\u0435 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c?<\/h2>\n<figure class=\"float full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u043a\u043e\u043b\u043e \u0433\u043e\u0434\u0430 \u043d\u0430\u0437\u0430\u0434 \u044f \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b \u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u0435\u0432\u0430\u0439\u0441 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0441\u0435\u0440\u0434\u0435\u0447\u043d\u044b\u0445 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0439 (\u0434\u0430\u043b\u0435\u0435 &#8212; \u0427\u0421\u0421) \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u043a. \u0414\u0430\u0442\u0447\u0438\u043a \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u0434\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0443, \u0443\u043c\u043d\u044b\u043c \u0447\u0430\u0441\u0430\u043c \u043f\u043e Bluetooth, \u043d\u043e \u043e\u0431\u044b\u0447\u043d\u043e, \u0444\u0438\u0442\u043d\u0435\u0441\u0441-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043b\u0438\u0431\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438, \u043b\u0438\u0431\u043e \u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u0438\u0437\u043b\u0438\u0448\u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u0435, \u043a\u0430\u043a \u0440\u044f\u0434\u043e\u0432\u043e\u043c\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443 \u043c\u0435\u043d\u044f \u0440\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0427\u0421\u0421 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0440\u0435\u043d\u0438\u0440\u043e\u0432\u043e\u043a \u0434\u043b\u044f IOS \u043d\u0430 Swift.<\/p>\n<h2>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 Bluetooth LE<\/h2>\n<p>Bluetooth Low Energy &#8212; \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0438 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u0432\u0441\u0435\u043c\u0435\u0441\u0442\u043d\u043e \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0435\u0435 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0434\u043d\u0435\u043c. \u0423 \u043c\u0435\u043d\u044f \u0434\u0430\u0436\u0435 \u0447\u0430\u0439\u043d\u0438\u043a \u043d\u0430 \u043a\u0443\u0445\u043d\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u0441\u0442\u0430\u043d\u0446\u0438\u043e\u043d\u043d\u043e \u0447\u0435\u0440\u0435\u0437 BLE. Low energy, \u043a\u0441\u0442\u0430\u0442\u0438, \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0441\u043d\u0438\u0436\u0435\u043d\u043d\u043e\u0435 \u044d\u043d\u0435\u0440\u0433\u043e\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 &#171;\u0433\u043e\u043b\u043e\u0433\u043e&#187; Bluetooth, \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043d\u0438\u0436\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0433\u043e\u0442\u043e\u0432\u043e \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0431\u0430\u0442\u0430\u0440\u0435\u0439\u043a\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432, \u0430 \u0442\u043e \u0438 \u043b\u0435\u0442. <\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0446\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e <a href=\"https:\/\/www.bluetooth.com\/specifications\/specs\/core-specification\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/a> BLE 5.2 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c\u0438 \u043f\u043e\u043d\u044f\u0442\u0438\u044f\u043c\u0438.<\/p>\n<h2>\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0438 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e <\/h2>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e Bluetooth \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u043c (\u0433\u043b\u0430\u0432\u043d\u044b\u043c) &#8212; \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 (\u043d\u0430\u0448 \u0442\u0435\u043b\u0435\u0444\u043e\u043d)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u044b\u043c &#8212; \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e (\u0434\u0430\u0442\u0447\u0438\u043a \u0427\u0421\u0421)<\/p>\n<\/li>\n<\/ul>\n<h2>\u0420\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/h2>\n<p>\u0420\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0435 \u0438\u043b\u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435  \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435: \u0435\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0417\u0430\u0434\u0430\u0447\u0430 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0445, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c, \u0430 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u0435\u0432\u0430\u0439\u0441.<\/p>\n<p>\u041e\u0431\u044a\u0435\u043c \u0440\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438 \u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043d\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c \u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0432\u0438\u0434\u0435:<\/p>\n<ul>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441\u0430 (\u0443\u0441\u043b\u0443\u0433) &#8212; \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0443\u0436\u0431\u0443 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0427\u0421\u0421.<\/p>\n<\/li>\n<li>\n<p>\u0425\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a &#8212; \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0439 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0434\u0435\u0447\u043d\u043e\u0433\u043e \u0440\u0438\u0442\u043c\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u0442\u0447\u0438\u043a\u0430 \u043d\u0430 \u0442\u0435\u043b\u0435. <\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u044f \u043a \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f\u043c, \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u0438\u0439 \u0448\u043a\u0430\u0444, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u044f\u0449\u0438\u043a\u043e\u0432 &#8212; \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a. \u041f\u0440\u0438\u0447\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u0435\u043d \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c UUID, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c 16-\u0431\u0438\u0442\u043d\u044b\u043c \u0438\u043b\u0438 128-\u0431\u0438\u0442\u043d\u044b\u043c, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u043e\u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432.<\/p>\n<h2>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043a\u043e\u0434\u0430<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 Xcode \u0441 \u043e\u0434\u043d\u043e\u0438\u043c\u0451\u043d\u043d\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 Label \u0432 Main.storyboard \u0438 \u043f\u0435\u0440\u0435\u0442\u044f\u043d\u0435\u043c outlets \u044d\u0442\u0438\u0445 labels \u0432\u043e View Controller, \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u043c \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e constraints, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u043a\u0440\u043e\u0435\u043c \u0438\u0445 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 viewDidLoad, \u043a\u0430\u043a \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438:<\/p>\n<figure class=\"float bordered full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u042f \u0441\u043e\u0437\u0434\u0430\u043b outlets \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 &#171;121&#187; \u0438 &#171;\u0433\u0440\u0443\u0434\u044c&#187;, \u0434\u0440\u0443\u0433\u0438\u0435 \u0436\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043a\u0440\u0435\u043f\u0438\u043b \u043d\u0430 view, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043d\u0438\u0445 \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u044b \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u043c.<\/p>\n<blockquote>\n<p>\u041e\u0442\u043b\u0430\u0434\u043a\u0443 \u0438 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0442\u044c \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 Bluetooth.<\/p>\n<\/blockquote>\n<figure class=\"float full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 Info.plist \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e:  Bluetooth Always Usage Description \u0438 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0435\u0434\u043e\u043c\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e Bluetooth \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a, \u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 &#171;\u0443\u043f\u0430\u0434\u0435\u0442&#187; \u0441 \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e \u044d\u0442\u043e!<\/p>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Bluetooth<\/h2>\n<p>\u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u043e\u0439:<\/p>\n<pre><code class=\"swift\">import CoreBluetooth<\/code><\/pre>\n<p>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 \u0443 \u043d\u0430\u0441 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0439\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u0432 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438 \u0438 \u043f\u0435\u0440\u0438\u0444\u0435\u0440\u0438\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e (\u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e) \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0440\u044f\u0434\u043e\u043c \u0441 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445: <\/p>\n<pre><code class=\"swift\">var centralManager: CBCentralManager!<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c ViewController \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u043c, \u043d\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u043f\u043e\u0434 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b CBCentralManagerDelegate. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432 extension ViewController, \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0435\u0435. <\/p>\n<pre><code class=\"swift\">extension ViewController: CBCentralManagerDelegate {}<\/code><\/pre>\n<p>Xcode \u043d\u0430 \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043e\u0442\u0440\u0435\u0430\u0433\u0438\u0440\u0443\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u043e\u0439: &#171;Type &#8216;ViewController&#8217; does not conform to protocol &#8216;CBCentralManagerDelegate'&#187;, \u043e\u043f\u043e\u0432\u0435\u0449\u0430\u044f, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u0430: &#171;func centralManagerDidUpdateState(_ central: CBCentralManager)&#187;. \u041d\u0430\u0436\u043c\u0435\u043c &#171;fix&#187;, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430, \u0432 \u0442\u0435\u043b\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 &#171;func centralManagerDidUpdateState(_ central: CBCentralManager)&#187; \u043d\u0430\u043f\u0438\u0448\u0435\u043c:<\/p>\n<pre><code class=\"swift\"> func centralManagerDidUpdateState(_ central: CBCentralManager) {         switch central.state {         }<\/code><\/pre>\n<p>Xcode \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u0441\u043e\u0433\u043b\u0430\u0448\u0430\u0435\u043c\u0441\u044f \u0441 \u043d\u0438\u043c. \u0410 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e print(&#171;\u044d\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435&#187;):<\/p>\n<pre><code class=\"swift\">   extension ViewController: CBCentralManagerDelegate {     func centralManagerDidUpdateState(_ central: CBCentralManager) {         switch central.state {         case .unknown:             print (\"central.state is unknown\")         case .resetting:             print (\"central.state is resetting\")         case .unsupported:             print (\"central.state is unsupported\")         case .unauthorized:             print (\"central.state is unauthorized\")         case .poweredOff:             print (\"central.state is poweredOff\")         case .poweredOn:             print (\"central.state is poweredOn\")         @unknown default:             break         }     } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c  \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e &#171;centralManager&#187; \u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u0435\u0439 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 &#171;viewDidLoad&#187;, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c &#171;nil&#187;, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044f \u0432\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u043e Bluetooth \u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438.<\/p>\n<pre><code class=\"swift\">override func viewDidLoad() {         super.viewDidLoad()         centralManager = CBCentralManager(delegate: self, queue: nil)         heartRateLabel.isHidden = true         bodyLocationLabel.isHidden = true     }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c Bluetooth, \u0432\u0438\u0434\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435, \u0441\u043e\u0433\u043b\u0430\u0448\u0430\u0435\u043c\u0441\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0437\u0430\u0432\u0435\u0442\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 &#171;<strong>central.state is poweredOn<\/strong>&#171;, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0433\u043e\u0442\u043e\u0432 \u043a \u0440\u0430\u0431\u043e\u0442\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c Bluetooth \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435, \u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 &#171;<strong>central.state is poweredOff<\/strong>&#171;.<\/p>\n<h2>\u041f\u043e\u0438\u0441\u043a Bluetooth \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432<\/h2>\n<p>\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0436\u0434\u0435\u0442 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0439, \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043d \u0438\u0445 \u043f\u043e\u043b\u0443\u0447\u0438\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 &#171;centralManagerDidUpdateState&#187; \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 &#171;.poweredOn&#187; \u043f\u043e\u0441\u043b\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 &#171;print&#187; \u043f\u0438\u0448\u0435\u043c:<\/p>\n<pre><code class=\"swift\">centralManager.scanForPeripherals(withServices: nil)<\/code><\/pre>\n<p> \u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043d\u0430\u0447\u043d\u0435\u0442 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432\u043e\u043a\u0440\u0443\u0433 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u0430 \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0445 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u0432 extension ViewController \u043d\u0438\u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 &#171;centralManagerDidUpdateState&#187; \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"swift\"> func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {         print(peripheral)     }<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435&#8230; \u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0435\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u0417\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e! \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0438\u0445 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440. \u041d\u043e \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0430, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c\u044e, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u043a\u0430\u0436\u0443.<\/p>\n<h2>\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0441\u043b\u0443\u0436\u0431 UUID<\/h2>\n<p>\u042f \u0440\u0430\u043d\u0435\u0435 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 Bluetooth \u043a\u0430\u043a \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0443 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c, \u0447\u0442\u043e \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u044b \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0442 \u0442\u0430\u043a\u0438\u043c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c UUID \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u043b\u0443\u0436\u0431\u044b \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0427\u0421\u0421. \u0421\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 UUID \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/www.bluetooth.com\/specifications\/assigned-numbers\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/a>, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u043d\u0430\u0448\u0435\u043b \u043d\u0443\u0436\u043d\u044b\u0439: &#171;0x180D&#187;. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u0434 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u043d\u0435\u0435 outlets:<\/p>\n<pre><code class=\"swift\">let heartRateUUID = CBUUID(string: \"0x180D\")<\/code><\/pre>\n<p> \u0422\u0430\u043a\u0436\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 &#171;centralManager.scanForPeripherals(withServices: nil)&#187; \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u043d\u0435\u0433\u043e \u0432\u044b\u0448\u0435\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0430:<\/p>\n<pre><code class=\"swift\">case .poweredOn:             print (\"central.state is poweredOn\")             centralManager.scanForPeripherals(withServices: [heartRateUUID] )<\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u0438\u0441\u043a\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c UUID, \u0438 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0435\u0442\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e: <\/p>\n<blockquote>\n<p><strong>&lt;CBPeripheral: 0x280214000, identifier = D5A5CD3E-33AC-7245-4294-4FFB9B986DFC, name = COOSPO H6 0062870, state = disconnected&gt;<\/strong><\/p>\n<\/blockquote>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u044f\u0434\u043e\u043c \u0441 &#171;var centralManager: CBCentralManager!&#187; \u043d\u0430\u043f\u0438\u0448\u0435\u043c: <\/p>\n<pre><code class=\"swift\">var heartRatePeripheral: CBPeripheral!<\/code><\/pre>\n<p>\u0410 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 &#171;didDiscover peripheral&#187; \u0441\u0432\u044f\u0436\u0435\u043c \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0441 \u0432\u044b\u0448\u0435\u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438 \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u043c \u043f\u043e\u0438\u0441\u043a \u043d\u043e\u0432\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<pre><code class=\"swift\"> func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {         print(peripheral)         heartRatePeripheral = peripheral         centralManager.stopScan()     }<\/code><\/pre>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0443<\/h2>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 &#171;centralManager.stopScan()&#187;:<\/p>\n<pre><code>centralManager.connect(heartRatePeripheral, options: nil)<\/code><\/pre>\n<p>\u041d\u0430\u043c \u0443\u0436\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0443, \u043d\u043e \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 &#171;didConnect peripheral&#187; \u043d\u0438\u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 &#171;didDiscover peripheral&#187;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<pre><code class=\"swift\">func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {         print(\"\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e\")     }<\/code><\/pre>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0438 \u0432\u0438\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0435 \u0437\u0430\u0432\u0435\u0442\u043d\u043e\u0435 &#171;\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e&#187;. \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0441 \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u0430<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e,<\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-320759","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320759","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=320759"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/320759\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}