swARM-at


NameswARM-at JSON
Version 0.0 PyPI version JSON
download
home_pagehttps://gitlab.com/Apocalypzer/swarm_at
SummaryUne bibliothèque pour la communication avec des modules LoRa via des commandes AT.
upload_time2024-02-05 22:13:14
maintainer
docs_urlNone
authorJoffrey Herard
requires_python
license
keywords lora at command rak3172
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # swARM_at

https://docs.rakwireless.com/Product-Categories/WisDuo/RAK3172-Module/Deprecated-AT-Command/

## Class: RAK3172

This class provides an interface to interact with the RAK3172 module via serial communication for both LoRaWAN and P2P communications.

### init(self, port, baud_rate=9600, timeout=1)
Description: Initializes a new instance of the RAK3172 class.
Parameters:
port (str): The COM port where the module is connected.
baud_rate (int, optional): Baud rate for serial communication. Default is 9600.
timeout (int, optional): Timeout for serial communication in seconds. Default is 1.
Exceptions:
Raises InvalidCOMPortException if the provided COM port is not valid.
Raises InvalidBaudRateException if the provided baud rate is not valid.

### connect(self)
Description: Establishes a serial connection with the module.
Output: Prints a message indicating the success or failure of the connection.
### disconnect(self)
Description: Closes the serial connection with the module.
Output: Prints a message indicating that the module has been disconnected.

### set_network_mode(self, lorawan=True)

Description: Sets the network mode to either LoRaWAN or P2P.
Parameters:
lorawan (bool, optional): If True, sets the mode to LoRaWAN, otherwise to P2P. Default is True.
Output: Prints a message indicating the success or failure of the operation.
Returns: The current network mode.
### send_command(self, command)

Description: Sends a command to the module and reads the response.
Parameters:
command (str): The command to send.
Returns: Boolean indicating the success or failure of the command.
### set_app_key(self, app_key)

Description: Sets the application key for LoRaWAN.
Parameters:
app_key (str): The application key to set.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_app_key(self)

Description: Retrieves the current application key.
Returns: The application key or None if the operation fails.
### set_app_eui(self, app_eui)

Description: Sets the application EUI.
Parameters:
app_eui (str): The application EUI to set.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_app_eui(self)

Description: Retrieves the current application EUI.
Returns: The application EUI or None if the operation fails.

### is_only_hex(self, chaine)

Description: Utility method to check if a string contains only hexadecimal characters.
Parameters:
chaine (str): The string to check.
Returns: Boolean indicating whether the string contains only hexadecimal characters.
### set_dev_eui(self, dev_eui)

Description: Sets the device EUI.
Parameters:
dev_eui (str): The device EUI to set.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_dev_eui(self)

Description: Retrieves the current device EUI.
Returns: The device EUI or None if the operation fails.
### set_nwks_key(self, nwks_key)

Description: Sets the network session key for LoRaWAN.
Parameters:
nwks_key (str): The network session key to set.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_nwks_key(self)

Description: Retrieves the current network session key.
Returns: The network session key or None if the operation fails.
### set_apps_key(self, apps_key)

Description: Sets the application session key for LoRaWAN.
Parameters:
apps_key (str): The application session key to set.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_apps_key(self)

Description: Retrieves the current application session key.
Returns: The application session key or None if the operation fails.
### set_dev_addr(self, dev_addr)

Description: Sets the device address for LoRaWAN.
Parameters:
dev_addr (str): The device address to set.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_dev_addr(self)

Description: Retrieves the current device address.
Returns: The device address or None if the operation fails.
### set_join_mode(self, otaa=True)

Description: Sets the join mode to either OTAA or ABP for LoRaWAN.
Parameters:
otaa (bool, optional): If True, sets the mode to OTAA, otherwise to ABP. Default is True.
Output: Prints a message indicating the success or failure of the operation.
Returns: The current join mode.


### set_confirm_mode(self, confirmed=True)

