Giter Site home page Giter Site logo

Comments (11)

DeveloperPaul123 avatar DeveloperPaul123 commented on July 19, 2024

Can I see the code you are using to send the image? What exactly is missing from the message you are sending?

from simplebluetoothlibrary.

DeveloperPaul123 avatar DeveloperPaul123 commented on July 19, 2024

Is the issue similar to #14 ?

from simplebluetoothlibrary.

smilecs avatar smilecs commented on July 19, 2024

yes its similar....i will send the code...

from simplebluetoothlibrary.

smilecs avatar smilecs commented on July 19, 2024

here's the code

` simpleBluetooth.initializeSimpleBluetooth();
simpleBluetooth.setInputStreamType(BluetoothUtility.InputStreamType.BUFFERED);
simpleBluetooth.setSimpleBluetoothListener(new SimpleBluetoothListener() {

        @Override
        public void onBluetoothDataReceived(byte[] bytes, String data) {
            //Log.d(TAG + "incoming data", data);
           // result = result + data;
            //db.AddFriend(fp.friend());
            Log.d(TAG, data);
            try{
                toParse = data.split(":");
                byte[] im = Base64.decode(toParse[4], Base64.CRLF);
                Log.d("decoder", "decoder");
                Bitmap bit = BitmapFactory.decodeByteArray(im, 0, im.length);
            }catch (Exception e){
                e.printStackTrace();
            }
            //friendParser fp = new friendParser(result);
            //Log.d(TAG, String.valueOf(bytes.length));
            isConnected=false;

            //read the data coming in.
        }

`

from simplebluetoothlibrary.

DeveloperPaul123 avatar DeveloperPaul123 commented on July 19, 2024

Thanks for the code.

I would try this without using the buffered stream type. When you set the stream type to buffered, the library will be looking for a newline character and will not report the results in onBluetoothDataReceived until a new line character is reached which is more than likely why you're losing data since I'm assuming there is no \n in your image data.

Try that and update this issue with the results.

from simplebluetoothlibrary.

smilecs avatar smilecs commented on July 19, 2024

ok thanks very much..i'll do that

from simplebluetoothlibrary.

smilecs avatar smilecs commented on July 19, 2024

I tested the solution it gives the full data when i added the escape character \n but i noticed that while the data is being read it overrides the previous data argument on the received method. Is there a way it can send the data after all has been collected? my work around was to create a global string which i concatenate the data received to the global variable. Heres the code
` simpleBluetooth.initializeSimpleBluetooth();
simpleBluetooth.setInputStreamType(BluetoothUtility.InputStreamType.BUFFERED);
simpleBluetooth.setSimpleBluetoothListener(new SimpleBluetoothListener() {

        @Override
        public void onBluetoothDataReceived(byte[] bytes, String data) {
            //Log.d(TAG + "incoming data", data);
           result = result + data;
            //db.AddFriend(fp.friend());
            Log.d(TAG, data);

            toParse = result.split(":");
            Log.d(TAG, String.valueOf(toParse.length));
            i = toParse.length;

            if(i == 6){
                Log.d(TAG, "called");
              try{
                    Log.d(TAG, "called");
                  friendParser fp = new friendParser(result);
                  db.AddFriend(fp.friend());
                   /*toParse = data.split("LIFE");
                    byte[] im = Base64.decode(toParse[4], Base64.CRLF);
                    Bitmap bit = BitmapFactory.decodeByteArray(im, 0, im.length);
                */
                }catch (Exception e){
                    e.printStackTrace();
                }

            }

`

from simplebluetoothlibrary.

DeveloperPaul123 avatar DeveloperPaul123 commented on July 19, 2024

Maybe I wasn't clear in my previous post. What I meant to do is change the line:
simpleBluetooth.setInputStreamType(BluetoothUtility.InputStreamType.BUFFERED); to the following:
simpleBluetooth.setInputStreamType(BluetoothUtility.InputStreamType.NORMAL);

from simplebluetoothlibrary.

DeveloperPaul123 avatar DeveloperPaul123 commented on July 19, 2024

Did that work?

from simplebluetoothlibrary.

smilecs avatar smilecs commented on July 19, 2024

yes it did, sorry was suppose to close the issue. thanks for the support

SmileCs past3.com.ng
On 21 Mar 2016 13:08, "DeveloperPaul123" [email protected] wrote:

Did that work?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#22 (comment)

from simplebluetoothlibrary.

DeveloperPaul123 avatar DeveloperPaul123 commented on July 19, 2024

No problem. Thanks for using my lib.

from simplebluetoothlibrary.

Related Issues (20)

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.