Giter Club home page Giter Club logo

demos's People

Contributors

beaufortfrancois avatar danielmihalcea avatar jyasskin avatar ngammarano avatar norulesjustfeels avatar scheib avatar sowbug avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

demos's Issues

Can't connect to Dotti

I just purchased a Dotti and following instructions bluetooth-led-display but not able to connect to Dotti. Can you tell me what I'm doing wrong?

BT printer does not work properly

Hello @ALL,
I have organized this printer and would like to print receipts from my website.

The graphic printing does not work. I commented out the function sendImageData(), otherwise no printout will take place.
I can print normal letters but as soon as I use another character, e.g. a colon or several equal signs one after the other, the print will be interrupted or it will not be printed.

Does anyone have the problem, or has it already solved?

thanks

Christian

heart-rate-sensor demo don't work with Miband

Miband can act as heart-rate-sensor: enable 3rd party HR access in Gadgetbridge (or MiFit)

I got it to work:
start an Activity on the band
first connect Gadgetbridge (maybe MiFit also works, untested)
then connect web app in chrome android (click Scan button)

can't print a qrcode

Hi,

I'm trying to print a QRCode modifiying your Web Bluetooth Printer demo in: https://github.com/WebBluetoothCG/demos/tree/gh-pages/bluetooth-printer

I'm using script qrious from https://github.com/neocotic/qrious to generate a canvas with QRCODE.
Attach my html file:

<!DOCTYPE html>
<html>
<head>
    <title>QrCode Print Via Bluetooth</title>
    <script src="/qrious.min.js"></script>

</head>
<body>
    <canvas id="qr"></canvas>
    <br />
    <button onclick="onButtonClick()" style="height: 200px; width: 400px;">Imprimir por Bluetooth</button>

    <script>
        (function () {
            var qr = new QRious({
                element: document.getElementById('qr'),
                value: 'https://www.centauro.net'
            });
        })();

        var canvas = document.getElementById("qr");
        var context = canvas.getContext("2d");

        let imageData = context.getImageData(0, 0, canvas.width, canvas.height).data;

        var printCharacteristic;
        let index = 0;
        let data;

        async function connectToPrinter() {
            return new Promise(function (resolve) {
                navigator.bluetooth.requestDevice({
                    filters: [{ //Mostrar solo los dispositivos bluetooth que puedan imprimir.//000018f0 00001101
                        services: ['000018f0-0000-1000-8000-00805f9b34fb']
                    }]
                })
                    .then(device => {
                        //console.log('> Found ' + device.name);
                        //alert('Connecting to GATT Server...');
                        return device.gatt.connect();
                    })
                    .then(server => server.getPrimaryService("000018f0-0000-1000-8000-00805f9b34fb"))
                    .then(service => service.getCharacteristic("00002af1-0000-1000-8000-00805f9b34fb"))
                    .then(characteristic => {
                        // Cache the characteristic
                        printCharacteristic = characteristic; //Guardamos en la variable para poder imprimir de nuevo sin pedir autorización.
                    })
                    .then(() => { resolve() })
                    .catch(handleError);
            });
        }
        //****************************

        function getDarkPixel(x, y) {
            // Return the pixels that will be printed black
            let red = imageData[((canvas.width * y) + x) * 4];
            let green = imageData[((canvas.width * y) + x) * 4 + 1];
            let blue = imageData[((canvas.width * y) + x) * 4 + 2];
            return (red + green + blue) > 0 ? 1 : 0;
        }
        function getImagePrintData() {
            if (imageData == null) {
                alert('No image to print!');
                return new Uint8Array([]);
            }
            // Each 8 pixels in a row is represented by a byte
            let printData = new Uint8Array(canvas.width / 8 * canvas.height + 8);
            let offset = 0;
            // Set the header bytes for printing the image
            printData[0] = 29;  // Print raster bitmap
            printData[1] = 118; // Print raster bitmap
            printData[2] = 48; // Print raster bitmap
            printData[3] = 0;  // Normal 203.2 DPI
            printData[4] = canvas.width / 8; // Number of horizontal data bits (LSB)
            printData[5] = 0; // Number of horizontal data bits (MSB)
            printData[6] = canvas.height % 256; // Number of vertical data bits (LSB)
            printData[7] = canvas.height / 256;  // Number of vertical data bits (MSB)
            offset = 7;
            // Loop through image rows in bytes
            for (let i = 0; i < canvas.height; ++i) {
                for (let k = 0; k < canvas.width / 8; ++k) {
                    let k8 = k * 8;
                    
                    //  Pixel to bit position mapping
                    printData[++offset] = getDarkPixel(k8 + 0, i) * 128 + getDarkPixel(k8 + 1, i) * 64 +
                        getDarkPixel(k8 + 2, i) * 32 + getDarkPixel(k8 + 3, i) * 16 +
                        getDarkPixel(k8 + 4, i) * 8 + getDarkPixel(k8 + 5, i) * 4 +
                        getDarkPixel(k8 + 6, i) * 2 + getDarkPixel(k8 + 7, i);
                }
            }
            return printData;
        }
       
        String.prototype.toBytes = function () {
            var arr = []
            for (var i = 0; i < this.length; i++) {
                arr.push(this[i].charCodeAt(0))
            }
            return arr
        }
        //FIN ****************************
        function handleError(error) {
            alert(error);
        }

        function sendNextImageDataBatch(resolve, reject) {
            //alert("12312");
            // Can only write 512 bytes at a time to the characteristic
            // Need to send the image data in 512 byte batches
            if (index + 512 < data.length) {
                printCharacteristic.writeValue(data.slice(index, index + 512)).then(() => {
                    index += 512;
                    sendNextImageDataBatch(resolve, reject);
                })
                    .catch(error => reject(error));
            } else {
                // Send the last bytes
                if (index < data.length) {
                    printCharacteristic.writeValue(data.slice(index, data.length) + '\u000A\u000D').then(() => {
                        resolve();
                    })
                        .catch(error => reject(error));
                } else {
                    resolve();
                }
            }
        }
        function sendImageData() {
            index = 0;
            data = getImagePrintData();
            //alert(data);
            return new Promise(function (resolve, reject) {
                sendNextImageDataBatch(resolve, reject);
            });
        }
        async function onButtonClick() {
            if (printCharacteristic == null) {
                await connectToPrinter();
                sendImageData();
            }
            else {
                //impreme cuando ya tiene la impresora vinculada.
                sendImageData();
                
            }
        };
    </script>

</body>
</html>

When I call to printCharacteristic.writeValue in function sendNextImageDataBatch nothing happens in my printer that is the same than https://www.amazon.com/Version-AGPtek%C2%AE-Portable-Bluetooth-Wireless/dp/B00XL3DY2E
Soo many days frustated with it. I use your example to print text and don't have any issue.
Aslo try to print with this manual http://reliance-escpos-commands.readthedocs.io/en/latest/imaging.html for generate and print a QRCode with esc/pos native (not use a qrcode in canvas) but not works.

But also I want to create a canvas with my company site to print it for this reason wants to print a canvas and not use Esc/Pos codes.

Attach screen captures from my printer:
img_20180411_131950
img_20180411_131955

Thanks for your help in advance

Playbulb Demo Not Working

I grabbed a playbulb candle and tried the demo here on github but I keep receiving that there are no bluetooth devices around. I've tried it on my macbook and I've tried it on a nexus 7. Are there any steps I'm missing to get the demo to work?

Device can't be found.

I got the airplane and set everything up, event with to the github demo page provided in the ReadMe, but my chromebook can't find the device. I've updated chromeOS and made sure web bluetooth is on. I'm able to pair with and play the bluetooth candle demo just fine. I keep getting the error DOMException: User cancelled the requestDevice() chooser.

Any help? Thanks!

Webusb version?

Hi! thank you for this project. Is there any chance the bluetooth-printer can work with webusb chrome api instead of bluetooth?

playbulb demo does not find the playbulb

Hi!

I tried the playbulb demo on my android Smartphone with Chrome, but it does not find any ble devices.

I also tried the nRf Connect App and could find the playbulb and the corresponding UUIDs to change the color. So it seems that the problem is somewhere in the code of the demo.

Any suggestions or ideas how to solve that?

Thank you!
Andreas

Printer not working

Hi guys

Just tested Bluetooth demo with the printer and it doesn't work.

I have enabled chrome experimental web platform feature
.
chrome://flags/#enable-experimental-web-platform-features

No device in list to pair when I tap print button.

Any advice?

Thank you

Suggest renaming repo to something more distinctive

My usual pattern for cloning GitHub repos is this:

cd ~/Dropbox/src
git clone url-of-repo

In the case of this repo, this ends up putting demos among a set of distinctively named repositories. Yet demos is not distinctive.

How about web-bluetooth-demos instead?

it not showing while scanning printer device in Chrome android mobile

it not showing while scanning printer device in Chrome android mobile

This is for sample example ( https://dineshvasan.github.io/test/)
i have written for connecting bluetooth device for printing the text but it is not working. kindly check it whether i have made mistake in that code . kindly give me working solution for web bluetooth using service worker. i have referred all the website but it not working properly.

As per my requirement to access the web bluetooth print the text using service worker.
Kindly do the Needful
Printer Name : Epson
Printer Model : Epson TM-P20
`
20170821_153048

20170821_153102
`

Dotti API

Hi!

Thanks for the bluetooth-led-display Web Bluetooth demo. I recently bought a Dotti on eBay and was able to successfully use the code in the repo to connect to it. Great work! 👍

I'm creating this issue to ask for the API referenced at

* See http://wittidesign.com/en/developer/ for API.

Before creating this Issue, I reached out to Witti Design to request the API doc over a month ago, and have heard nothing. I also looked for the doc at archive.org and it is unavailable there too. This is my last hope to obtain the API doc. Do you happen to have a copy of the doc? If so, would it be possible to commit it to the repo so I can reference it as I extended the demo?

Thanks!

Oro

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.