Description: Sets the payload mode to either confirmed or unconfirmed for LoRaWAN.
Parameters:
confirmed (bool, optional): If True, sets the mode to confirmed, otherwise to unconfirmed. Default is True.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating the current payload mode.
### join_network(self, join=1, auto_join=0, reattempt_interval=8, join_attempts=0)

Description: Sends a command to join the LoRaWAN network.
Parameters:
join (int): Join command, usually 1 to join.
auto_join (int): Auto join option, 1 for auto join, 0 for manual.
reattempt_interval (int): Interval in seconds for reattempting join.
join_attempts (int): Number of join attempts.
Output: Prints a message indicating the success, failure, or response of the join command.
Returns: Boolean indicating success, failure, or None for uncertain status.
### check_join_status(self)

Description: Checks if the module has joined the LoRaWAN network.
Returns: Boolean indicating if the module is joined to the network.
### send_lorawan_data(self, port, payload)

Description: Sends data over LoRaWAN.
Parameters:
port (int): The port number to send data on.
payload (str): The payload to send.
Output: Prints a message indicating the success or failure of sending data.
Returns: Boolean indicating success or failure of the data transmission.
### check_last_frame_status(self)

Description: Checks the status of the last frame sent over LoRaWAN.
Returns: Boolean indicating if the last frame was confirmed by the network, or None for uncertain status.
### receive_data(self)

Description: Retrieves data received by the module.
Returns: A tuple containing the port and payload of received data, or (None, None) if no data is received or in case of an error.
### set_adr(self, enable)

Description: Enables or disables Adaptive Data Rate (ADR).
Parameters:
enable (bool): Set to True to enable ADR, False to disable.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure of setting ADR.
### get_adr_status(self)

Description: Retrieves the current status of ADR.
Returns: Boolean indicating if ADR is enabled or disabled, or None for uncertain status.

### set_lorawan_class(self, lorawan_class)

Description: Sets the LoRaWAN class of the device.
Parameters:
lorawan_class (str): The class to set ('A', 'B', or 'C').
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_lorawan_class(self)

Description: Retrieves the current LoRaWAN class of the device.
Returns: A string indicating the current LoRaWAN class or None if the operation fails.
### set_duty_cycle(self, enable)

Description: Enables or disables the duty cycle.
Parameters:
enable (bool): Set to True to enable the duty cycle, False to disable.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_duty_cycle(self)

Description: Retrieves the current status of the duty cycle.
Returns: A string indicating if the duty cycle is enabled or disabled, or None if the operation fails.
### set_frequency_band(self, band)

Description: Sets the frequency band for LoRaWAN communication.
Parameters:
band (str): The frequency band to set.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_frequency_band(self)

Description: Retrieves the current frequency band for LoRaWAN communication.
Returns: A string indicating the current frequency band or None if the operation fails.
### set_link_check(self, mode)

Description: Sets the link check mode.
Parameters:
mode (int): The link check mode to set (0, 1, or 2).
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_link_check(self)

Description: Retrieves the current link check mode.
Returns: An integer indicating the current link check mode or None if the operation fails.
### set_public_network_mode(self, mode)

Description: Sets the public network mode.
Parameters:
mode (str): '0' for private network mode, '1' for public network mode.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_public_network_mode(self)

Description: Retrieves the current public network mode.
Returns: A string indicating the current public network mode or None if the operation fails.
### get_local_time(self)

Description: Retrieves the local time in UTC format.
Returns: A string indicating the local time or None if the operation fails.

### get_rssi(self)

Description: Retrieves the RSSI (Received Signal Strength Indicator) of the last received packet.
Returns: An integer indicating the RSSI value in dBm, or None if the operation fails.
### get_snr(self)

Description: Retrieves the SNR (Signal-to-Noise Ratio) of the last received packet.
Returns: An integer indicating the SNR value, or None if the operation fails.
### request_utc_time(self)

Description: Sends a request for UTC time to the network.
Output: Prints a message indicating the success or failure of the request.
Returns: Boolean indicating success or failure of the UTC time request.
### set_p2p_frequency(self, frequency)

Description: Sets the frequency for P2P communication.
Parameters:
frequency (int): The frequency to set in Hz.
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_p2p_frequency(self)

Description: Retrieves the current frequency for P2P communication.
Returns: An integer indicating the current P2P frequency in Hz, or None if the operation fails.
### set_p2p_spreading_factor(self, sf)

Description: Sets the spreading factor for P2P communication.
Parameters:
sf (int): The spreading factor to set (between 6 and 12).
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_p2p_spreading_factor(self)

Description: Retrieves the current spreading factor for P2P communication.
Returns: An integer indicating the current spreading factor, or None if the operation fails.
### set_p2p_bandwidth(self, bw)

Description: Sets the bandwidth for P2P communication.
Parameters:
bw (int): The bandwidth to set in kHz (125, 250, or 500).
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_p2p_bandwidth(self)

Description: Retrieves the current bandwidth for P2P communication.
Returns: An integer indicating the current bandwidth in kHz, or None if the operation fails.
### set_p2p_coding_rate(self, cr)

Description: Sets the coding rate for P2P communication.
Parameters:
cr (int): The coding rate to set (0 for 4/5, 1 for 4/6, 2 for 4/7, or 3 for 4/8).
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_p2p_coding_rate(self)

Description: Retrieves the current coding rate for P2P communication.
Returns: An integer indicating the current coding rate, or None if the operation fails.

### set_p2p_parameters(self, freq, sf, bw, cr, preamble, power)

Description: Sets multiple P2P parameters at once.
Parameters:
freq (int): Frequency in Hz.
sf (int): Spreading factor (between 6 and 12).
bw (int): Bandwidth in kHz (125, 250, or 500).
cr (int): Coding rate (0 for 4/5, 1 for 4/6, 2 for 4/7, or 3 for 4/8).
preamble (int): Preamble length (between 2 and 65535).
power (int): Transmit power (between 5 and 22 dBm).
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### get_p2p_parameters(self)

Description: Retrieves the current P2P parameters.
Returns: A list containing the current P2P parameters (frequency, spreading factor, bandwidth, coding rate, preamble length, and power) or None if the operation fails.
### send_p2p_data(self, payload)

Description: Sends data in P2P mode.
Parameters:
payload (str): The payload to send (maximum 255 bytes).
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.
### set_p2p_receive_window(self, timeout)

Description: Sets the P2P receive window timeout.
Parameters:
timeout (int): Timeout in milliseconds (0 for no timeout, up to 65535).
Output: Prints a message indicating the success or failure of the operation.
Returns: Boolean indicating success or failure.

## Examples

A simple example to join a LoRaWAN Network using OTAA method.

```python
from swARM_at.RAK3172 import RAK3172, VALID_BAUD_RATE, VALID_COM_PORT, VALIDE_BAND
from swARM_at.exceptions import InvalidBaudRateException, InvalidCOMPortException
rak = RAK3172("COM3")
rak.connect()
rak.set_network_mode()
rak.set_join_mode()
rak.join_network(1, 0, 10, 8)
rak.check_join_status()
rak.send_lorawan_data(20,"112233445566778899")
```


A simple example to display LoRaWAN device infos 

```python
from swARM_at.RAK3172 import RAK3172, VALID_BAUD_RATE, VALID_COM_PORT, VALIDE_BAND
from swARM_at.exceptions import InvalidBaudRateException, InvalidCOMPortException
rak = RAK3172("COM3")
rak.connect()
devEUI=rak.get_dev_eui()
AppEUI=rak.get_app_eui()
AppKey=rak.get_app_key()
print(f'DevEUI={devEUI}\r\nAppEUI={AppEUI}\r\nAppKey={AppKey}')
```

A simple example to send somehtin in LoRa Mode and set a RX Window

