examples: use shorter names for Lora radio functions

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2023-01-08 18:51:03 +01:00
parent 38ba7772e2
commit 24b6f0f296
5 changed files with 22 additions and 22 deletions
+4 -4
View File
@@ -67,7 +67,7 @@ func msg(data string) error {
cmd := "MSG"
writeCommandOutput(cmd, "Start")
if err := radio.LoraTx([]byte(data), defaultTimeout); err != nil {
if err := radio.Tx([]byte(data), defaultTimeout); err != nil {
writeCommandOutput(cmd, err.Error())
return err
@@ -82,7 +82,7 @@ func cmsg(data string) error {
cmd := "CMSG"
writeCommandOutput(cmd, "Start")
if err := radio.LoraTx([]byte(data), defaultTimeout); err != nil {
if err := radio.Tx([]byte(data), defaultTimeout); err != nil {
writeCommandOutput(cmd, err.Error())
return err
@@ -337,7 +337,7 @@ func send(data string) error {
// remove leading/trailing quotes
data = strings.Trim(data, "\"'")
if err := radio.LoraTx([]byte(data), defaultTimeout); err != nil {
if err := radio.Tx([]byte(data), defaultTimeout); err != nil {
writeCommandOutput(cmd, err.Error())
return err
@@ -363,7 +363,7 @@ func sendhex(data string) error {
return err
}
if err := radio.LoraTx(payload, defaultTimeout); err != nil {
if err := radio.Tx(payload, defaultTimeout); err != nil {
writeCommandOutput(cmd, err.Error())
return err
+8 -8
View File
@@ -11,12 +11,12 @@ var (
type LoraRadio interface {
Reset()
LoraTx(pkt []uint8, timeoutMs uint32) error
LoraRx(timeoutMs uint32) ([]uint8, error)
SetLoraFrequency(freq uint32)
SetLoraIqMode(mode uint8)
SetLoraCodingRate(cr uint8)
SetLoraBandwidth(bw uint8)
SetLoraCrc(enable bool)
SetLoraSpreadingFactor(sf uint8)
Tx(pkt []uint8, timeoutMs uint32) error
Rx(timeoutMs uint32) ([]uint8, error)
SetFrequency(freq uint32)
SetIqMode(mode uint8)
SetCodingRate(cr uint8)
SetBandwidth(bw uint8)
SetCrc(enable bool)
SetSpreadingFactor(sf uint8)
}
+8 -8
View File
@@ -13,20 +13,20 @@ type SimLoraRadio struct {
func (sr *SimLoraRadio) Reset() {
}
func (sr *SimLoraRadio) LoraTx(pkt []uint8, timeoutMs uint32) error {
func (sr *SimLoraRadio) Tx(pkt []uint8, timeoutMs uint32) error {
return nil
}
func (sr *SimLoraRadio) LoraRx(timeoutMs uint32) ([]uint8, error) {
func (sr *SimLoraRadio) Rx(timeoutMs uint32) ([]uint8, error) {
return nil, nil
}
func (sr *SimLoraRadio) SetLoraFrequency(freq uint32) {}
func (sr *SimLoraRadio) SetLoraIqMode(mode uint8) {}
func (sr *SimLoraRadio) SetLoraCodingRate(cr uint8) {}
func (sr *SimLoraRadio) SetLoraBandwidth(bw uint8) {}
func (sr *SimLoraRadio) SetLoraCrc(enable bool) {}
func (sr *SimLoraRadio) SetLoraSpreadingFactor(sf uint8) {}
func (sr *SimLoraRadio) SetFrequency(freq uint32) {}
func (sr *SimLoraRadio) SetIqMode(mode uint8) {}
func (sr *SimLoraRadio) SetCodingRate(cr uint8) {}
func (sr *SimLoraRadio) SetBandwidth(bw uint8) {}
func (sr *SimLoraRadio) SetCrc(enable bool) {}
func (sr *SimLoraRadio) SetSpreadingFactor(sf uint8) {}
func firmwareVersion() string {
return "simulator " + currentVersion()
+1 -1
View File
@@ -65,5 +65,5 @@ func firmwareVersion() string {
}
func lorarx() ([]byte, error) {
return loraRadio.LoraRx(LORA_DEFAULT_RXTIMEOUT_MS)
return loraRadio.Rx(LORA_DEFAULT_RXTIMEOUT_MS)
}
+1 -1
View File
@@ -81,5 +81,5 @@ func firmwareVersion() string {
}
func lorarx() ([]byte, error) {
return loraRadio.LoraRx(LORA_DEFAULT_RXTIMEOUT_MS)
return loraRadio.Rx(LORA_DEFAULT_RXTIMEOUT_MS)
}