Coder Social home page Coder Social logo

0-1-0 / lightblue-0.4 Goto Github PK

View Code? Open in Web Editor NEW
97.0 14.0 93.0 302 KB

LightBlue python module that compiles successful on OS X 10.8 (Mountain Lion)

License: GNU General Public License v3.0

Python 60.61% Objective-C 24.63% C 9.06% C++ 5.15% Makefile 0.55%

lightblue-0.4's Introduction

LightBlue

LightBlue is a cross-platform Bluetooth API for Python which provides simple access to Bluetooth operations. It is available for Mac OS X, GNU/Linux and Nokia's Python for Series 60 platform for mobile phones.

LightBlue provides simple access to:

    * Device and service discovery (with and without end-user GUIs)
    * Standard socket interface for RFCOMM and L2CAP sockets (currently L2CAP client sockets only, and not on PyS60)
    * Sending and receiving files over OBEX
    * Advertising of RFCOMM and OBEX services
    * Local device information

LightBlue is released under the GPL License.

See the home page at http://lightblue.sourceforge.net for more information.


Requirements
============

Mac OS X:
    Python 2.3 or later
    PyObjC (http://pyobjc.sourceforge.net)
    Xcode 2.1 or later to build LightAquaBlue framework (but you could build from a separate .xcode project for older versions)
    (Mac OS X 10.4 or later is required to do device discovery without a GUI)
    
GNU/Linux:
    Python 2.3 or later (with Tkinter if using selectdevice() or selectservice())
    PyBluez 0.9 or later (http://org.csail.mit.edu/pybluez)
    OpenOBEX 1.0.1 or later (http://openobex.sourceforge.net)
    
Python for Series 60:
    Python for Series 60 1.3.1 or later (http://sourceforge.net/projects/pys60)
    
    
Installation
============

Mac OS X and GNU/Linux:
    Just open up a shell/terminal and run the command:

        python setup.py install

Or you might need to run with root access, i.e.

	sudo python setup.py install

    On Mac OS X, the setup.py script also installs the LightAquaBlue framework into /Library/Frameworks.
    
Python for Series 60: 
    Download the appropriate SIS file for your phone from the LightBlue home page (http://lightblue.sourceforge.net). Send the file to your phone, and open and install. Or, use the Nokia PC Suite to install the SIS file.


Installation for Xcode 1.5 / Mac OS X 10.3
------------------------------------------

The LightAquaBlue framework for the Mac OS X installation is in a .xcodeproj package which can only be opened by Xcode 2.1 and later, and Xcode 2.1 does not run on Mac OS X 10.3. So to build LightBlue on Mac OS X 10.3, just create a .xcode package yourself:

- Open Xcode and choose File -> New Project. Choose "Cocoa Framework" (under the "Frameworks" drop-down list) and save the project as "LightAquaBlue". Save the project anywhere as long as it's not replacing the existing LightBlue src/mac/LightAquaBlue directory.
- Go to Project -> Add files... and add all the .h and .m files from LightBlue's src/mac/LightAquaBlue folder. Also add the OBEXFileTransferDictionary.plist, OBEXObjectPushDictionary.plist and SerialPortDictionary.plist files.
- Go to Project -> Add framework... and add IOBluetooth.framework (found at /System/Library/Frameworks/IOBluetooth.framework).
- Click on the "Targets" item in the left-hand column of the Xcode window. This should show all the .h and .m files you've added as well as a few other files. In the "Role" column, all the .h files currently have "project" roles. Click on each drop-down menu item to change all of them to "public".
- Now go to the Finder and locate the xcode project you've just created. Copy the LightAquaBlue.xcode file for the project and paste it in LightBlue's src/mac/LightAquaBlue directory.

Now go to LightBlue's root directory and run the command

	sudo python setup.py install

You should see the output of the build of the xcode project.

lightblue-0.4's People

Contributors

0-1-0 avatar hans avatar kristoff-it avatar rtm-ctrlz 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

Watchers

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

lightblue-0.4's Issues

Can't install light blue on macOS 11.5

lightblue-0.4 % sudo python setup.py install
Password:
running install
running build
running build_py
running install_lib
byte-compiling /Users/timothedesbordes/opt/anaconda3/lib/python3.8/site-packages/lightblue/_bluetoothsockets.py to _bluetoothsockets.cpython-38.pyc
File "/Users/timothedesbordes/opt/anaconda3/lib/python3.8/site-packages/lightblue/_bluetoothsockets.py", line 391
except _socket.error, err:
^
SyntaxError: invalid syntax

byte-compiling /Users/timothedesbordes/opt/anaconda3/lib/python3.8/site-packages/lightblue/_lightblue.py to _lightblue.cpython-38.pyc
File "/Users/timothedesbordes/opt/anaconda3/lib/python3.8/site-packages/lightblue/_lightblue.py", line 60
except _lightbluecommon.BluetoothError, e:
^
SyntaxError: invalid syntax

byte-compiling /Users/timothedesbordes/opt/anaconda3/lib/python3.8/site-packages/lightblue/_macutil.py to _macutil.cpython-38.pyc
File "/Users/timothedesbordes/opt/anaconda3/lib/python3.8/site-packages/lightblue/_macutil.py", line 43
kIOBluetoothServiceBrowserControllerOptionsNone = 0L
^
SyntaxError: invalid syntax

running install_egg_info
Removing /Users/timothedesbordes/opt/anaconda3/lib/python3.8/site-packages/lightblue-0.4-py3.8.egg-info
Writing /Users/timothedesbordes/opt/anaconda3/lib/python3.8/site-packages/lightblue-0.4-py3.8.egg-info
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild install -target LightAquaBlue -configuration Release DSTROOT=/ INSTALL_PATH=/Library/Frameworks DEPLOYMENT_LOCATION=YES

User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES

Build settings from command line:
DEPLOYMENT_LOCATION = YES
DSTROOT = /
INSTALL_PATH = /Library/Frameworks

note: Using new build system
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
error: unable to find sdk '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.4u.sdk' (in target 'LightAquaBlue' from project 'LightAquaBlue')
warning: Traditional headermap style is no longer supported; please migrate to using separate headermaps and set 'ALWAYS_SEARCH_USER_PATHS' to NO. (in target 'LightAquaBlue' from project 'LightAquaBlue')

** INSTALL FAILED **

Unable to successfully import lightblue after installation

I'm running OSX 10.8.3 and encounter an error when trying to import the library.

Python 2.7.2 (default, Oct 11 2012, 20:14:37) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import lightblue

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/__init__.py", line 160, in <module>
    from _lightblue import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/_lightblue.py", line 398, in <module>
    class _AsyncDeviceInquiry(Foundation.NSObject): 
TypeError: Error when calling the metaclass bases
    class _AsyncDeviceInquiry does not fully implement protocol IOBluetoothDeviceInquiryDelegate: no implementation for deviceInquiryDeviceNameUpdated:device:devicesRemaining:

Can't Install on Mac OS 13.2.1

What I've tried

Per installation instructions, download and extract source code, execute sudo python3 setup.py install

What happens

Installation fails with the following output:


/Users/user/Desktop/lightblue-0.4-master/src/mac/LightAquaBlue/BBServiceAdvertiser.m:128:20: error: implicit declaration of function
      'IOBluetoothAddServiceDict' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        IOReturn status = IOBluetoothAddServiceDict((CFDictionaryRef) sdpEntries, &serviceRecordRef);
                          ^
/Users/user/Desktop/lightblue-0.4-master/src/mac/LightAquaBlue/BBServiceAdvertiser.m:142:3: error: implicit declaration of function 'IOBluetoothObjectRelease'
      is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                IOBluetoothObjectRelease(serviceRecordRef);
                ^
/Users/user/Desktop/lightblue-0.4-master/src/mac/LightAquaBlue/BBServiceAdvertiser.m:151:9: error: implicit declaration of function
      'IOBluetoothRemoveServiceWithRecordHandle' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        return IOBluetoothRemoveServiceWithRecordHandle(handle);
               ^
3 errors generated.

** INSTALL FAILED **


The following build commands failed:
	CompileC /Users/user/Desktop/lightblue-0.4-master/src/mac/LightAquaBlue/build/LightAquaBlue.build/Release/LightAquaBlue.build/Objects-normal/x86_64/BBServiceAdvertiser.o /Users/user/Desktop/lightblue-0.4-master/src/mac/LightAquaBlue/BBServiceAdvertiser.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'LightAquaBlue' from project 'LightAquaBlue')
(1 failure)

Issue with OS X yosemite

Hi

I have been getting this error whenever I try to import the lightblue module

Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.7/site-packages/lightblue/init.py", line 160, in
from _lightblue import *
File "/Library/Python/2.7/site-packages/lightblue/_lightblue.py", line 296, in
class _SDPQueryRunner(Foundation.NSObject):
objc.error: _SDPQueryRunner is overriding existing Objective-C class

I have tried the 2nd suggestion found here http://stackoverflow.com/questions/22279913/how-to-install-either-pybluez-or-lightblue-on-osx-10-9-mavericks but no luck.

Any help would be appreciated :)

Signature mismatch for `deviceInquiryComplete:error:aborted`

I get the following error when I first import lightblue:

Traceback (most recent call last):
  File "commander.py", line 3, in <module>
    import lightblue
  File "/usr/local/lib/python2.7/site-packages/lightblue/__init__.py", line 160, in <module>
    from _lightblue import *
  File "/usr/local/lib/python2.7/site-packages/lightblue/_lightblue.py", line 397, in <module>
    class _AsyncDeviceInquiry(Foundation.NSObject):
TypeError: Error when calling the metaclass bases
    class _AsyncDeviceInquiry does not correctly implement protocol IOBluetoothDeviceInquiryDelegate: the signature for method deviceInquiryComplete:error:aborted: is v@:@iB instead of v@:@iZ

LightBlue describes how to resolve this signature mismatch (and I posted a more thorough explanation on Stack Overflow). Since this repo seems to expressly target OS X 10.8, though, I'm wondering if the patch should be in the core code rather than left to the user as a post-install fix.

Are there any 10.8 machines that do need the v@:@iB signature? Unless it varies across Mac hardware, I think the signature should be changed in the code to v@:@iZ.

No architectures to compile for (ARCHS=$(NATIVE_ARCH_ACTUAL)

The installer exits with a failure on my mac:

Check dependencies
No architectures to compile for (ARCHS=$(NATIVE_ARCH_ACTUAL), VALID_ARCHS=i386 x86_64).

** INSTALL FAILED **

It happens both within and outside a virtualenv

What to do? Any ideas?
I'm on MacOS X 10.8.4 with Xcode and command line developer tools installed. 2.4ghz intel core 2 duo.

unable to install via python

I run python setup.py install but I get errors. I'm using OSX 10.13.2. I tried changing the permission of the Library/Frameworks folder to rwx for staff but this error persisted. Any ideas?

(py2710) Adams-MacBook-Pro-4:lightblue-0.4 adamnoack$ python setup.py install
running install
running build
running build_py
running install_lib
running install_egg_info
Removing /Users/adamnoack/anaconda/envs/py2710/lib/python2.7/site-packages/lightblue-0.4-py2.7.egg-info
Writing /Users/adamnoack/anaconda/envs/py2710/lib/python2.7/site-packages/lightblue-0.4-py2.7.egg-info
Build settings from command line:
    ARCHS = x86_64
    DEPLOYMENT_LOCATION = YES
    DSTROOT = /
    INSTALL_PATH = /Library/Frameworks

=== BUILD TARGET LightAquaBlue OF PROJECT LightAquaBlue WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/adamnoack/Desktop/thesis_research/python-mindwave-mobile-py27/lightblue-0.4/src/mac/LightAquaBlue/build/LightAquaBlue.build/Release/LightAquaBlue.build/Objects-normal/x86_64/LightAquaBlue.LinkFileList
/bin/mkdir -p /Users/adamnoack/Desktop/thesis_research/python-mindwave-mobile-py27/lightblue-0.4/src/mac/LightAquaBlue/build/SharedPrecompiledHeaders/LightAquaBlue_Prefix-hdesrmpelnbqitggrloyogevohmt
write-file /Users/adamnoack/Desktop/thesis_research/python-mindwave-mobile-py27/lightblue-0.4/src/mac/LightAquaBlue/build/SharedPrecompiledHeaders/LightAquaBlue_Prefix-hdesrmpelnbqitggrloyogevohmt/LightAquaBlue_Prefix.pch.pch.hash-criteria

Create product structure
/bin/mkdir -p /Library/Frameworks/LightAquaBlue.framework/Versions/A
error: Unable to create directory: /Library/Frameworks/LightAquaBlue.framework/Versions/A (Permission denied)

** INSTALL FAILED **


The following build commands failed:
	Create product structure
(1 failure)

error on Mac OS X 10.13.1

when try to connect a device , it raise an exception in file _macutil.py at line 75:

'module' object has no attribute 'BluetoothDeviceAddress'

error msg:

Traceback (most recent call last):
  File "test.py", line 26, in <module>
    crash(target)
  File "test.py", line 10, in crash
    sock.connect((target, 0xf))
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/_bluetoothsockets.py", line 351, in connect
    _macutil.createbtdevaddr(address[0]))
ValueError: depythonifying struct of 1 members, got tuple of 6

Import error

Hi Guys,

After install lightblue i got this:

Traceback (most recent call last):
File "", line 1, in
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/init.py", line 160, in
from _lightblue import *
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/lightblue/_lightblue.py", line 297, in
class _SDPQueryRunner(Foundation.NSObject):
objc.error: _SDPQueryRunner is overriding existing Objective-C class

any ideia?

NSInvalidArgumentException on send (El Capitain, python 2.7)

Hello,
When running the simple_server.py example, the read is successful, but the write fails.

Connected by ('10:BF:48:D1:22:B8', 1)
Echoing received data: This is my test
Traceback (most recent call last):
  File "simple_server.py", line 18, in <module>
    conn.send(data)
  File "build/bdist.macosx-10.6-x86_64/egg/lightblue/_bluetoothsockets.py", line 524, in send
  File "build/bdist.macosx-10.6-x86_64/egg/lightblue/_bluetoothsockets.py", line 737, in write
ValueError: NSInvalidArgumentException - Class OC_PythonObject: no such selector: bytes

Thanks.

Implicit declaration of function 'IOBluetooth*' is invalid in C99 on macos 11.1

Project is not building because of those three errors:

/Users/isoto/dev/lightblue-0.4/src/mac/LightAquaBlue/BBServiceAdvertiser.m:128:20: Implicit declaration of function 'IOBluetoothAddServiceDict' is invalid in C99

/Users/isoto/dev/lightblue-0.4/src/mac/LightAquaBlue/BBServiceAdvertiser.m:142:3: Implicit declaration of function 'IOBluetoothObjectRelease' is invalid in C99

/Users/isoto/dev/lightblue-0.4/src/mac/LightAquaBlue/BBServiceAdvertiser.m:151:9: Implicit declaration of function 'IOBluetoothRemoveServiceWithRecordHandle' is invalid in C99

help

how to install in windows

CompileC error

This is the error I get:
The following build commands failed:
CompileC /Users/thomask/Downloads/lightblue-0.4-master/src/mac/LightAquaBlue/build/LightAquaBlue.build/Release/LightAquaBlue.build/Objects-normal/x86_64/BBServiceAdvertiser.o /Users/thomask/Downloads/lightblue-0.4-master/src/mac/LightAquaBlue/BBServiceAdvertiser.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'LightAquaBlue' from project 'LightAquaBlue')
(1 failure)

Anyone knows what to do?

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.