Page 11 of 13 FirstFirst ... 2345678910111213 LastLast
Results 101 to 110 of 122

Thread: bluetooth woes

  1. #101
    Newbie Zimans's Avatar
    Join Date
    Jan 2006
    Posts
    38
    Quote Originally Posted by gentoocar View Post
    Hey I like the idea of extending a class - that would be the way to do it in Java. How would that work in plain C (not ++)? I want to make my API compatible with both C and C++. For right now my whole public API is just plain functions that should be usable from both, but I plan to object-orient-ify it a bit, and provide 2 parallel APIs like JNI. So for example, you could have:
    phone->GetName (); // C++
    or Phone_GetName (phone); // C
    There's two ways you could do it in C, callbacks with structs, or callbacks without structs.

    Basically you use a callback. You have a Read and a Write prototype that the callers will have to use and fill in, then the caller registers those two functions with the lib. From that point on your lib calls those two functions anytime it wants to read/write data. libJPG (and libPNG) i believe use this mechanism to allow the caller to provide data to the decoding algorithms. By default, they use fread/fwrite/etc. But by supplying a callback that confomrs to the fread/fwrite parameters you can provide your own funcs for reading/writing.

    Callbacks with structs is the same idea, but you have a struct with members that are pointers to functions, so the caller points these members to his/her functions, then provides the struct to the lib. Basically it's classes in C, sorta. Winamp 2.0 plugins work this way. Winamp calls a single func from th eplugin Dll that returns a struct filled with function pointers, then calls these functions to make stuff happen.

    Callbacks would be the best way to go, as structs of callbacks is more appropriate for plugin architectures where you have a common struct but different functions pointed to. Although internaly you'd just be assigning members fo your state struct to point to the supplied functions.

    --Zims
    --------------------------------------------------------------------------------
    Now, Where are my Pants?

  2. #102
    Newbie
    Join Date
    Mar 2007
    Posts
    18
    Update from my end:
    Code:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /lib64/libjbluehands.so: Can't load IA 32-bit .so on a AMD 64-bit platform
    And an update for the update:
    Code:
    localhost libbluehands # make release
    Compiling src/io/InterruptSockets.cpp
    Compiling src/io/SocketHelpers.cpp
    src/io/SocketHelpers.cpp: In function 'bool WaitForSockets(std::list<int, std::allocator<int> >*, std::list<int, std::allocator<int> >*, std::list<int, std::allocator<int> >*, timeval*)':
    src/io/SocketHelpers.cpp:462: error: no match for 'operator!=' in 'it != 0l'
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_list.h:255: note: candidates are: bool std::_List_const_iterator<_Tp>::operator!=(const std::_List_const_iterator<_Tp>&) const [with _Tp = int]
    src/io/SocketHelpers.cpp:478: error: no match for 'operator!=' in 'it != 0l'
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_list.h:255: note: candidates are: bool std::_List_const_iterator<_Tp>::operator!=(const std::_List_const_iterator<_Tp>&) const [with _Tp = int]
    src/io/SocketHelpers.cpp:494: error: no match for 'operator!=' in 'it != 0l'
    This is one of the reasons I stay away from C coding: this is whats not allowed:
    Code:
    while (it != NULL && it != pReadList->end())
    I don't get it, whats not allowed with != in that line?? Any thought how I can get it to compile on x64? (I could also send you the 64-bit binaries to put up on sf )

  3. #103
    Low Bitrate
    Join Date
    Sep 2005
    Posts
    82
    Hey cyberwizzard...

    Try changing
    Code:
    while (it != NULL && it != pReadList->end())
    tp
    Code:
    while (it != NULL && it != (list<int>::const_iterator) pReadList->end())
    I really hope that works, I don't know what they would have changed in the amd-64 gcc to break stl iteration!

    When we get this compiled, I would love copies of the binaries for sf

  4. #104
    Newbie
    Join Date
    Mar 2007
    Posts
    18
    Nope, no dice, sorry
    Code:
    localhost libbluehands # make release
    Compiling src/io/SocketHelpers.cpp
    src/io/SocketHelpers.cpp: In function 'bool WaitForSockets(std::list<int, std::allocator<int> >*, std::list<int, std::
    allocator<int> >*, std::list<int, std::allocator<int> >*, timeval*)':
    src/io/SocketHelpers.cpp:462: error: no match for 'operator!=' in 'it != 0l'
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_list.h:255: note: candidates are: bool std::_List_const
    _iterator<_Tp>::operator!=(const std::_List_const_iterator<_Tp>&) const [with _Tp = int]
    src/io/SocketHelpers.cpp:478: error: no match for 'operator!=' in 'it != 0l'
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_list.h:255: note: candidates are: bool std::_List_const                                                             _iterator<_Tp>::operator!=(const std::_List_const_iterator<_Tp>&) const [with _Tp = int]
    src/io/SocketHelpers.cpp:494: error: no match for 'operator!=' in 'it != 0l'
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_list.h:255: note: candidates are: bool std::_List_const                                                             _iterator<_Tp>::operator!=(const std::_List_const_iterator<_Tp>&) const [with _Tp = int]
    src/io/SocketHelpers.cpp:519: error: no match for 'operator!=' in 'it != 0l'
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_list.h:173: note: candidates are: bool std::_List_itera                                                             tor<_Tp>::operator!=(const std::_List_iterator<_Tp>&) const [with _Tp = int]
    src/io/SocketHelpers.cpp:536: error: no match for 'operator!=' in 'it != 0l'
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_list.h:173: note: candidates are: bool std::_List_itera                                                             tor<_Tp>::operator!=(const std::_List_iterator<_Tp>&) const [with _Tp = int]
    src/io/SocketHelpers.cpp:553: error: no match for 'operator!=' in 'it != 0l'
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_list.h:173: note: candidates are: bool std::_List_itera                                                             tor<_Tp>::operator!=(const std::_List_iterator<_Tp>&) const [with _Tp = int]
    src/io/../utilities/ListHelpers.inl: In function 'bool ListContains(std::list<T, std::allocator<_CharT> >*, T) [with T                                                              = int]':
    src/io/SocketHelpers.cpp:140:   instantiated from here
    src/io/../utilities/ListHelpers.inl:41: error: no match for 'operator!=' in 'it != 0l'
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.1/include/g++-v4/bits/stl_list.h:255: note: candidates are: bool std::_List_const                                                             _iterator<_Tp>::operator!=(const std::_List_const_iterator<_Tp>&) const [with _Tp = int]
    make: *** [src/io/SocketHelpers.o] Error 1
    The compiler I'm using:
    Code:
    localhost libbluehands # gcc --version
    gcc (GCC) 4.1.1 (Gentoo 4.1.1-r3)
    Perhaps we could exchange email addresses using PM? That way we could try to debunk it for 64-bit.

  5. #105
    Newbie
    Join Date
    Mar 2007
    Posts
    18
    As I mailed, I managed to get it working on 64-bit. I tested with my S-E K750i and the application says "unsupported handsfree version". I think this has something to do with invalid response codes rather than actually lacking support:
    Code:
    (05/07/2007 - 01:31:58) INFO: RFCOMMConnectorThread::Connect - Connecting to 00:0E:07:B9:3E:F4, channel 3
    (05/07/2007 - 01:31:58) INFO: RFCOMMConnector::DoWork_ReceiveConnection_i - Interrupted while waiting for a connection.
    (05/07/2007 - 01:31:58) INFO: BluehandsInstance::RFCOMMConnectionStateChanged - Broadcasting RFCOMM connection state change to RFCOMM_CONNECTION_TRYING
    (05/07/2007 - 01:31:58) INFO: RFCOMMConnectorThread::DoWork_InitiateConnection_i - Initiating RFCOMM Connection to 00:0E:07:B9:3E:F4 channel 3
    (05/07/2007 - 01:31:59) INFO: RFCOMMConnectorThread::DoWork_InitiateConnection_i - Created connection successfully
    (05/07/2007 - 01:31:59) INFO: BluehandsInstance::RFCOMMConnectionStateChanged - Broadcasting RFCOMM connection state change to RFCOMM_CONNECTION_NEGOTIATING
    (05/07/2007 - 01:31:59) INFO: RFCOMMConnectionHandler::EstablishServiceLevelConnection - Phone supports: 3-way calling, EC/NR, voice recognition, attach voice to number, call reject
    (05/07/2007 - 01:32:00) WARNING: RFCOMMConnectionHandler::EstablishServiceLevelConnection - Phone returned an unexpected line "" while reading indicator names
    (05/07/2007 - 01:32:00) INFO: RFCOMMConnectionHandler::ParseCIND - names - Succesfully parsed 10 indicators
    (05/07/2007 - 01:32:00) WARNING: RFCOMMConnectionHandler::EstablishServiceLevelConnection - Phone returned an unexpected line "" while reading indicator names
    (05/07/2007 - 01:32:00) ERROR: RFCOMMConnectionHandler::EstablishServiceLevelConnection - Phone did not provide all required indicators
    (05/07/2007 - 01:32:00) INFO: BluehandsInstance::RFCOMMConnectionErrorOccured - Broadcasting RFCOMM connection error ERROR_PROTOCOL
    (05/07/2007 - 01:32:02) INFO: BluehandsInstance::RFCOMMConnectionStateChanged - Broadcasting RFCOMM connection state change to RFCOMM_CONNECTION_DISCONNECTING
    (05/07/2007 - 01:32:02) INFO: RFCOMMConnector::DoWork_CloseSocketSync_i - Closing the connection (may take a few moments)
    (05/07/2007 - 01:32:02) INFO: BluehandsInstance::RFCOMMConnectionStateChanged - Broadcasting RFCOMM connection state change to RFCOMM_CONNECTION_DISCONNECTED
    (05/07/2007 - 01:32:02) INFO: RFCOMMConnector::DoWork_ReceiveConnection_i - Listening set up on RFCOMM channel 6
    Any thoughts?

  6. #106
    Low Bitrate
    Join Date
    Sep 2005
    Posts
    82
    Quote Originally Posted by cyberwizzard View Post
    As I mailed, I managed to get it working on 64-bit. I tested with my S-E K750i and the application says "unsupported handsfree version". I think this has something to do with invalid response codes rather than actually lacking support:
    That's fantastic that you got it to run! I will merge your changes in tonight. From your output, it looks like your phone is reporting that it can send us 10 indicators (these are things like battery level, signal strength, whether we're in a call, whether the phone is ringing, etc), but we need some that it isn't giving us. I will add in some logging to print out what it's giving us, so we can see what we're missing. I'll email you a patch or something.

  7. #107
    Low Bitrate
    Join Date
    Sep 2005
    Posts
    82

    rfcomm channels

    I'm a little confused about RFCOMM channels now. I thought I had them all figured out. Can I use any free RFCOMM channel? I thought when I registered my handsfree svc with sdpd it would assign me a channel number but now on closer inspection it looks like I have to provide a channel number. How do I pick a channel so that there are no conflicts? Are some channels reserved (it looks like DUN is always channel 1)? Can I just do a local sdp scan and take the first unused channel?

  8. #108
    Newbie
    Join Date
    Mar 2007
    Posts
    18
    I'd say scan for it My phone uses channel 3 and I saw another phone with a different channel... So as long as you define the correct profile (handsfree) any free channel will do I assume...

  9. #109
    Variable Bitrate red_parchel's Avatar
    Join Date
    Jul 2006
    Location
    Boston, Ma
    Posts
    276
    thinkpad bluehands_0.01 # ./runLookMaNoHands
    Exception in thread "main" java.lang.UnsupportedClassVersionError: org/bluehands/lookMaNoHands/Main (Unsupported major.minor version 49.0)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java :539)
    at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:123)
    at java.net.URLClassLoader.defineClass(URLClassLoader .java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader. java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 89)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 35)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:302)

    so to me this is suggesting that i dont have the proper version of java/blackdown installed

    version installed: 1.4.2.03-r12 [which is the latest in portage [gentoo]]

    so if you've got a tip to get around this that'd be great!
    i had this problem on my Mac a while back, but upgrading java solved the issue, that does not seem to be the case here. thanks !
    MobileThree: in car - Zotac Atom/ION - linuxICE 2.0.2

    --worklog--

  10. #110
    Low Bitrate
    Join Date
    Sep 2005
    Posts
    82
    red_parchel - The binaries are compiled with Sun Java 1.6/6.0 I believe. I've never had much luck with getting things to run on blackdown, you will probably need to either install Sun Java or compile everything from source with blackdown.

Similar Threads

  1. Bluetooth woes!
    By daveg360 in forum Wireless Communications
    Replies: 1
    Last Post: 10-02-2005, 12:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •