-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented uplink decoders for tag S / L. 👑
- Loading branch information
1 parent
c16cde6
commit c49b7f7
Showing
17 changed files
with
479 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"log" | ||
|
||
"github.com/truvami/decoder/pkg/decoder/tagsl/v1" | ||
) | ||
|
||
func main() { | ||
log.Println("initializing tag S / L decoder...") | ||
d := tagsl.NewTagSLv1Decoder() | ||
|
||
// decode data | ||
log.Println("decoding data...") | ||
data, err := d.Decode("8002cdcd1300744f5e166018040b14341a", 1, "") | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
// data to json | ||
j, err := json.Marshal(data) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
// print json | ||
log.Printf("result: %s\n", j) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
import ( | ||
"bytes" | ||
"log" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestMain(t *testing.T) { | ||
// Create a buffer to capture the output | ||
var buf bytes.Buffer | ||
log.SetOutput(&buf) | ||
|
||
// Run the main function | ||
main() | ||
|
||
// Check if the expected output is present in the buffer | ||
expectedOutput := `47.041811` | ||
if !strings.Contains(buf.String(), expectedOutput) { | ||
t.Errorf("expected output %q not found", expectedOutput) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.