Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

asymworks/python-irda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

** AS OF JULY 2021 THIS REPOSITORY HAS BEEN SET TO ARCHIVE MODE AS THE LIBRARY IS NOT CURRENTLY MAINTAINED **

python-irda : IrDA Socket Interface for Python
----------------------------------------------

Author: Jonathan Krauss
E-Mail: jkrauss@asymworks.com

This module implements a lightweight IrDA socket interface for Python. It is modeled after and uses a similar interface to the default Python 'socket' module.  The code has been tested on Linux and Windows 7 64bit.

The code is released under a BSD license.

Basic Usage
-----------

import irda

# Enumerate IrDA Devices
devs = irda.discover()

# Create a new IrDA Socket
sck = irda.irsocket()

# Connect to the first device
sck.set_timeout(2000)
sck.connect(devs[0]['addr'])

# Read and write using send(data) and recv(num_bytes)
sck.send('\x14')
sdat = sck.recv(4)
data = unpack('<L', sdat)[0]

# Close socket when done
sck.close()

Building/Installation
---------------------

Run the following commands (or equivalents) to build and install irsocket:

$ python setup.py build
$ sudo python setup.py install

Building on Windows 10
======================

Timmy from Sweden has provided the following build instructions for Windows 10:

OS: Windows 10
Python version: 2.7.18, x86.

- Enable "IrDA IR" in Windows 10 under "Apps and functions" > "Optional features".

- Run Visual C++ Build Tools (vs_buildtools__819586963.1626546045.exe).

Tick "Desktop development with C++" in the left section.

If you only want the absolutely necessary tools for the purpose of building the IrDA module, tick only "MSVC v142 - VS 2019 C++ x64/x86 build tools (Latest)" and "Windows 10 SDK (10.0.19041.0)" in the right section.

- Edit the file "c:\(Python 2.7)\Lib\distutils\msvc9compiler.py"
Make the function find_vcvarsall() immediately return "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat"

- Make sure that you build/install the module under Python 2 if you have multiple versions on your system.
py -2 setup.py build
and
py -2 setup.py install

Bugs/Additions
--------------

Please feel free to send pull requests or patches to <jkrauss@asymworks.com>