MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / create_device_keys

Function create_device_keys

chirpstack/src/storage/device_keys.rs:170–195  ·  view source on GitHub ↗
(dev_eui: Option<EUI64>)

Source from the content-addressed store, hash-verified

168 }
169
170 pub async fn create_device_keys(dev_eui: Option<EUI64>) -> DeviceKeys {
171 let dev_eui = match dev_eui {
172 Some(v) => v,
173 None => {
174 let dp = storage::device_profile::test::create_device_profile(None).await;
175 let a = storage::application::test::create_application(None).await;
176 let d = storage::device::Device {
177 name: "test-dev".into(),
178 dev_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
179 application_id: a.id,
180 device_profile_id: dp.id,
181 ..Default::default()
182 };
183
184 let d = storage::device::create(d).await.unwrap();
185 d.dev_eui
186 }
187 };
188
189 let dk = DeviceKeys {
190 dev_eui,
191 ..Default::default()
192 };
193
194 create(dk).await.unwrap()
195 }
196
197 #[tokio::test]
198 async fn test_device_keys() {

Callers 1

test_device_keysFunction · 0.85

Calls 5

create_device_profileFunction · 0.85
create_applicationFunction · 0.85
unwrapMethod · 0.80
createFunction · 0.70
intoMethod · 0.45

Tested by 1

test_device_keysFunction · 0.68