mirage.libs.ir_utils package

Submodules

mirage.libs.ir_utils.irma module

class mirage.libs.ir_utils.irma.IRMADevice(interface)

Bases: mirage.libs.wireless_utils.device.Device

This device allows to communicate with an IRMA device in order to sniff and inject IR signals. The corresponding interfaces are : irmaX (e.g. “irma0”).

The following capabilities are actually supported :

Capability

Available ?

SNIFFING

yes

INJECTING

yes

CHANGING_FREQUENCY

yes

Warning

This device has been created in order to interact with IR signals using Mirage. It requires an Arduino Uno or Mini, and the electronic schematic and firmware source code are released as open source documents.

classmethod findIRMAs(index=None)
getDeviceIndex()

This method returns the index of the current IRma device.

Returns

device’s index

Return type

int

Example
>>> device.getDeviceIndex()
0

Note

This method is a shared method and can be called from the corresponding Emitters / Receivers.

getFrequency()

This method returns the frequency in use by the current IRma device (in kHz)

Returns

frequency currently in use

Return type

int

Example
>>> device.getFrequency()
38

Note

This method is a shared method and can be called from the corresponding Emitters / Receivers.

getSerialPort()

This method returns the serial port of the current IRma device.

Returns

device’s serial port

Return type

str

Example
>>> device.getSerialPort()
'/dev/ttyUSB0'

Note

This method is a shared method and can be called from the corresponding Emitters / Receivers.

init()

This method initializes the device.

isUp()

This method allows to check if the device is initialized and available for use.

Returns

boolean indicating if the device is up

Return type

bool

recv()

This method receives some datas. If no data is available, this method returns None.

Parameters

data – raw representation of the received data

reset()

This method resets the current IRma device.

Example
>>> device.reset()

Note

This method is a shared method and can be called from the corresponding Emitters / Receivers.

send(packet)

This method sends some datas.

Parameters

data – raw representation of the data to send

setFrequency(freq)

This method allow to set the frequency of the current IRma device (in kHz).

Parameters

freq (int) – frequency to use

Example
>>> device.setFrequency(38)

Note

This method is a shared method and can be called from the corresponding Emitters / Receivers.

sharedMethods = ['setFrequency', 'getFrequency', 'waitData', 'reset', 'getSerialPort', 'getDeviceIndex']
waitData()

This method puts the current IRma device in listening mode, allowing to analyze the incoming IR signals.

Example
>>> device.waitData()

Note

This method is a shared method and can be called from the corresponding Emitters / Receivers.

mirage.libs.ir_utils.packets module

class mirage.libs.ir_utils.packets.IRAiwaPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - Aiwa Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRDenonPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - Denon Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRDishPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - Dish Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRJVCPacket(protocol='JVC', data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - JVC Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRLGPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - LG Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRMitsubishiPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - Mitsubishi Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRNECPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - NEC Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRPacket(protocol='UNKNOWN', data=[])

Bases: mirage.libs.wireless_utils.packets.Packet

Mirage IR Packet

Parameters
  • data (list of int) – data representing the signal

  • protocol (str) – string indicating the protocol currently in use (by default: “UNKNOWN”)

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRPanasonicPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - Panasonic Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRRC5Packet(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - RC5 Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRRC6Packet(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - RC6 Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRSamsungPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - Samsung Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRSanyoPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - Sanyo Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRSharpPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - Sharp Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRSonyPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - Sony Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

class mirage.libs.ir_utils.packets.IRWhynterPacket(data=[], size=None, code=None)

Bases: mirage.libs.ir_utils.packets.IRPacket

Mirage IR Packet - Whynter Packet

Parameters
  • data (list of int) – data representing the signal (optional if a code is provided)

  • code (bytes) – array of bytes indicating the code to transmit

  • size (int) – integer indicating the size (in bits) of the code

toString()

This method allows to explicitely define how a packet is displayed if it is converted as a string.

If this method is not overloaded, the packet is displayed as :
  • << name >> if no additional informations are linked to this packet

  • [ additionalInformations ] << name >> if some additional informations are linked to this packet

mirage.libs.ir_utils.scapy_irma_layers module

This module contains some scapy definitions allowing to interact with an IRma device.