LoRa

class lora.LoRa(_loraModule, _serialPortObj)[source]

Bases: object

LoRa class.

Manages the LoRa operations communicating with LoRa modules.

lock

Semaphore to use LoRa object.

Type:

threading.Lock

loraModule

LoRa module type.

Type:

str

serialPort

Serial object.

Type:

serial.Serial

base_band

LoRa base band.

Type:

str

lora_class

LoRa class.

Type:

str

tx_power

LoRa transmission power.

Type:

int

checkLoRa()[source]

Check if LoRa module is connected and ready to use.

Parameters:

None

Returns:

True - if successfuly / False - if failed

Return type:

bool

getLoRaMaxPayload(loraBaseBand, loraUPDatarate)[source]

Get the maximum payload size based on base band and uplink data rate.

Parameters:
  • loraBaseBand (str) – LoRa base band.

  • loraUPDatarate (str) – Uplink data rate.

Returns:

Maximum payload size.

Return type:

int

sendAckMsgHex(_loraPort, _loraMsg)[source]

Sends confirmed hexadecimal messages.

Parameters:
  • port (_loraPort)

  • message (_loraMsg hexadecimal)

Returns:

None

sendJoinRequest()[source]

Sends a join request.

Parameters:

None

Returns:

True - if successful / False - if failed

Return type:

bool

sendNoAckMsgHex(_loraPort, _loraMsg)[source]

Sends unconfirmed hexadecimal messages.

Parameters:
  • port (_loraPort)

  • message (_loraMsg hexadecimal)

Returns:

None

setAppEUI(appEUI)[source]

Sets the application EUI.

Parameters:

appEUI (str) – application EUI

Returns:

None

setAppKey(appKey)[source]

Sets the application key.

Parameters:

key. (appKey application)

Returns:

None

setAppSKey(appSKey)[source]

Sets the application session key.

Parameters:

key. (appSKey application session)

Returns:

None

setDevAddr(devAddr)[source]

Sets the device address.

Parameters:

devAddr (str) – device address

Returns:

None

setDevEUI(devEUI)[source]

Sets the device EUI.

Parameters:

devEUI (str) – device EUI

Returns:

None

setLoRaADR(loraADR)[source]

Enable or disable ADR (Automatic Data Rate).

Parameters:

loraADR (str) – enable (ON) or disable (OFF)

Returns:

None

setLoRaAuthMode(loraAuthMode)[source]

Sets the authentication mode.

Parameters:

loraAuthMode (str) – authentication mode

Returns:

None

setLoRaBaseBand(loraBaseBand)[source]

Sets the base-band.

Parameters:

loraBaseBand (str) – base-band

Returns:

None

setLoRaClass(loraClass)[source]

Sets the LoRa class.

Parameters:

loraClass (str) – LoRa class

Returns:

None

setLoRaRX1Win()[source]

Enable RX window 1.

setLoRaRX2Win(loraRX2Frequency, loraRX2Datarate)[source]

Sets the RX window 2 parameters.

Parameters:
  • loraRX2Frequency (int) – RX window 2 frequency.

  • loraRX2Datarate (str) – RX window 2 data rate.

Returns:

None

setLoRaSubBand(loraSubBand)[source]

Sets the sub-band. This will disable all channels not belonging to the specified sub-band.

Parameters:

loraSubBand (int) – sub-band

Returns:

None

setLoRaTXPower(loraTXPower)[source]

Sets the transmission power (in dBm).

Parameters:

loraTXPower (int) – transmission power (in dBm)

Returns:

None

setLoRaUPDatarate(loraUPDatarate)[source]

Sets the uplink data rate.

Parameters:

loraUPDatarate (str) – uplink data rate

Returns:

None

setNwkSKey(nwkSKey)[source]

Sets the network session key.

Parameters:

session (nwkSKey network)

Returns:

None