{"id":340,"date":"2022-06-17T13:46:28","date_gmt":"2022-06-17T13:46:28","guid":{"rendered":"https:\/\/www.bleuio.com\/blog\/?p=340"},"modified":"2022-07-01T10:22:22","modified_gmt":"2022-07-01T10:22:22","slug":"scan-for-nearby-bluetooth-device-using-java","status":"publish","type":"post","link":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/","title":{"rendered":"Scan for nearby Bluetooth device using JAVA"},"content":{"rendered":"\n<p>This article is a guide for creating Java applications that can scan for nearby Bluetooth devices. This example project will be helpful to&nbsp;<a href=\"https:\/\/www.bleuio.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">create BLE application easily<\/a>. Source file is available.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Requirments<\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li>BleuIO. (<a rel=\"noreferrer noopener\" href=\"https:\/\/www.bleuio.com\/\" target=\"_blank\">Bluetooth Low Energy USB dongle<\/a>)<\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/netbeans.apache.org\/\" target=\"_blank\">NetBean<\/a><\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">About the Project<\/h3>\n\n\n\n<p>The script has a COM port settings section. This section shows connected devices to the COM port. Using jSerialComm we get the list of COM ports and show it on a dropdown menu to select.<\/p>\n\n\n\n<p>The connect and disconnect buttons manages the connection of the dongle.<\/p>\n\n\n\n<p>Once we are connected to the BleuIO dongle, we will be able to write AT commands to the dongle using serial port write command.<\/p>\n\n\n\n<p>By clicking on the SCAN button , it will put the dongle into CENTRAL mode, wait for one second and write another AT command (AT+GAPSCAN=3) to scan for nearby Bluetooth devices for three seconds.<\/p>\n\n\n\n<p>The response will be available on the output panel.<\/p>\n\n\n\n<p>The script can be updated as required. For example. If you want to scan for more than three seconds, just update the MainJFrame.java file 271 line. <\/p>\n\n\n\n<p>List of AT commands are available at&nbsp;<a href=\"https:\/\/www.bleuio.com\/getting_started\/docs\/commands\/\">https:\/\/www.bleuio.com\/getting_started\/docs\/commands\/<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Clone the project<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/github.com\/smart-sensor-devices-ab\/scan_nearby_bluetooth_java.git\">Get the&nbsp;<strong>source code<\/strong>&nbsp;from https:\/\/github.com\/smart-sensor-devices-ab\/scan_nearby_bluetooth_java.git<\/a><\/li><li>Now open the project using NetBean.<\/li><li>Select jSerialComm library to resolve the issue. jSerialComm is available at root folder. You can also download it from&nbsp;<a href=\"https:\/\/fazecast.github.io\/jSerialComm\/\">https:\/\/fazecast.github.io\/jSerialComm\/<\/a><\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2 : Run the project<\/h3>\n\n\n\n<p>Connect BleuIO dongle into the computer.<\/p>\n\n\n\n<p>Run the project using NetBean play button.<\/p>\n\n\n\n<p>Alternatively we can open the project using command line interface by going to the root folder of the project and type<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>java -jar \"dist\/JavaBleuIO.jar\"<\/code><\/pre>\n\n\n\n<p>The output will look like this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"822\" height=\"734\" src=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/image-2.png\" alt=\"\" class=\"wp-image-341\" srcset=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/image-2.png 822w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/image-2-300x268.png 300w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/image-2-768x686.png 768w\" sizes=\"auto, (max-width: 822px) 100vw, 822px\" \/><\/figure>\n\n\n\n<p>Lets select a COM port where the BleuIO dongle is connected and click connect. After successful connection, we should be able to click on scan button. The response will be available on output screen.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"812\" height=\"719\" src=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/image-3.png\" alt=\"\" class=\"wp-image-342\" srcset=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/image-3.png 812w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/image-3-300x266.png 300w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/image-3-768x680.png 768w\" sizes=\"auto, (max-width: 812px) 100vw, 812px\" \/><\/figure>\n\n\n\n<p>If we click on scan button again , it will look for nearby devices for three seconds and show the output.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article is a guide for creating Java applications that can scan for nearby Bluetooth devices. This example project will be helpful to&nbsp;create BLE application easily. Source file is available. Requirments BleuIO. (Bluetooth Low Energy USB dongle) NetBean About the Project The script has a COM port settings section. This section shows connected devices to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":343,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-340","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bleuio"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Scan for nearby Bluetooth device using JAVA - BleuIO - Create Bluetooth Low Energy application<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Scan for nearby Bluetooth device using JAVA - BleuIO - Create Bluetooth Low Energy application\" \/>\n<meta property=\"og:description\" content=\"This article is a guide for creating Java applications that can scan for nearby Bluetooth devices. This example project will be helpful to&nbsp;create BLE application easily. Source file is available. Requirments BleuIO. (Bluetooth Low Energy USB dongle) NetBean About the Project The script has a COM port settings section. This section shows connected devices to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/\" \/>\n<meta property=\"og:site_name\" content=\"BleuIO - Create Bluetooth Low Energy application\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-17T13:46:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-01T10:22:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/java-nearby-bluetooth-device-scan.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"674\" \/>\n\t<meta property=\"og:image:height\" content=\"404\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"BleuIO\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/\"},\"author\":{\"name\":\"BleuIO\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#\\\/schema\\\/person\\\/89bc581382d5964043f96efc54b75b80\"},\"headline\":\"Scan for nearby Bluetooth device using JAVA\",\"datePublished\":\"2022-06-17T13:46:28+00:00\",\"dateModified\":\"2022-07-01T10:22:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/\"},\"wordCount\":354,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/java-nearby-bluetooth-device-scan.jpg\",\"articleSection\":[\"BleuIO\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/\",\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/\",\"name\":\"Scan for nearby Bluetooth device using JAVA - BleuIO - Create Bluetooth Low Energy application\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/java-nearby-bluetooth-device-scan.jpg\",\"datePublished\":\"2022-06-17T13:46:28+00:00\",\"dateModified\":\"2022-07-01T10:22:22+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#\\\/schema\\\/person\\\/89bc581382d5964043f96efc54b75b80\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/java-nearby-bluetooth-device-scan.jpg\",\"contentUrl\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/java-nearby-bluetooth-device-scan.jpg\",\"width\":674,\"height\":404},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/scan-for-nearby-bluetooth-device-using-java\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Scan for nearby Bluetooth device using JAVA\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/\",\"name\":\"BleuIO - Create Bluetooth Low Energy application\",\"description\":\"Learn Bluetooth Low Energy programming and build Bluetooth Low Energy Application\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#\\\/schema\\\/person\\\/89bc581382d5964043f96efc54b75b80\",\"name\":\"BleuIO\",\"sameAs\":[\"https:\\\/\\\/www.bleuio.com\\\/blog\"],\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/author\\\/biadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Scan for nearby Bluetooth device using JAVA - BleuIO - Create Bluetooth Low Energy application","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/","og_locale":"en_US","og_type":"article","og_title":"Scan for nearby Bluetooth device using JAVA - BleuIO - Create Bluetooth Low Energy application","og_description":"This article is a guide for creating Java applications that can scan for nearby Bluetooth devices. This example project will be helpful to&nbsp;create BLE application easily. Source file is available. Requirments BleuIO. (Bluetooth Low Energy USB dongle) NetBean About the Project The script has a COM port settings section. This section shows connected devices to [&hellip;]","og_url":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/","og_site_name":"BleuIO - Create Bluetooth Low Energy application","article_published_time":"2022-06-17T13:46:28+00:00","article_modified_time":"2022-07-01T10:22:22+00:00","og_image":[{"width":674,"height":404,"url":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/java-nearby-bluetooth-device-scan.jpg","type":"image\/jpeg"}],"author":"BleuIO","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/#article","isPartOf":{"@id":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/"},"author":{"name":"BleuIO","@id":"https:\/\/www.bleuio.com\/blog\/#\/schema\/person\/89bc581382d5964043f96efc54b75b80"},"headline":"Scan for nearby Bluetooth device using JAVA","datePublished":"2022-06-17T13:46:28+00:00","dateModified":"2022-07-01T10:22:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/"},"wordCount":354,"commentCount":0,"image":{"@id":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/java-nearby-bluetooth-device-scan.jpg","articleSection":["BleuIO"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/","url":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/","name":"Scan for nearby Bluetooth device using JAVA - BleuIO - Create Bluetooth Low Energy application","isPartOf":{"@id":"https:\/\/www.bleuio.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/#primaryimage"},"image":{"@id":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/#primaryimage"},"thumbnailUrl":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/java-nearby-bluetooth-device-scan.jpg","datePublished":"2022-06-17T13:46:28+00:00","dateModified":"2022-07-01T10:22:22+00:00","author":{"@id":"https:\/\/www.bleuio.com\/blog\/#\/schema\/person\/89bc581382d5964043f96efc54b75b80"},"breadcrumb":{"@id":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/#primaryimage","url":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/java-nearby-bluetooth-device-scan.jpg","contentUrl":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2022\/06\/java-nearby-bluetooth-device-scan.jpg","width":674,"height":404},{"@type":"BreadcrumbList","@id":"https:\/\/www.bleuio.com\/blog\/scan-for-nearby-bluetooth-device-using-java\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.bleuio.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Scan for nearby Bluetooth device using JAVA"}]},{"@type":"WebSite","@id":"https:\/\/www.bleuio.com\/blog\/#website","url":"https:\/\/www.bleuio.com\/blog\/","name":"BleuIO - Create Bluetooth Low Energy application","description":"Learn Bluetooth Low Energy programming and build Bluetooth Low Energy Application","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bleuio.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.bleuio.com\/blog\/#\/schema\/person\/89bc581382d5964043f96efc54b75b80","name":"BleuIO","sameAs":["https:\/\/www.bleuio.com\/blog"],"url":"https:\/\/www.bleuio.com\/blog\/author\/biadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts\/340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/comments?post=340"}],"version-history":[{"count":4,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts\/340\/revisions"}],"predecessor-version":[{"id":369,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts\/340\/revisions\/369"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/media\/343"}],"wp:attachment":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/media?parent=340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/categories?post=340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/tags?post=340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}