Commit cda1ddf6 authored by Guillaume Gonnet's avatar Guillaume Gonnet
Browse files

Start adding providers.

parent 4b537b27
......@@ -25,6 +25,8 @@ QUIET ?= 1
# All modules defined in this application.
USEMODULE += cubsat-app
USEMODULE += cubsat-app-providers
USEMODULE += cubsat-app-benchmark
USEMODULE += loramac-mac
USEMODULE += loramac-region
USEMODULE += loramac-crypto
......
......@@ -6,4 +6,6 @@
MODULE := cubsat-app
DIRS += providers
include $(RIOTBASE)/Makefile.base
/*
Cubsat benchmark application.
Copyright (C) 2019, ENSIMAG students
This project is under the MIT license
*/
// Stop the application on an error.
#define PANIC(msg) core_panic(PANIC_GENERAL_ERROR, msg)
typedef struct {
......
/*
Standard benchmark.
Copyright (C) 2019, ENSIMAG students
This project is under the MIT license
*/
#
# Cubsat benchmark application.
#
# Copyright (C) 2019, ENSIMAG students
# This project is under the MIT license
MODULE := cubsat-app-providers
include $(RIOTBASE)/Makefile.base
/*
OTAA (Over-The-Air Activation) abstract provider.
Copyright (C) 2019, ENSIMAG students
This project is under the MIT license
*/
#include "providers"
// Configure LoRaMAC driver with provider information.
void pvd_otaa_configure(provider_t *)
{
// TODO: read join response and frame counter from EEPROM.
}
// Force (re)joining the network.
void pvd_otaa_join(provider_t *);
{
// TODO: set app keys.
if (loramac_join_otaa() != OK)
PANIC("Can't join Orange network.");
// TODO: save join response.
}
/*
All network providers.
Copyright (C) 2019, ENSIMAG students
This project is under the MIT license
*/
#include "providers"
#include "lorakeys.h"
// Orange provider for benchmark.
static pvd_otta_t orange_bm_otta = {
EEPROM_ORANGE_BM,
ORANGE_BM_DEVEUI,
ORANGE_BM_APPEUI,
ORANGE_BM_APPKEY
};
provider_t pvd_orange_bm = PVD_IMPLEM_OTAA(orange_bm_otta);
// Orange provider for commands.
static pvd_otta_t orange_cmd_otta = {
EEPROM_ORANGE_BM,
ORANGE_BM_DEVEUI,
ORANGE_BM_APPEUI,
ORANGE_BM_APPKEY
};
provider_t pvd_orange_cmd = PVD_IMPLEM_OTAA(orange_cmd_otta);
/*
All network providers.
Copyright (C) 2019, ENSIMAG students
This project is under the MIT license
*/
#pragma once
typedef (*pvd_configure_t)(struct provider_t *);
typedef (*pvd_join_t)(struct provider_t *);
typedef struct provider_t {
void *data; // Provider specific data.
pvd_configure_t configure;
pvd_join_t join;
} provider_t;
// OTAA information.
typedef struct pvd_otta_t {
uint16_t eeprom_addr;
uint8_t deveui[16];
uint8_t appeui[16];
uint8_t appkey[32];
} pvd_otta_t;
// OTAA provider implementation.
void pvd_otaa_configure(provider_t *);
void pvd_otaa_join(provider_t *);
// Feed a provider using default OTAA implementation.
#define PVD_IMPLEM_OTAA(otaa_info) \
{ &(otaa_info), pvd_otaa_configure, pvd_otaa_join }
// Orange providers.
extern provider_t pvd_orange_bm;
extern provider_t pvd_orange_cmd;
// TTN provider.
extern provider_t pvd_ttn_bm;
/*
All static keys and IDs used in this application.
Copyright (C) 2019, ENSIMAG students
This project is under the MIT license
*/
// Orange provider for benchmark.
#define ORANGE_BM_DEVEUI
#define ORANGE_BM_APPEUI
#define ORANGE_BM_APPKEY
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment