Skip to content

Commit

Permalink
Merge branch 'device_slot' of https://github.com/mrBluestSky/ts_lora_…
Browse files Browse the repository at this point in the history
…chirpstack.git into device_slot
  • Loading branch information
Sa1dzhan committed Sep 21, 2024
2 parents 2580fe1 + 679d3f8 commit e2459bf
Show file tree
Hide file tree
Showing 13 changed files with 2,215 additions and 2,250 deletions.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,20 @@ test-all:
cd chirpstack-integration && cargo test
cd lrwn && make test
cd lrwn-filters && make test

# does everything above
compile-everything:
cd api && make grpc-web
cd ui && make build
docker compose up -d
cd api && make rust
cd backend && cargo test
cd chirpstack && make test
cd lrwn && make test
cd lrwn-filters && make test
cargo install cross --version 0.2.5
cargo install diesel_cli --version 2.1.1 --no-default-features --features postgres
cargo install cargo-deb --version 1.43.1
cargo install cargo-generate-rpm --version 0.12.1
cd api && make grpc-web
cd chirpstack && make dist
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ Or if you do not have Nix installed, execute the following command:
make docker-devshell
```

### Do everything below

If you want to automatically do all the steps below with make dist, enter this command:

```bash
make compile-everything
```

### Building the UI

To build the ChirpStack UI, execute the following command:
Expand Down
21 changes: 14 additions & 7 deletions chirpstack/src/api/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ impl DeviceService for Device {
.await?;

let dev_addr = DevAddr::from_str(&req_ds.dev_addr).map_err(|e| e.status())?;
let multicast_group_id = Uuid::from_str(&req_ds.multicast_group_id).map_err(|e| e.status())?;

let multicast_group_id =
Uuid::from_str(&req_ds.multicast_group_id).map_err(|e| e.status())?;

let ds = device_slot::DeviceSlot {
dev_eui,
Expand Down Expand Up @@ -509,12 +509,15 @@ impl DeviceService for Device {
let slot: u32 = match ds.slot {
Some(s) => s as u32,
None => return Err(Status::invalid_argument("Slot is missing")),
};
};
let dev_addr = match ds.dev_addr {
Some(addr) => addr.to_string(),
None => return Err(Status::invalid_argument("DevAddr is missing or not specified")),
None => {
return Err(Status::invalid_argument(
"DevAddr is missing or not specified",
))
}
};


let response = api::GetDeviceSlotResponse {
dev_addr,
Expand Down Expand Up @@ -553,7 +556,9 @@ impl DeviceService for Device {
created_at: ds.created_at,
};

device_slot::update(updated_ds).await.map_err(|e| e.status())?;
device_slot::update(updated_ds)
.await
.map_err(|e| e.status())?;

Ok(Response::new(()))
}
Expand All @@ -573,7 +578,9 @@ impl DeviceService for Device {
)
.await?;

device_slot::delete(&dev_eui).await.map_err(|e| e.status())?;
device_slot::delete(&dev_eui)
.await
.map_err(|e| e.status())?;

Ok(Response::new(()))
}
Expand Down
3 changes: 3 additions & 0 deletions chirpstack/src/api/tenant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use uuid::Uuid;
use chirpstack_api::api;
use chirpstack_api::api::tenant_service_server::TenantService;

// ./chirpstack/src/api/auth/validator.rs is super::auth::validator
// validator::RequestValidator is an empty struct with lots of traits connected to databases
use super::auth::{validator, AuthID};
use super::error::ToStatus;
use super::helpers;
Expand All @@ -23,6 +25,7 @@ impl Tenant {

#[tonic::async_trait]
impl TenantService for Tenant {
// I guess this function creates an instance of a tenant
async fn create(
&self,
request: Request<api::CreateTenantRequest>,
Expand Down
Loading

0 comments on commit e2459bf

Please sign in to comment.