```python
from swARM_at.RAK3172 import RAK3172, VALID_BAUD_RATE, VALID_COM_PORT, VALIDE_BAND
from swARM_at.exceptions import InvalidBaudRateException, InvalidCOMPortException
rak = RAK3172("COM3")
rak.connect()
rak.set_network_mode(False)
rak.send_p2p_data("FF112233")
rak.set_p2p_receive_window(5000)
print(rak.read_response())
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/Apocalypzer/swarm_at",
    "name": "swARM-at",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "LoRa AT command RAK3172",
    "author": "Joffrey Herard",
    "author_email": "joffrey.herard@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e3/c8/27d8abd710800b48340d9ee2c2ca03f733a125b117f1111cd8afdaf77368/swARM_at-0.0.tar.gz",
    "platform": null,
    "description": "# swARM_at\n\nhttps://docs.rakwireless.com/Product-Categories/WisDuo/RAK3172-Module/Deprecated-AT-Command/\n\n## Class: RAK3172\n\nThis class provides an interface to interact with the RAK3172 module via serial communication for both LoRaWAN and P2P communications.\n\n### init(self, port, baud_rate=9600, timeout=1)\nDescription: Initializes a new instance of the RAK3172 class.\nParameters:\nport (str): The COM port where the module is connected.\nbaud_rate (int, optional): Baud rate for serial communication. Default is 9600.\ntimeout (int, optional): Timeout for serial communication in seconds. Default is 1.\nExceptions:\nRaises InvalidCOMPortException if the provided COM port is not valid.\nRaises InvalidBaudRateException if the provided baud rate is not valid.\n\n### connect(self)\nDescription: Establishes a serial connection with the module.\nOutput: Prints a message indicating the success or failure of the connection.\n### disconnect(self)\nDescription: Closes the serial connection with the module.\nOutput: Prints a message indicating that the module has been disconnected.\n\n### set_network_mode(self, lorawan=True)\n\nDescription: Sets the network mode to either LoRaWAN or P2P.\nParameters:\nlorawan (bool, optional): If True, sets the mode to LoRaWAN, otherwise to P2P. Default is True.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: The current network mode.\n### send_command(self, command)\n\nDescription: Sends a command to the module and reads the response.\nParameters:\ncommand (str): The command to send.\nReturns: Boolean indicating the success or failure of the command.\n### set_app_key(self, app_key)\n\nDescription: Sets the application key for LoRaWAN.\nParameters:\napp_key (str): The application key to set.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_app_key(self)\n\nDescription: Retrieves the current application key.\nReturns: The application key or None if the operation fails.\n### set_app_eui(self, app_eui)\n\nDescription: Sets the application EUI.\nParameters:\napp_eui (str): The application EUI to set.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_app_eui(self)\n\nDescription: Retrieves the current application EUI.\nReturns: The application EUI or None if the operation fails.\n\n### is_only_hex(self, chaine)\n\nDescription: Utility method to check if a string contains only hexadecimal characters.\nParameters:\nchaine (str): The string to check.\nReturns: Boolean indicating whether the string contains only hexadecimal characters.\n### set_dev_eui(self, dev_eui)\n\nDescription: Sets the device EUI.\nParameters:\ndev_eui (str): The device EUI to set.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_dev_eui(self)\n\nDescription: Retrieves the current device EUI.\nReturns: The device EUI or None if the operation fails.\n### set_nwks_key(self, nwks_key)\n\nDescription: Sets the network session key for LoRaWAN.\nParameters:\nnwks_key (str): The network session key to set.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_nwks_key(self)\n\nDescription: Retrieves the current network session key.\nReturns: The network session key or None if the operation fails.\n### set_apps_key(self, apps_key)\n\nDescription: Sets the application session key for LoRaWAN.\nParameters:\napps_key (str): The application session key to set.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_apps_key(self)\n\nDescription: Retrieves the current application session key.\nReturns: The application session key or None if the operation fails.\n### set_dev_addr(self, dev_addr)\n\nDescription: Sets the device address for LoRaWAN.\nParameters:\ndev_addr (str): The device address to set.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_dev_addr(self)\n\nDescription: Retrieves the current device address.\nReturns: The device address or None if the operation fails.\n### set_join_mode(self, otaa=True)\n\nDescription: Sets the join mode to either OTAA or ABP for LoRaWAN.\nParameters:\notaa (bool, optional): If True, sets the mode to OTAA, otherwise to ABP. Default is True.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: The current join mode.\n\n\n### set_confirm_mode(self, confirmed=True)\n\nDescription: Sets the payload mode to either confirmed or unconfirmed for LoRaWAN.\nParameters:\nconfirmed (bool, optional): If True, sets the mode to confirmed, otherwise to unconfirmed. Default is True.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating the current payload mode.\n### join_network(self, join=1, auto_join=0, reattempt_interval=8, join_attempts=0)\n\nDescription: Sends a command to join the LoRaWAN network.\nParameters:\njoin (int): Join command, usually 1 to join.\nauto_join (int): Auto join option, 1 for auto join, 0 for manual.\nreattempt_interval (int): Interval in seconds for reattempting join.\njoin_attempts (int): Number of join attempts.\nOutput: Prints a message indicating the success, failure, or response of the join command.\nReturns: Boolean indicating success, failure, or None for uncertain status.\n### check_join_status(self)\n\nDescription: Checks if the module has joined the LoRaWAN network.\nReturns: Boolean indicating if the module is joined to the network.\n### send_lorawan_data(self, port, payload)\n\nDescription: Sends data over LoRaWAN.\nParameters:\nport (int): The port number to send data on.\npayload (str): The payload to send.\nOutput: Prints a message indicating the success or failure of sending data.\nReturns: Boolean indicating success or failure of the data transmission.\n### check_last_frame_status(self)\n\nDescription: Checks the status of the last frame sent over LoRaWAN.\nReturns: Boolean indicating if the last frame was confirmed by the network, or None for uncertain status.\n### receive_data(self)\n\nDescription: Retrieves data received by the module.\nReturns: A tuple containing the port and payload of received data, or (None, None) if no data is received or in case of an error.\n### set_adr(self, enable)\n\nDescription: Enables or disables Adaptive Data Rate (ADR).\nParameters:\nenable (bool): Set to True to enable ADR, False to disable.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure of setting ADR.\n### get_adr_status(self)\n\nDescription: Retrieves the current status of ADR.\nReturns: Boolean indicating if ADR is enabled or disabled, or None for uncertain status.\n\n### set_lorawan_class(self, lorawan_class)\n\nDescription: Sets the LoRaWAN class of the device.\nParameters:\nlorawan_class (str): The class to set ('A', 'B', or 'C').\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_lorawan_class(self)\n\nDescription: Retrieves the current LoRaWAN class of the device.\nReturns: A string indicating the current LoRaWAN class or None if the operation fails.\n### set_duty_cycle(self, enable)\n\nDescription: Enables or disables the duty cycle.\nParameters:\nenable (bool): Set to True to enable the duty cycle, False to disable.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_duty_cycle(self)\n\nDescription: Retrieves the current status of the duty cycle.\nReturns: A string indicating if the duty cycle is enabled or disabled, or None if the operation fails.\n### set_frequency_band(self, band)\n\nDescription: Sets the frequency band for LoRaWAN communication.\nParameters:\nband (str): The frequency band to set.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_frequency_band(self)\n\nDescription: Retrieves the current frequency band for LoRaWAN communication.\nReturns: A string indicating the current frequency band or None if the operation fails.\n### set_link_check(self, mode)\n\nDescription: Sets the link check mode.\nParameters:\nmode (int): The link check mode to set (0, 1, or 2).\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_link_check(self)\n\nDescription: Retrieves the current link check mode.\nReturns: An integer indicating the current link check mode or None if the operation fails.\n### set_public_network_mode(self, mode)\n\nDescription: Sets the public network mode.\nParameters:\nmode (str): '0' for private network mode, '1' for public network mode.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_public_network_mode(self)\n\nDescription: Retrieves the current public network mode.\nReturns: A string indicating the current public network mode or None if the operation fails.\n### get_local_time(self)\n\nDescription: Retrieves the local time in UTC format.\nReturns: A string indicating the local time or None if the operation fails.\n\n### get_rssi(self)\n\nDescription: Retrieves the RSSI (Received Signal Strength Indicator) of the last received packet.\nReturns: An integer indicating the RSSI value in dBm, or None if the operation fails.\n### get_snr(self)\n\nDescription: Retrieves the SNR (Signal-to-Noise Ratio) of the last received packet.\nReturns: An integer indicating the SNR value, or None if the operation fails.\n### request_utc_time(self)\n\nDescription: Sends a request for UTC time to the network.\nOutput: Prints a message indicating the success or failure of the request.\nReturns: Boolean indicating success or failure of the UTC time request.\n### set_p2p_frequency(self, frequency)\n\nDescription: Sets the frequency for P2P communication.\nParameters:\nfrequency (int): The frequency to set in Hz.\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_p2p_frequency(self)\n\nDescription: Retrieves the current frequency for P2P communication.\nReturns: An integer indicating the current P2P frequency in Hz, or None if the operation fails.\n### set_p2p_spreading_factor(self, sf)\n\nDescription: Sets the spreading factor for P2P communication.\nParameters:\nsf (int): The spreading factor to set (between 6 and 12).\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_p2p_spreading_factor(self)\n\nDescription: Retrieves the current spreading factor for P2P communication.\nReturns: An integer indicating the current spreading factor, or None if the operation fails.\n### set_p2p_bandwidth(self, bw)\n\nDescription: Sets the bandwidth for P2P communication.\nParameters:\nbw (int): The bandwidth to set in kHz (125, 250, or 500).\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_p2p_bandwidth(self)\n\nDescription: Retrieves the current bandwidth for P2P communication.\nReturns: An integer indicating the current bandwidth in kHz, or None if the operation fails.\n### set_p2p_coding_rate(self, cr)\n\nDescription: Sets the coding rate for P2P communication.\nParameters:\ncr (int): The coding rate to set (0 for 4/5, 1 for 4/6, 2 for 4/7, or 3 for 4/8).\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_p2p_coding_rate(self)\n\nDescription: Retrieves the current coding rate for P2P communication.\nReturns: An integer indicating the current coding rate, or None if the operation fails.\n\n### set_p2p_parameters(self, freq, sf, bw, cr, preamble, power)\n\nDescription: Sets multiple P2P parameters at once.\nParameters:\nfreq (int): Frequency in Hz.\nsf (int): Spreading factor (between 6 and 12).\nbw (int): Bandwidth in kHz (125, 250, or 500).\ncr (int): Coding rate (0 for 4/5, 1 for 4/6, 2 for 4/7, or 3 for 4/8).\npreamble (int): Preamble length (between 2 and 65535).\npower (int): Transmit power (between 5 and 22 dBm).\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### get_p2p_parameters(self)\n\nDescription: Retrieves the current P2P parameters.\nReturns: A list containing the current P2P parameters (frequency, spreading factor, bandwidth, coding rate, preamble length, and power) or None if the operation fails.\n### send_p2p_data(self, payload)\n\nDescription: Sends data in P2P mode.\nParameters:\npayload (str): The payload to send (maximum 255 bytes).\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n### set_p2p_receive_window(self, timeout)\n\nDescription: Sets the P2P receive window timeout.\nParameters:\ntimeout (int): Timeout in milliseconds (0 for no timeout, up to 65535).\nOutput: Prints a message indicating the success or failure of the operation.\nReturns: Boolean indicating success or failure.\n\n## Examples\n\nA simple example to join a LoRaWAN Network using OTAA method.\n\n```python\nfrom swARM_at.RAK3172 import RAK3172, VALID_BAUD_RATE, VALID_COM_PORT, VALIDE_BAND\nfrom swARM_at.exceptions import InvalidBaudRateException, InvalidCOMPortException\nrak = RAK3172(\"COM3\")\nrak.connect()\nrak.set_network_mode()\nrak.set_join_mode()\nrak.join_network(1, 0, 10, 8)\nrak.check_join_status()\nrak.send_lorawan_data(20,\"112233445566778899\")\n```\n\n\nA simple example to display LoRaWAN device infos \n\n```python\nfrom swARM_at.RAK3172 import RAK3172, VALID_BAUD_RATE, VALID_COM_PORT, VALIDE_BAND\nfrom swARM_at.exceptions import InvalidBaudRateException, InvalidCOMPortException\nrak = RAK3172(\"COM3\")\nrak.connect()\ndevEUI=rak.get_dev_eui()\nAppEUI=rak.get_app_eui()\nAppKey=rak.get_app_key()\nprint(f'DevEUI={devEUI}\\r\\nAppEUI={AppEUI}\\r\\nAppKey={AppKey}')\n```\n\nA simple example to send somehtin in LoRa Mode and set a RX Window\n\n```python\nfrom swARM_at.RAK3172 import RAK3172, VALID_BAUD_RATE, VALID_COM_PORT, VALIDE_BAND\nfrom swARM_at.exceptions import InvalidBaudRateException, InvalidCOMPortException\nrak = RAK3172(\"COM3\")\nrak.connect()\nrak.set_network_mode(False)\nrak.send_p2p_data(\"FF112233\")\nrak.set_p2p_receive_window(5000)\nprint(rak.read_response())\n```\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Une biblioth\u00e8que pour la communication avec des modules LoRa via des commandes AT.",
    "version": "0.0",
    "project_urls": {
        "Homepage": "https://gitlab.com/Apocalypzer/swarm_at"
    },
    "split_keywords": [
        "lora",
        "at",
        "command",
        "rak3172"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "34ced9803f5abf50068671f6d5c3f06433c350bdbdf5bcdbe91944b3fc9165b7",
                "md5": "0aaa2e5ddfe72d539d9c57d125d8bf0c",
                "sha256": "91716608d5818f4949299f12ac713b1499ff2e73c27226ae8c2881c458c3d3e5"
            },
            "downloads": -1,
            "filename": "swARM_at-0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0aaa2e5ddfe72d539d9c57d125d8bf0c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 15725,
            "upload_time": "2024-02-05T22:13:12",
            "upload_time_iso_8601": "2024-02-05T22:13:12.056068Z",
            "url": "https://files.pythonhosted.org/packages/34/ce/d9803f5abf50068671f6d5c3f06433c350bdbdf5bcdbe91944b3fc9165b7/swARM_at-0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e3c827d8abd710800b48340d9ee2c2ca03f733a125b117f1111cd8afdaf77368",
                "md5": "0ef494028dfebcc5a32a298544dd20e1",
                "sha256": "6687aa515c91802e5ef95411733e5bd5bcb5bf89820b26d5f9790151dcb12b27"
            },
            "downloads": -1,
            "filename": "swARM_at-0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0ef494028dfebcc5a32a298544dd20e1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17032,
            "upload_time": "2024-02-05T22:13:14",
            "upload_time_iso_8601": "2024-02-05T22:13:14.092877Z",
            "url": "https://files.pythonhosted.org/packages/e3/c8/27d8abd710800b48340d9ee2c2ca03f733a125b117f1111cd8afdaf77368/swARM_at-0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-05 22:13:14",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "Apocalypzer",
    "gitlab_project": "swarm_at",
    "lcname": "swarm-at"
}
        
Elapsed time: 0.22368s