{"id":289665,"date":"2018-09-20T15:35:02","date_gmt":"2018-09-20T11:35:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=289665"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=289665","title":{"rendered":"Hello World \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 Bluetooth (BLE) \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0447\u0435\u0440\u0435\u0437 C#"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c.<br \/>  \u041f\u0430\u0440\u0443 \u043d\u0435\u0434\u0435\u043b\u044c \u043d\u0430\u0437\u0430\u0434 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u0447\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e <u>\u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 Bluetooth<\/u> \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0442. \u0418 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0438 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c. \u0418 \u0447\u0442\u043e\u0431\u044b \u043b\u044e\u0434\u0438 \u043d\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u043b\u0438 \u043c\u043e\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u0432\u043e\u0442 \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u044d\u0441\u0441\u0435 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/2w\/rn\/sg\/2wrnsgxlvrbxisf6_zpf-psqlp0.png\"><\/div>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0430\u0440\u0443 \u043f\u0430\u0444\u043e\u0441\u043d\u044b\u0445 \u0441\u043b\u043e\u0432, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0443\u0436\u043d\u043e. \u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043c\u0438\u0440 \u0432\u0441\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u0438\u0434\u0435\u043e\u043b\u043e\u0433\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0432\u0435\u0449\u0435\u0439. \u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u0441\u0451 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442, \u0445\u043e\u043b\u043e\u0434\u0438\u043b\u044c\u043d\u0438\u043a \u0441 \u043f\u043b\u0438\u0442\u043e\u0439, \u0443\u0442\u044e\u0433 \u0441 \u043f\u044b\u043b\u0435\u0441\u043e\u0441\u043e\u043c \u0438 \u0442.\u0434. \u041c\u043d\u043e\u0433\u043e \u0448\u0443\u043c\u0430 \u043f\u043e\u0434\u043d\u044f\u043b\u0438 \u0438\u0437-\u0437\u0430 \u042d\u041a\u0413 \u0432 Apple Watch, \u043d\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u044b, \u043f\u0443\u043b\u044c\u0441\u043e\u043c\u0435\u0442\u0440\u044b, \u0442\u0435\u0440\u043c\u043e\u043c\u0435\u0442\u0440\u044b \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u0443\u043c\u0435\u044e\u0442 \u043f\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 Bluetooth. \u0418 \u0432\u043e\u0442 \u044d\u0442\u043e \u0432\u0441\u0451 \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0432 \u0435\u0434\u0438\u043d\u0443\u044e \u0441\u0435\u0442\u044c. \u0418 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0435\u0442\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u043a\u0430\u043a \u043d\u0438 \u043a\u0440\u0443\u0442\u0438, \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440. \u0412 \u0441\u0432\u044f\u0437\u0438 \u0441 \u044d\u0442\u0438\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0447\u0435\u0440\u0435\u0437 Bluetooth.<\/p>\n<p>  \u041d\u0430\u0447\u043d\u0443 \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0443\u0436\u0435 \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u043e \u0438 \u0447\u0442\u043e \u0443\u0441\u0443\u0433\u0443\u0431\u0438\u043b\u043e \u043f\u043e\u0438\u0441\u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0410 \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043d\u0430 <i>.Net Core<\/i>. \u0412 \u0447\u0435\u043c \u0441\u0443\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435\u0432\u0430\u0436\u043d\u043e, \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043d\u0430 <i>.Net Core<\/i>. \u041d\u0443 \u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0431\u0443\u0434\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043b\u0438\u0442\u0435\u0440\u043e\u0439 <b>N<\/b><\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043d\u0430\u0439\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0435 \u0441 Bluetooth \u0447\u0435\u0440\u0435\u0437 C# \u043f\u0440\u0438\u0432\u0435\u0434\u0443\u0442 \u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <a href=\"https:\/\/github.com\/inthehand\/32feet\">32feet<\/a>.<br \/>  \u0412 NuGet \u043f\u0430\u043a\u0435\u0442\u0430\u0445 \u043e\u043d\u0430 \u0437\u0432\u0443\u0447\u0438\u0442 \u0442\u0430\u043a <i>32feet.NET<\/i><\/p>\n<p>  \u0418 \u043e\u043d\u0430, \u043a\u0441\u0442\u0430\u0442\u0438, \u0432 \u0441\u0432\u043e\u0435\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432\u043e\u0439 \u0440\u0435\u0434\u0430\u043a\u0446\u0438\u0438, \u0434\u0430\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 Bluetooth, \u043d\u043e \u043d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 BLE [\u043a\u0430\u043a \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u043e\u0437\u0436\u0435]. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0442 \u0436\u0435 OnePlus 5T \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u044b\u0441\u043a\u0438\u0432\u0430\u043b\u0441\u044f, \u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e <b>N<\/b> \u043d\u0435\u0442. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441 \u044d\u0442\u0438\u043c \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0442\u044b\u0441\u043a\u0430\u0442\u044c \u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0430\u0432\u0442\u043e\u0440\u0430, \u0447\u0442\u043e \u0435\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441 BLE \u043d\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0438 \u0434\u0430\u0436\u0435 \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c. \u0425\u043e\u0442\u044f \u043d\u0430 Github \u0438 \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f <i>InTheHand.Devices.Bluetooth<\/i>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c BLE, \u043d\u043e \u0432 \u043d\u0435\u0439 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u0435 \u043f\u043e\u0434\u043c\u0435\u043d\u0435\u043d\u043e, \u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432\u043e\u0432\u0441\u0435 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043d\u0435\u0442, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0438\u0434\u0435\u044f\u043c\u0438 \u0432\u0437\u044f\u0442\u044b\u043c\u0438 \u0441 <i>32feet.NET<\/i> \u043d\u0435 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c.<\/p>\n<p>  \u041d\u043e\u0432\u044b\u0435 \u0438\u0437\u044b\u0441\u043a\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u043b\u0438 \u043c\u0435\u043d\u044f \u043a \u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043a <i>Universal Windows Platform<\/i> (<i>UWP<\/i>). \u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, <i>Microsoft<\/i>, \u043e\u0445\u0432\u0430\u0447\u0435\u043d\u043d\u0430\u044f \u0438\u0434\u0435\u0435\u0439 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0435\u0434\u0438\u043d\u044b\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0438 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430, \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0430\u0441\u044c \u0438 \u0441\u0434\u0435\u043b\u0430\u043b\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 Bluetooth. \u0418 \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c \u043a\u0430\u043a \u0440\u0430\u0437 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e\u2026 \u0423 \u043d\u0430\u0441 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 <i>.Net Core<\/i>\u2026 \u0418 \u044d\u0442\u0438\u043c \u0443\u0436\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u0434\u0435\u043b\u0430\u0435\u0448\u044c.<\/p>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a <i>UWP<\/i> \u0441 <i>.Net Core<\/i> \u043e\u0442\u044b\u0441\u043a\u0430\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043d\u0430 <i>EF 4.7.1.<\/i>, \u0431\u043b\u0430\u0433\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e. \u0425\u043e\u0442\u044f \u0431\u044b\u043b\u0438 \u043c\u044b\u0441\u043b\u0438 \u043a\u0430\u043a \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 <i>.Net Core<\/i> \u0438 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 Windows \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u043d\u0430\u043b\u0430\u043c (named pipe) \u0438\u043b\u0438 \u043f\u043e\u0434\u043d\u044f\u0442\u044c <i>WCF<\/i> \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u0441 \u043d\u0438\u043c \u0443\u0436\u0435 \u043d\u0430\u043b\u0430\u0434\u0438\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043d\u0435 \u0438\u043c\u0435\u043b\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430.  <\/p>\n<hr>\n<p>  \u0422\u0430\u043a \u0447\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043f\u0435\u0440\u0435\u0434 \u0441\u0442\u0430\u0440\u0442\u043e\u043c:  <\/p>\n<ul>\n<li>\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 <i>EF 4.7.1.<\/i> <\/li>\n<li>Win10 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d \u0434\u043e \u0432\u0435\u0440\u0441\u0438\u0438 <i>Version 10.0.17134 Build 17134.<\/i><\/li>\n<\/ul>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0440\u0443\u0447\u043a\u0430\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e   <\/p>\n<ul>\n<li>\u00abWindows \u043e\u0442 Universal Windows Platform\u00bb<br \/>   <i>C:\\Program Files (x86)\\Windows Kits\\10\\UnionMetadata\\10.0.17134.0\\Windows.winmd<\/i><\/li>\n<li>\u00abSystem.Runtime.WindowsRuntime\u00bb<br \/>   <i>C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETCore\\v4.5\\System.Runtime.WindowsRuntime.dll<\/i><\/li>\n<\/ul>\n<p>  \u0418 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0441\u0451, \u0434\u0430\u043b\u0435\u0435 \u0441\u0430\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0438\u0434\u0435\u0442 \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c.<br \/>  \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 BLE \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441 BluetoothLEAdvertisementWatcher<br \/>  \u041d\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043d\u0435 \u0438\u043c\u0435\u044f API \u0441\u0430\u043c\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0447\u0442\u043e-\u0442\u043e \u0442\u043e\u043b\u043a\u043e\u0432\u043e\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f.<br \/>  \u0412\u043e\u0442 \u043c\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<br \/>  \u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0443\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e (\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043e).<\/p>\n<pre><code class=\"cs\">public class BluetoothObserver     {         BluetoothLEAdvertisementWatcher Watcher { get; set; }         public void Start()         {             Watcher = new BluetoothLEAdvertisementWatcher()             {                 ScanningMode = BluetoothLEScanningMode.Active             };             Watcher.Received += Watcher_Received;             Watcher.Stopped += Watcher_Stopped;             Watcher.Start();         }         private bool isFindDevice { get; set; } = false;         private async void Watcher_Received(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args)         {             if (isFindDevice)                 return;             if (args.Advertisement.LocalName.Contains(\"deviceName\"))             {                 isFindDevice = true;                 BluetoothLEDevice bluetoothLeDevice = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress);                 GattDeviceServicesResult result = await bluetoothLeDevice.GetGattServicesAsync();                 if (result.Status == GattCommunicationStatus.Success)                 {                     var services = result.Services;                     foreach (var service in services)                     {                         if (!service.Uuid.ToString().StartsWith(\"serviceName\"))                         {                             continue;                         }                         GattCharacteristicsResult characteristicsResult = await service.GetCharacteristicsAsync();                         if (characteristicsResult.Status == GattCommunicationStatus.Success)                         {                             var characteristics = characteristicsResult.Characteristics;                             foreach (var characteristic in characteristics)                             {                                 if (!characteristic.Uuid.ToString().StartsWith(\"characteristicName\"))                                 {                                     continue;                                 }                                 GattCharacteristicProperties properties = characteristic.CharacteristicProperties;                                 if (properties.HasFlag(GattCharacteristicProperties.Indicate))                                 {                                     characteristic.ValueChanged += Characteristic_ValueChanged;                                     GattWriteResult status = await characteristic.WriteClientCharacteristicConfigurationDescriptorWithResultAsync(GattClientCharacteristicConfigurationDescriptorValue.Indicate);                                     return;                                 }                                 if (properties.HasFlag(GattCharacteristicProperties.Read))                                 {                                     GattReadResult gattResult = await characteristic.ReadValueAsync();                                     if (gattResult.Status == GattCommunicationStatus.Success)                                     {                                         var reader = DataReader.FromBuffer(gattResult.Value);                                         byte[] input = new byte[reader.UnconsumedBufferLength];                                         reader.ReadBytes(input);                                         \/\/\u0427\u0438\u0442\u0430\u0435\u043c input                                     }                                 }                             }                         }                     }                 }             }         }         private void Characteristic_ValueChanged(GattCharacteristic sender, GattValueChangedEventArgs args)         {             var reader = DataReader.FromBuffer(args.CharacteristicValue);             byte[] input = new byte[reader.UnconsumedBufferLength];             reader.ReadBytes(input);             \/\/\u0427\u0438\u0442\u0430\u0435\u043c input         }         private void Watcher_Stopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)         {             ;         }     }<\/code><\/pre>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \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\/post\/423893\/\"> https:\/\/habr.com\/post\/423893\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c.<br \/>  \u041f\u0430\u0440\u0443 \u043d\u0435\u0434\u0435\u043b\u044c \u043d\u0430\u0437\u0430\u0434 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u0447\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e <u>\u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 Bluetooth<\/u> \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0442. \u0418 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0438 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c. \u0418 \u0447\u0442\u043e\u0431\u044b \u043b\u044e\u0434\u0438 \u043d\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u043b\u0438 \u043c\u043e\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u0432\u043e\u0442 \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u044d\u0441\u0441\u0435 \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/2w\/rn\/sg\/2wrnsgxlvrbxisf6_zpf-psqlp0.png\"><\/div>\n<p>  <\/p>\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-289665","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289665","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=289665"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289665\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}