Lorthon是Lora-net/lora_gateway/libloragw/lora网关项目的Python包装器
Raspberry Pi与Seeedstudio的RHF0M301。
Beagleboneblack与Seeedstudio的RHF0M301。
- Transmit
- Receive
- Set TX and RX settings.
先决条件: pip install cython编译: git clone https://github.com/galalmounir/lorthon.git make to to编译和生成Python库。
一旦编译,将在output文件夹内生成库。将Lorthon.SO文件复制到您的Python项目目录。
import lorthon
lorthon.py_LoRaInit("global_conf.json")
py_LoRaTx(freq: int, tx_mode: int, rf_chain: int, rf_power: int, bandwidth: int, datarate: int, coderate: int, preamble: int, no_crc: bool, no_header: bool, payload: bytes, size: int)
lorthon.py_LoRaTx(915000000, 0, 0, 22, 0x03, 0x02, 1, 15, False, False, "HELLO WORLD", 11)
py_LoRaRx()函数返回以JSON格式接收的数据包列表。 packets = lorthon.py_LoRaRx()
{
"packets" : [
{
"frequency" : 914800000 ,
"if_chain" : 1 ,
"status" : 16 ,
"count_us" : 2689979 ,
"rf_chain" : 0 ,
"modulation" : 16 ,
"bandwidth" : 3 ,
"datarate" : 2 ,
"coderate" : 1 ,
"rssi" : -66 ,
"snr" : 9.5 ,
"snr_min" : 7.75 ,
"snr_max" : 12.75 ,
"crc" : 34481 ,
"size" : 25 ,
"payload" : " 030020000048454C4C4F20574F524C4400140000380C002031 "
}
],
"number_of_pkts" : 1
} import lorthon
lorthon . py_LoRaInit ( "global_conf.json" )
lorthon . py_LoRaTx ( 915000000 , 0 , 0 , 22 , 0x03 , 0x02 , 1 , 15 , False , False , "HELLO WORLD" , 11 )
lorthon . py_LoRaStop (); 我一直在不断改善洛顿。我将始终合并工作错误修复。但是,如果您想在库中添加新的东西,请先在Github上创建一个“问题”,以便我们可以在开始实施之前讨论它是否应在库中结束。