{"id":2224,"date":"2016-04-14T17:33:59","date_gmt":"2016-04-14T17:33:58","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2224"},"modified":"2023-09-09T02:31:34","modified_gmt":"2023-09-09T09:31:34","slug":"embed-couchbase-in-an-iot-project-for-data-synchronization","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/pt\/embed-couchbase-in-an-iot-project-for-data-synchronization\/","title":{"rendered":"Incorporar o Couchbase em um projeto de IoT para sincroniza\u00e7\u00e3o de dados"},"content":{"rendered":"<p>A Internet das Coisas (IoT) est\u00e1 se tornando a grande moda ultimamente. A capacidade de criar qualquer dispositivo mec\u00e2nico, por exemplo, rel\u00f3gios, televisores, termostatos, e fazer com que eles se comuniquem pela Internet \u00e9 a era moderna. Nessa era moderna, uma coisa que permanece consistente \u00e9 a necessidade de transferir e armazenar dados. Como fazer isso em um dispositivo de IoT?<\/p>\n<p><a href=\"https:\/\/developer.couchbase.com\/server\/?utm_source=blogs&amp;utm_medium=link&amp;utm_campaign=blogs\">Servidor Couchbase<\/a> existe para armazenar grandes quantidades de dados corporativos e <a href=\"https:\/\/www.couchbase.com\/blog\/pt\/developers\/mobile\/?utm_source=blogs&amp;utm_medium=link&amp;utm_campaign=blogs\">Couchbase Mobile<\/a> existe para armazenar dados localmente em dispositivos m\u00f3veis e sincroniz\u00e1-los com o Couchbase Server quando poss\u00edvel. Onde a IoT se encaixa nisso? Os dispositivos de IoT n\u00e3o s\u00e3o servidores e, tecnicamente, n\u00e3o s\u00e3o dispositivos m\u00f3veis.<\/p>\n<p>Voc\u00ea sabia que muitos dispositivos de IoT s\u00e3o capazes de executar aplicativos Java? Na verdade, existe um SDK do Couchbase Lite para Java. Esse n\u00e3o \u00e9 um SDK para Android ou iOS. \u00c9 um SDK para aplicativos Java em geral. Com isso, podemos us\u00e1-lo para a IoT.<\/p>\n<h2>O escopo do projeto<\/h2>\n<p>Agora que sabemos que isso \u00e9 poss\u00edvel, vamos pensar em um exemplo legal de IoT e execut\u00e1-lo. Vamos usar um exemplo de iBeacon com o seguinte cen\u00e1rio.<\/p>\n<p>Digamos que voc\u00ea queira rastrear seu animal de estima\u00e7\u00e3o quando estiver fora de casa. Voc\u00ea quer saber por onde seu animal de estima\u00e7\u00e3o passa em sua casa e a que horas do dia. Ent\u00e3o, voc\u00ea decide conectar um iBeacon \u00e0 coleira do seu animal de estima\u00e7\u00e3o e instalar alguns scanners de IoT em sua casa.<\/p>\n<p>Assim, com o iBeacon conectado e os gateways de IoT instalados, os dispositivos de IoT podem procurar iBeacons continuamente. Quando um iBeacon entra no alcance, um registro de data e hora, juntamente com o local e as informa\u00e7\u00f5es do beacon, pode ser salvo e carregado no seu servidor. Posteriormente, voc\u00ea pode criar seu pr\u00f3prio painel com um mapa de calor para entender melhor seus dados.<\/p>\n<p>Ent\u00e3o, o que \u00e9 necess\u00e1rio para experimentar esse projeto?<\/p>\n<h2>Os requisitos<\/h2>\n<p>H\u00e1 alguns requisitos no \u00e2mbito do software e do hardware. Eles podem ser vistos abaixo:<\/p>\n<ul>\n<li>M\u00ednimo de um (1) <a href=\"https:\/\/www.intel.com\/content\/www\/us\/en\/embedded\/solutions\/iot-gateway\/development-kits.html\">Gateway IoT da Intel<\/a><\/li>\n<li>M\u00ednimo de um (1) <a href=\"https:\/\/store.gimbal.com\/\">Gimbal<\/a> sinalizador de proximidade<\/li>\n<li>Java 1.7+<\/li>\n<li>Maven<\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/pt\/nosql-databases\/downloads\/\">Gateway de sincroniza\u00e7\u00e3o do Couchbase<\/a><\/li>\n<\/ul>\n<p>Embora haja um requisito de hardware, a marca do hardware \u00e9 um pouco flex\u00edvel. Listei o Intel IoT Gateway e os beacons de proximidade Gimbal porque, al\u00e9m de serem incrivelmente acess\u00edveis, foram os que usei ao criar meu aplicativo. Para aproveitar ao m\u00e1ximo este exemplo, \u00e9 melhor ter v\u00e1rios beacons e gateways, mas um ser\u00e1 suficiente para a cria\u00e7\u00e3o de prot\u00f3tipos.<\/p>\n<p>Veja a seguir como esse projeto ser\u00e1 realizado.<\/p>\n<p><img decoding=\"async\" src=\"\/wp-content\/original-assets\/2016\/april\/embed-couchbase-in-an-iot-project-for-data-synchronization\/iot-beacon-flow.png\" \/><\/p>\n<p>O c\u00f3digo-fonte completo desse projeto pode ser encontrado em <a href=\"https:\/\/github.com\/couchbaselabs\/iot-beacon-example\">GitHub<\/a>.<\/p>\n<h2>Salvando seus dados com o Couchbase<\/h2>\n<p>Antes de entrarmos no trabalho de IoT e beacon, seria uma boa ideia definir nosso modelo de dados e criar nosso aplicativo Java. Nesse cen\u00e1rio, que \u00e9 um dos muitos, o aplicativo Java n\u00e3o far\u00e1 a varredura de beacons. Ele ser\u00e1 respons\u00e1vel apenas por salvar os dados.<\/p>\n<h3>O modelo de dados do beacon do Couchbase<\/h3>\n<p>Se voc\u00ea n\u00e3o conhece os iBeacons, eles n\u00e3o oferecem nada al\u00e9m de alguns valores de cadeia de caracteres e inteiros em sua transmiss\u00e3o. Eles n\u00e3o podem ser conectados e n\u00e3o podem ver outros dispositivos. Tudo o que fazem \u00e9 transmitir. Dito isso, os valores transmitidos s\u00e3o os seguintes:<\/p>\n<ul>\n<li>UUID<\/li>\n<li>Maior<\/li>\n<li>Menor<\/li>\n<li>Pot\u00eancia<\/li>\n<\/ul>\n<p>O <strong>UUID<\/strong>, <strong>Maior<\/strong>e <strong>Menor<\/strong> oferecem informa\u00e7\u00f5es exclusivas sobre um determinado beacon. Os tr\u00eas valores podem formar uma chave composta que \u00e9 \u00fatil para consultas posteriores.<\/p>\n<p>Vamos pensar em como armazenaremos os dados do beacon sempre que um for detectado.<\/p>\n<p>Poder\u00edamos criar um novo documento JSON sempre que um beacon fosse detectado. Os documentos individuais podem ter a apar\u00eancia de algo como:<\/p>\n<pre><code>\r\n{\r\n    \"uuid\": \"32342342\",\r\n    \"major\": 1,\r\n    \"minor\": 0,\r\n    \"createdAt\": 1932847298,\r\n    \"gatewayDevice\": \"kitchen\"\r\n}\r\n<\/code><\/pre>\n<p>N\u00e3o h\u00e1 nada de errado com a abordagem acima. No entanto, voc\u00ea pode acabar com grandes quantidades de documentos, dependendo de quantos beacons estiverem circulando. Novamente, o Couchbase foi projetado para lidar com isso, portanto \u00e9 uma quest\u00e3o de prefer\u00eancia. Na verdade, prefiro manter todas as transa\u00e7\u00f5es de beacon para um beacon espec\u00edfico no mesmo documento, dessa forma:<\/p>\n<pre><code>\r\n{\r\n    \"uuid\": \"23423423\",\r\n    \"major\": 1,\r\n    \"minor\": 0,\r\n    \"beaconStatus\": [\r\n        {\r\n            \"createdAt\": 234234321234,\r\n            \"gatewayDevice\": \"kitchen\"\r\n        },\r\n        {\r\n            \"createdAt\": 12312323544,\r\n            \"gatewayDevice\": \"garage\"\r\n        }\r\n    ]\r\n}\r\n<\/code><\/pre>\n<p>No segundo cen\u00e1rio, toda vez que um beacon \u00e9 descoberto, o Couchbase \u00e9 consultado com base na chave composta e, em seguida, os dados de status s\u00e3o adicionados \u00e0 matriz de status.<\/p>\n<h3>Adi\u00e7\u00e3o das depend\u00eancias do Maven<\/h3>\n<p>Como este projeto Java ser\u00e1 baseado no Maven, o <strong>pom.xml<\/strong> precisa que certas depend\u00eancias sejam atendidas. Adicione a seguinte depend\u00eancia ao seu arquivo Maven para incluir o Couchbase Lite Java SDK em seu projeto:<\/p>\n<pre><code>\r\n\r\n   com.couchbase.lite\r\n   couchbase-lite-java\r\n   1.2.0\r\n\r\n<\/code><\/pre>\n<p>A depend\u00eancia acima permitir\u00e1 que voc\u00ea armazene documentos do Couchbase localmente em seu dispositivo IoT e os sincronize com o Couchbase Sync Gateway.<\/p>\n<h3>Cria\u00e7\u00e3o de uma classe de beacon<\/h3>\n<p>Como trabalharemos com iBeacons, faz sentido criar uma classe Java Beacon. Essa classe deve ser respons\u00e1vel por salvar os dados do beacon, bem como carreg\u00e1-los no caso de uma consulta. Vamos come\u00e7ar dando uma olhada em como \u00e9 o carregamento:<\/p>\n<pre><code>\r\nprivate Document load(Database database) {\r\n    Document document = null;\r\n    try {\r\n        View beaconView = database.getView(\"beacons\");\r\n        beaconView.setMap(new Mapper() {\r\n            @Override\r\n            public void map(Map&lt;String, Object&gt; document, Emitter emitter) {\r\n                List<object> keys = new ArrayList<object>();                keys.add(document.get(\"uuid\"));                keys.add(document.get(\"major\"));                keys.add(document.get(\"minor\"));                emitter.emit(keys, document.get(\"beaconStatus\"));            }        }, \"1\");        Query query = beaconView.createQuery();        List<object> keys = new ArrayList<object>();        List<object> key = new ArrayList<object>();        key.add(this.uuid);        key.add(this.major);        key.add(this.minor);        keys.add(key);        query.setKeys(keys);        QueryEnumerator result = query.run();        for (Iterator it = result; it.hasNext(); ) {            QueryRow row = it.next();            document = row.getDocument();        }    } catch (Exception e) {        e.printStackTrace();    }    return document;}A lot is happening in the above load so let's take a look at it.Since Couchbase Lite queries based on MapReduce views we first create a view. Remember we plan to use a composite key which is why we create a list of keys. The only data we need returned if a match was found is the status array that contains timestamp and gateway information.With the view in place, a query can be constructed. Since we are in a custom Java class, let's assume that we've captured the <strong>uuid<\/strong>, <strong>principais<\/strong>e <strong>menor<\/strong> values at some point in time. We'll construct the key lists out of the values and set the query to use them with the <code>query.setKeys<\/code> function.After the query runs we'll loop through the results. We are only expecting one result which can further be insured by using a limit function before executing the query. The result returned from the query, if any, will be returned to whatever calls the load function. In this case the save function calls it before saving.Now let's take a look at the save function of our beacon class.\r\n<pre><code>public String save(Database database) {    String docId = \"\";    Map&lt;String, Object&gt; properties = new HashMap&lt;String, Object&gt;();    ArrayList beaconStatusList = new ArrayList();    Document document = this.load(database);    if(document != null) {        properties.putAll(document.getProperties());        beaconStatusList = (ArrayList) properties.get(\"beaconStatus\");    } else {        document = database.createDocument();        properties.put(\"uuid\", this.uuid);        properties.put(\"major\", this.major);        properties.put(\"minor\", this.minor);    }    beaconStatusList.add(this.beaconStatus);    properties.put(\"beaconStatus\", beaconStatusList);    try {        docId = document.putProperties(properties).getDocument().getId();    } catch (Exception e) {        e.printStackTrace();    }    return docId;}<\/code><\/pre>\n<p>In the save function we first want to load documents to see if they first exist. If a document exists for the beacon information, we want to add to it, otherwise we can just create a new document. After we've reconstructed our Couchbase document, whether it be from scratch or from existing document data, we save it via the <code>putProperties<\/code> Nesse ponto, os dados do beacon podem ser salvos e lidos no banco de dados local do Couchbase Lite.<\/p>\n<h3>Sincroniza\u00e7\u00e3o com o Couchbase Sync Gateway<\/h3>\n<p>More than likely you're going to be working with more than one IoT scanning gateway. Because of this, the beacon data (in the embedded document model) will need to be synchronized between IoT devices. Now we can take our saving and loading code to the next level.Take a look at the following code:<\/p>\n<pre><code>try {    manager = new Manager(new JavaContext(\"data\"), Manager.DEFAULT_OPTIONS);    database = manager.getDatabase(\"iot-project\");    URL url = new URL(\"https:\/\/192.168.1.174:4984\/beacons-iot\/\");    final Replication push = database.createPushReplication(url);    Replication pull = database.createPullReplication(url);    pull.setContinuous(false);    push.setContinuous(false);    pull.addChangeListener(new Replication.ChangeListener() {        @Override        public void changed(Replication.ChangeEvent event) {            if(event.getSource().getStatus() == Replication.ReplicationStatus.REPLICATION_STOPPED) {                beacon.save(database);                push.start();            }        }    });    push.addChangeListener(new Replication.ChangeListener() {        @Override        public void changed(Replication.ChangeEvent event) {            if(event.getSource().getStatus() == Replication.ReplicationStatus.REPLICATION_STOPPED) {                System.exit(1);            }        }    });    pull.start();} catch (Exception e) {    e.printStackTrace();}<\/code><\/pre>\n<p>Esse c\u00f3digo deve existir em outra classe, de prefer\u00eancia na classe que cont\u00e9m o <code>principal<\/code> function. Essentially it will initialize connection to your local database, configure the push and pull replicators to a remotely running instance of Sync Gateway, and start the save and synchronization process.To be more specific, the replication process will only happen one time. When we run the application, first we will pull down any relevent beacon documents from the server. By using change listeners on the replicators we can wait to save only after we've finished downloading any changes. To prevent the Java application from remaining open after pushing, we add a listener that will close the application upon completion.<\/p>\n<h3>Resolvendo os erros de depend\u00eancia do SQLite<\/h3>\n<p>When building this application with Maven, there shouldn't be any issues. However, depending on the IoT device you deploy to there could be a library dependency issue. There are many different architectures in circulation. An example error might look like the following:<\/p>\n<pre><code>Library not found: \/native\/linux\/i386\/libsqlite3.so<\/code><\/pre>\n<p>Isso pode ser facilmente resolvido extraindo o arquivo JAR, renomeando um dos diret\u00f3rios e, em seguida, empacotando-o novamente em um JAR. Para ser mais espec\u00edfico, para extrair seu arquivo JAR, execute o seguinte comando:<\/p>\n<pre><code>jar xvf [filename].jar<\/code><\/pre>\n<p>A partir dos documentos e arquivos extra\u00eddos, renomeie o arquivo <strong>\/nativo\/linux\/x86<\/strong> para o diret\u00f3rio <strong>\/nativo\/linux\/i386<\/strong>. Feito isso, voc\u00ea pode reempacotar o arquivo JAR e reimplant\u00e1-lo.<\/p>\n<pre><code>jar cvfm [filename].jar META-INF\/MANIFEST.MF .<\/code><\/pre>\n<p>O comando acima reempacotar\u00e1 o arquivo JAR para voc\u00ea.<\/p>\n<h2>Verifica\u00e7\u00e3o de iBeacons e acompanhamento de seu status<\/h2>\n<p>Like mentioned previously, the Java application is not responsible for detecting iBeacons. It is only responsible for saving the data. Instead we're going to make use of a few tools that come pre-installed on a Linux operating system.<\/p>\n<h3>Varredura com ferramentas do Linux<\/h3>\n<p>A maioria das distribui\u00e7\u00f5es Linux vem com o <strong>hcitool<\/strong> e <strong>hcidump<\/strong> aplicativos. Os <strong>hcitool<\/strong> permitir\u00e1 que voc\u00ea procure dispositivos bluetooth que estejam dentro do alcance. Voc\u00ea executaria algo como o seguinte:<\/p>\n<pre><code>hcitool lescan<\/code><\/pre>\n<p>O procedimento acima retornaria informa\u00e7\u00f5es b\u00e1sicas sobre os dispositivos encontrados em uma varredura. Em seguida, voc\u00ea usaria a fun\u00e7\u00e3o <strong>hcidump<\/strong> para mostrar tudo e qualquer coisa sobre os dados do Bluetooth que foram descobertos. Algo como isso mostraria os dados brutos:<\/p>\n<pre><code>hcidump --raw<\/code><\/pre>\n<p>The problem is that data is very raw. It is not something we can work with in its current form. We wouldn't be able to use it to make sense of iBeacon data.<\/p>\n<h3>Simplifique o processo com uma ferramenta da Radius Networks<\/h3>\n<p>\u00c9 aqui que um script de <a href=\"https:\/\/developer.radiusnetworks.com\/ibeacon\/idk\/ibeacon_scan\">Redes Radius<\/a> entra em a\u00e7\u00e3o. H\u00e1 um script chamado <strong>Varredura iBeacon<\/strong> que far\u00e1 uso de <strong>hcitool<\/strong> e <strong>hcidump<\/strong>mas analisado e limpo. Ele pode ser visto abaixo:<\/p>\n<pre><code>#!\/bin\/bash# iBeacon Scan by Radius Networks# Modified by Nic Raboy at Couchbaseif [[ $1 == \"parse\" ]]; then    packet=\"\"    capturing=\"\"    count=0    while read line    do        count=$[count + 1]        if [ \"$capturing\" ]; then            if [[ $line =~ ^[0-9a-fA-F]{2} [0-9a-fA-F] ]]; then                packet=\"$packet $line\"            else                if [[ $packet =~ ^04 3E 2A 02 01 .{26} 02 01 .{14} 02 15 ]]; then                    UUID=`echo $packet | sed 's\/^.{69}(.{47}).*$\/1\/'`                    MAJOR=`echo $packet | sed 's\/^.{117}(.{5}).*$\/1\/'`                    MINOR=`echo $packet | sed 's\/^.{123}(.{5}).*$\/1\/'`                    POWER=`echo $packet | sed 's\/^.{129}(.{2}).*$\/1\/'`                    UUID=`echo $UUID | sed -e 's\/ \/\/g' -e 's\/^(.{8})(.{4})(.{4})(.{4})(.{12})$\/1-2-3-4-5\/'`                    MAJOR=`echo $MAJOR | sed 's\/ \/\/g'`                    MAJOR=`echo \"ibase=16; $MAJOR\" | bc`                    MINOR=`echo $MINOR | sed 's\/ \/\/g'`                    MINOR=`echo \"ibase=16; $MINOR\" | bc`                    POWER=`echo \"ibase=16; $POWER\" | bc`                    POWER=$[POWER - 256]                    # Launch Couchbase Java Application To Save Beacon Transaction                    java -jar iot-couchbase-project.jar $UUID $MAJOR $MINOR $POWER                fi                capturing=\"\"                packet=\"\"            fi        fi        if [ ! \"$capturing\" ]; then            if [[ $line =~ ^&gt; ]]; then                packet=`echo $line | sed 's\/^&gt;.(.*$)\/1\/'`                capturing=1            fi        fi    doneelse    sudo hcitool lescan --duplicates 1&gt;\/dev\/null &amp;    sudo hcidump --raw | .\/$0 parse $1fi<\/code><\/pre>\n<p>Divulga\u00e7\u00e3o completa de que esse script foi escrito pela Radius Networks, com exce\u00e7\u00e3o de uma linha:<\/p>\n<pre><code>java -jar iot-couchbase-project.jar $UUID $MAJOR $MINOR $POWER<\/code><\/pre>\n<p>We're taking the information parsed by the script and piping it into our Java application to be saved. This script will run continuously until manually stopped.<img decoding=\"async\" src=\"\/wp-content\/original-assets\/2016\/april\/embed-couchbase-in-an-iot-project-for-data-synchronization\/iot-couchbase-ibeacon-example.gif\" \/>Acima est\u00e1 um exemplo de anima\u00e7\u00e3o desse projeto em a\u00e7\u00e3o.<\/p>\n<h2>Conclus\u00e3o<\/h2>\n<p>That wasn't so bad right? You just created a simple Internet of Things (IoT) project that scans iBeacons and saves the information into Couchbase. The Couchbase Lite Java SDK is near identical to the Couchbase Lite Android SDK. With it we can take our Java applications to pretty much anything that supports Java.A full working example project can be seen on <a href=\"https:\/\/github.com\/couchbaselabs\/iot-beacon-example\">GitHub<\/a>.<\/object><\/object><\/object><\/object><\/object><\/object><\/code><\/p>","protected":false},"excerpt":{"rendered":"<p>The Internet of Things (IoT) is becoming all the rage lately. Being able to craft any mechanical device, for example watches, televisions, thermostats, and have them communicate over the internet is the modern age. In this modern age, one thing [&hellip;]<\/p>","protected":false},"author":63,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1814,1815,1810,1818],"tags":[1627,1337],"ppma_author":[9032],"class_list":["post-2224","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-application-design","category-best-practices-and-tutorials","category-couchbase-mobile","category-java","tag-ibeacon","tag-iot"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Embed Couchbase in an IoT Project for Data Synchronization<\/title>\n<meta name=\"description\" content=\"See how to create a simple Internet of Things (IoT) project that scans iBeacons and saves the information into Couchbase.\" \/>\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.couchbase.com\/blog\/pt\/embed-couchbase-in-an-iot-project-for-data-synchronization\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Embed Couchbase in an IoT Project for Data Synchronization\" \/>\n<meta property=\"og:description\" content=\"See how to create a simple Internet of Things (IoT) project that scans iBeacons and saves the information into Couchbase.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/pt\/embed-couchbase-in-an-iot-project-for-data-synchronization\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/thepolyglotdeveloper\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-14T17:33:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-09T09:31:34+00:00\" \/>\n<meta name=\"author\" content=\"Nic Raboy, Developer Advocate, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@nraboy\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nic Raboy, Developer Advocate, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/\"},\"author\":{\"name\":\"Nic Raboy, Developer Advocate, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1\"},\"headline\":\"Embed Couchbase in an IoT Project for Data Synchronization\",\"datePublished\":\"2016-04-14T17:33:58+00:00\",\"dateModified\":\"2023-09-09T09:31:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/\"},\"wordCount\":1504,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"keywords\":[\"ibeacon\",\"IoT\"],\"articleSection\":[\"Application Design\",\"Best Practices and Tutorials\",\"Couchbase Mobile\",\"Java\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/\",\"name\":\"Embed Couchbase in an IoT Project for Data Synchronization\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2016-04-14T17:33:58+00:00\",\"dateModified\":\"2023-09-09T09:31:34+00:00\",\"description\":\"See how to create a simple Internet of Things (IoT) project that scans iBeacons and saves the information into Couchbase.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Embed Couchbase in an IoT Project for Data Synchronization\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1\",\"name\":\"Nic Raboy, Developer Advocate, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8863514d8bed0cf6080f23db40e00354\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g\",\"caption\":\"Nic Raboy, Developer Advocate, Couchbase\"},\"description\":\"Nic Raboy is an advocate of modern web and mobile development technologies. He has experience in Java, JavaScript, Golang and a variety of frameworks such as Angular, NativeScript, and Apache Cordova. Nic writes about his development experiences related to making web and mobile development easier to understand.\",\"sameAs\":[\"https:\/\/www.thepolyglotdeveloper.com\",\"https:\/\/www.facebook.com\/thepolyglotdeveloper\",\"https:\/\/x.com\/nraboy\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/pt\/author\/nic-raboy-2\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Incorporar o Couchbase em um projeto de IoT para sincroniza\u00e7\u00e3o de dados","description":"See how to create a simple Internet of Things (IoT) project that scans iBeacons and saves the information into Couchbase.","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.couchbase.com\/blog\/pt\/embed-couchbase-in-an-iot-project-for-data-synchronization\/","og_locale":"pt_BR","og_type":"article","og_title":"Embed Couchbase in an IoT Project for Data Synchronization","og_description":"See how to create a simple Internet of Things (IoT) project that scans iBeacons and saves the information into Couchbase.","og_url":"https:\/\/www.couchbase.com\/blog\/pt\/embed-couchbase-in-an-iot-project-for-data-synchronization\/","og_site_name":"The Couchbase Blog","article_author":"https:\/\/www.facebook.com\/thepolyglotdeveloper","article_published_time":"2016-04-14T17:33:58+00:00","article_modified_time":"2023-09-09T09:31:34+00:00","author":"Nic Raboy, Developer Advocate, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@nraboy","twitter_misc":{"Written by":"Nic Raboy, Developer Advocate, Couchbase","Est. reading time":"7 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/"},"author":{"name":"Nic Raboy, Developer Advocate, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1"},"headline":"Embed Couchbase in an IoT Project for Data Synchronization","datePublished":"2016-04-14T17:33:58+00:00","dateModified":"2023-09-09T09:31:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/"},"wordCount":1504,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","keywords":["ibeacon","IoT"],"articleSection":["Application Design","Best Practices and Tutorials","Couchbase Mobile","Java"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/","url":"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/","name":"Incorporar o Couchbase em um projeto de IoT para sincroniza\u00e7\u00e3o de dados","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2016-04-14T17:33:58+00:00","dateModified":"2023-09-09T09:31:34+00:00","description":"See how to create a simple Internet of Things (IoT) project that scans iBeacons and saves the information into Couchbase.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/embed-couchbase-in-an-iot-project-for-data-synchronization\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Embed Couchbase in an IoT Project for Data Synchronization"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"Blog do Couchbase","description":"Couchbase, o banco de dados NoSQL","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"Blog do Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/bb545ebe83bb2d12f91095811d0a72e1","name":"Nic Raboy, defensor dos desenvolvedores, Couchbase","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8863514d8bed0cf6080f23db40e00354","url":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","caption":"Nic Raboy, Developer Advocate, Couchbase"},"description":"Nic Raboy \u00e9 um defensor das modernas tecnologias de desenvolvimento m\u00f3vel e da Web. Ele tem experi\u00eancia em Java, JavaScript, Golang e uma variedade de estruturas, como Angular, NativeScript e Apache Cordova. Nic escreve sobre suas experi\u00eancias de desenvolvimento relacionadas a tornar o desenvolvimento m\u00f3vel e da Web mais f\u00e1cil de entender.","sameAs":["https:\/\/www.thepolyglotdeveloper.com","https:\/\/www.facebook.com\/thepolyglotdeveloper","https:\/\/x.com\/nraboy"],"url":"https:\/\/www.couchbase.com\/blog\/pt\/author\/nic-raboy-2\/"}]}},"authors":[{"term_id":9032,"user_id":63,"is_guest":0,"slug":"nic-raboy-2","display_name":"Nic Raboy, Developer Advocate, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/bedeb68368d4681aca4c74fe5f697f0c423b80d498ec50fd915ba018b72c101f?s=96&d=mm&r=g","author_category":"","last_name":"Raboy","first_name":"Nic","job_title":"","user_url":"https:\/\/www.thepolyglotdeveloper.com","description":"Nic Raboy \u00e9 um defensor das modernas tecnologias de desenvolvimento m\u00f3vel e da Web. Ele tem experi\u00eancia em Java, JavaScript, Golang e uma variedade de estruturas, como Angular, NativeScript e Apache Cordova. Nic escreve sobre suas experi\u00eancias de desenvolvimento relacionadas a tornar o desenvolvimento m\u00f3vel e da Web mais f\u00e1cil de entender."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/2224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/comments?post=2224"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/2224\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media?parent=2224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/categories?post=2224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/tags?post=2224"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/ppma_author?post=2224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}