Skip to content

Commit c1e49b8

Browse files
committed
dr: Update comments
1 parent 656eb1e commit c1e49b8

File tree

10 files changed

+49
-48
lines changed

10 files changed

+49
-48
lines changed

api/api.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2829,8 +2829,8 @@ and allows clients to claim end devices.
28292829
| Field | Type | Label | Description |
28302830
| ----- | ---- | ----- | ----------- |
28312831
| `application_ids` | [`ApplicationIdentifiers`](#ttn.lorawan.v3.ApplicationIdentifiers) | | Application identifiers. |
2832-
| `version_ids` | [`EndDeviceVersionIdentifiers`](#ttn.lorawan.v3.EndDeviceVersionIdentifiers) | | End device version information. If EndDeviceProfileIdentifiers is not present in the request, the End Device Template is constructed from the End Device Profile that matches the BandID within EndDeviceVersionIdentifiers. |
2833-
| `end_device_profile_ids` | [`GetTemplateRequest.EndDeviceProfileIdentifiers`](#ttn.lorawan.v3.GetTemplateRequest.EndDeviceProfileIdentifiers) | | (Optional) End Device Profile identifiers. If specified, these identifiers will be directly to used to fetch the End Device Profile (if found) |
2832+
| `version_ids` | [`EndDeviceVersionIdentifiers`](#ttn.lorawan.v3.EndDeviceVersionIdentifiers) | | End device version information. EndDeviceProfileIdentifiers take precedence over this field if both are specified. |
2833+
| `end_device_profile_ids` | [`GetTemplateRequest.EndDeviceProfileIdentifiers`](#ttn.lorawan.v3.GetTemplateRequest.EndDeviceProfileIdentifiers) | | End device profile identifiers. |
28342834

28352835
#### Field Rules
28362836

@@ -2840,12 +2840,12 @@ and allows clients to claim end devices.
28402840

28412841
### <a name="ttn.lorawan.v3.GetTemplateRequest.EndDeviceProfileIdentifiers">Message `GetTemplateRequest.EndDeviceProfileIdentifiers`</a>
28422842

2843-
Identifiers to uniquely identify a LoRaWAN End Device Profile.
2843+
Identifiers to uniquely identify a LoRaWAN end device profile.
28442844

28452845
| Field | Type | Label | Description |
28462846
| ----- | ---- | ----- | ----------- |
28472847
| `vendor_id` | [`uint32`](#uint32) | | VendorID managed by the LoRa Alliance, as defined in TR005. |
2848-
| `vendor_profile_id` | [`uint32`](#uint32) | | ID of the LoRAWAN device profile. The name of this field follows the TR005 specification. |
2848+
| `vendor_profile_id` | [`uint32`](#uint32) | | ID of the LoRaWAN end device profile. The naming of this field follows the TR005 specification. |
28492849

28502850
#### Field Rules
28512851

api/api.swagger.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -4412,7 +4412,7 @@
44124412
},
44134413
{
44144414
"name": "end_device_profile_ids.vendor_profile_id",
4415-
"description": "ID of the LoRAWAN device profile. The name of this field follows the TR005 specification.",
4415+
"description": "ID of the LoRaWAN end device profile. The naming of this field follows the TR005 specification.",
44164416
"in": "query",
44174417
"required": false,
44184418
"type": "integer",
@@ -4536,7 +4536,7 @@
45364536
},
45374537
{
45384538
"name": "end_device_profile_ids.vendor_profile_id",
4539-
"description": "ID of the LoRAWAN device profile. The name of this field follows the TR005 specification.",
4539+
"description": "ID of the LoRaWAN end device profile. The naming of this field follows the TR005 specification.",
45404540
"in": "path",
45414541
"required": true,
45424542
"type": "integer",
@@ -11366,10 +11366,10 @@
1136611366
"vendor_profile_id": {
1136711367
"type": "integer",
1136811368
"format": "int64",
11369-
"description": "ID of the LoRAWAN device profile. The name of this field follows the TR005 specification."
11369+
"description": "ID of the LoRaWAN end device profile. The naming of this field follows the TR005 specification."
1137011370
}
1137111371
},
11372-
"description": "Identifiers to uniquely identify a LoRaWAN End Device Profile."
11372+
"description": "Identifiers to uniquely identify a LoRaWAN end device profile."
1137311373
},
1137411374
"IsConfigurationAdminRights": {
1137511375
"type": "object",

api/devicerepository.proto

+4-6
Original file line numberDiff line numberDiff line change
@@ -298,25 +298,23 @@ message ListEndDeviceModelsRequest {
298298
}
299299

300300
message GetTemplateRequest {
301-
// Identifiers to uniquely identify a LoRaWAN End Device Profile.
301+
// Identifiers to uniquely identify a LoRaWAN end device profile.
302302
message EndDeviceProfileIdentifiers {
303303
// VendorID managed by the LoRa Alliance, as defined in TR005.
304304
uint32 vendor_id = 1 [(validate.rules).uint32 = {gte: 1}];
305305

306-
// ID of the LoRAWAN device profile. The name of this field follows the TR005 specification.
306+
// ID of the LoRaWAN end device profile. The naming of this field follows the TR005 specification.
307307
uint32 vendor_profile_id = 2;
308308
}
309309

310310
// Application identifiers.
311311
ApplicationIdentifiers application_ids = 1 [(validate.rules).message.required = true];
312312

313313
// End device version information.
314-
// If EndDeviceProfileIdentifiers is not present in the request,
315-
// the End Device Template is constructed from the End Device Profile that matches the BandID within EndDeviceVersionIdentifiers.
314+
// EndDeviceProfileIdentifiers take precedence over this field if both are specified.
316315
EndDeviceVersionIdentifiers version_ids = 2;
317316

318-
// (Optional) End Device Profile identifiers.
319-
// If specified, these identifiers will be directly to used to fetch the End Device Profile (if found)
317+
// End device profile identifiers.
320318
EndDeviceProfileIdentifiers end_device_profile_ids = 3;
321319
}
322320

pkg/devicerepository/store/bleve/init.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func (c Config) Initialize(ctx context.Context, lorawanDevicesPath string, overw
141141
return err
142142
}
143143
}
144-
profiles, err := s.GetLoRaWANDeviceProfiles(store.GetLoRaWANDeviceProfilesRequest{
144+
profiles, err := s.GetEndDeviceProfiles(store.GetEndDeviceProfilesRequest{
145145
BrandID: brand.BrandId,
146146
})
147147
if err != nil && !errors.IsNotFound(err) {
@@ -151,7 +151,6 @@ func (c Config) Initialize(ctx context.Context, lorawanDevicesPath string, overw
151151
if err != nil {
152152
return err
153153
}
154-
155154
b := indexableBrand{
156155
Type: brandDocumentType,
157156
BrandJSON: string(brandJSON),
@@ -180,7 +179,7 @@ func (c Config) Initialize(ctx context.Context, lorawanDevicesPath string, overw
180179
return err
181180
}
182181
}
183-
// Add the LoRaWAN Device Profiles to the index.
182+
// Add the end device profiles to the index.
184183
if profiles != nil {
185184
for _, profile := range profiles.Profiles {
186185
profileJSON, err := jsonpb.TTN().Marshal(profile)

pkg/devicerepository/store/bleve/store.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ func (s *bleveStore) GetModels(req store.GetModelsRequest) (*store.GetModelsResp
174174
}
175175
models = append(models, pb)
176176
}
177-
178177
return &store.GetModelsResponse{
179178
Count: uint32(len(result.Hits)),
180179
Total: uint32(result.Total),
@@ -189,7 +188,7 @@ func (s *bleveStore) GetTemplate(req *ttnpb.GetTemplateRequest, _ *store.EndDevi
189188
profile *store.EndDeviceProfile
190189
endDeviceProfileIds = req.GetEndDeviceProfileIds()
191190
)
192-
// Fetch the Profile from the store indices and forward it if available.
191+
// Attempt to fetch the end device profile that matches the identifiers.
193192
if endDeviceProfileIds != nil {
194193
documentTypeQuery := bleve.NewTermQuery(profileDocumentType)
195194
documentTypeQuery.SetField("Type")
@@ -255,9 +254,9 @@ func (s *bleveStore) GetDownlinkEncoder(req store.GetCodecRequest) (*ttnpb.Messa
255254
return s.store.GetDownlinkEncoder(req)
256255
}
257256

258-
// GetLoRaWANDeviceProfiles retrieves an end device template for an end device definition.
259-
func (s *bleveStore) GetLoRaWANDeviceProfiles(req store.GetLoRaWANDeviceProfilesRequest) (*store.GetLoRaWANDeviceProfilesResponse, error) {
260-
return s.store.GetLoRaWANDeviceProfiles(req)
257+
// GetEndDeviceProfiles implements store.
258+
func (s *bleveStore) GetEndDeviceProfiles(req store.GetEndDeviceProfilesRequest) (*store.GetEndDeviceProfilesResponse, error) {
259+
return s.store.GetEndDeviceProfiles(req)
261260
}
262261

263262
// Close closes the store.

pkg/devicerepository/store/interface.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package store
1616

1717
import (
1818
pbtypes "github.com/gogo/protobuf/types"
19-
2019
"go.thethings.network/lorawan-stack/v3/pkg/ttnpb"
2120
)
2221

@@ -49,8 +48,8 @@ type GetModelsRequest struct {
4948
Search string
5049
}
5150

52-
// GetLoRaWANDeviceProfilesRequest is a request to list available LoRaWAN device profile definitions.
53-
type GetLoRaWANDeviceProfilesRequest struct {
51+
// GetEndDeviceProfilesRequest is a request to list available LoRaWAN end device profile definitions.
52+
type GetEndDeviceProfilesRequest struct {
5453
BrandID,
5554
ModelID string
5655
Limit,
@@ -60,8 +59,8 @@ type GetLoRaWANDeviceProfilesRequest struct {
6059
Search string
6160
}
6261

63-
// GetLoRaWANDeviceProfilesResponse returns available LoRaWAN device profile definitions.
64-
type GetLoRaWANDeviceProfilesResponse struct {
62+
// GetEndDeviceProfilesResponse returns available LoRaWAN end device profile definitions.
63+
type GetEndDeviceProfilesResponse struct {
6564
Count,
6665
Offset,
6766
Total uint32
@@ -88,10 +87,9 @@ type Store interface {
8887
GetBrands(GetBrandsRequest) (*GetBrandsResponse, error)
8988
// GetModels lists available end device definitions.
9089
GetModels(GetModelsRequest) (*GetModelsResponse, error)
91-
// GetLoRaWANDeviceProfiles lists available LoRaWAN device profile definitions.
92-
GetLoRaWANDeviceProfiles(GetLoRaWANDeviceProfilesRequest) (*GetLoRaWANDeviceProfilesResponse, error)
90+
// GetEndDeviceProfiles lists available LoRaWAN end device profile definitions.
91+
GetEndDeviceProfiles(GetEndDeviceProfilesRequest) (*GetEndDeviceProfilesResponse, error)
9392
// GetTemplate retrieves an end device template for an end device definition.
94-
// If the EndDeviceProfile is not present, the profile based on the Firmware Version and BandID is chosen.
9593
GetTemplate(*ttnpb.GetTemplateRequest, *EndDeviceProfile) (*ttnpb.EndDeviceTemplate, error)
9694
// GetUplinkDecoder retrieves the codec for decoding uplink messages.
9795
GetUplinkDecoder(GetCodecRequest) (*ttnpb.MessagePayloadDecoder, error)

pkg/devicerepository/store/remote/remote.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ func (s *remoteStore) GetModels(req store.GetModelsRequest) (*store.GetModelsRes
162162
}, nil
163163
}
164164

165-
// getLoRaWANDeviceProfilesByBrand lists the available LoRaWAN Device Profiles by a single brand.
166-
func (s *remoteStore) getLoRaWANDeviceProfilesByBrand(req store.GetLoRaWANDeviceProfilesRequest) (*store.GetLoRaWANDeviceProfilesResponse, error) {
165+
// getEndDeviceProfilesByBrand lists the available LoRaWAN end device profiles by a single brand.
166+
func (s *remoteStore) getEndDeviceProfilesByBrand(req store.GetEndDeviceProfilesRequest) (*store.GetEndDeviceProfilesResponse, error) {
167167
b, err := s.fetcher.File("vendor", req.BrandID, "index.yaml")
168168
if err != nil {
169169
return nil, errBrandNotFound.WithAttributes("brand_id", req.BrandID)
@@ -205,20 +205,20 @@ func (s *remoteStore) getLoRaWANDeviceProfilesByBrand(req store.GetLoRaWANDevice
205205
}
206206
}
207207
}
208-
return &store.GetLoRaWANDeviceProfilesResponse{
208+
return &store.GetEndDeviceProfilesResponse{
209209
Count: end - start,
210210
Offset: start,
211211
Total: uint32(len(index.EndDevices)),
212212
Profiles: profiles,
213213
}, nil
214214
}
215215

216-
// GetLoRaWANDeviceProfiles lists available LoRaWAN Device Profiles per brand.
216+
// GetEndDeviceProfiles lists available LoRaWAN end device profiles per brand.
217217
// Note that this can be very slow, and does not support searching/sorting.
218218
// This function is primarily intended to be used for creating the bleve index.
219-
func (s *remoteStore) GetLoRaWANDeviceProfiles(req store.GetLoRaWANDeviceProfilesRequest) (*store.GetLoRaWANDeviceProfilesResponse, error) {
219+
func (s *remoteStore) GetEndDeviceProfiles(req store.GetEndDeviceProfilesRequest) (*store.GetEndDeviceProfilesResponse, error) {
220220
if req.BrandID != "" {
221-
return s.getLoRaWANDeviceProfilesByBrand(req)
221+
return s.getEndDeviceProfilesByBrand(req)
222222
}
223223
all := []*store.EndDeviceProfile{}
224224
brands, err := s.GetBrands(store.GetBrandsRequest{
@@ -228,7 +228,7 @@ func (s *remoteStore) GetLoRaWANDeviceProfiles(req store.GetLoRaWANDeviceProfile
228228
return nil, err
229229
}
230230
for _, brand := range brands.Brands {
231-
profiles, err := s.GetLoRaWANDeviceProfiles(store.GetLoRaWANDeviceProfilesRequest{
231+
profiles, err := s.GetEndDeviceProfiles(store.GetEndDeviceProfilesRequest{
232232
BrandID: brand.BrandId,
233233
})
234234
if errors.IsNotFound(err) {
@@ -241,7 +241,7 @@ func (s *remoteStore) GetLoRaWANDeviceProfiles(req store.GetLoRaWANDeviceProfile
241241
}
242242

243243
start, end := paginate(len(all), req.Limit, req.Page)
244-
return &store.GetLoRaWANDeviceProfilesResponse{
244+
return &store.GetEndDeviceProfilesResponse{
245245
Count: end - start,
246246
Offset: start,
247247
Total: uint32(len(all)),

pkg/ttnpb/devicerepository.pb.go

+4-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/js/generated/api-definition.json

+9
Original file line numberDiff line numberDiff line change
@@ -2353,6 +2353,15 @@
23532353
"version_ids.firmware_version",
23542354
"version_ids.band_id"
23552355
]
2356+
},
2357+
{
2358+
"method": "get",
2359+
"pattern": "/dr/applications/{application_ids.application_id}/vendor-id/{end_device_profile_ids.vendor_id}/vendor-profile-id/{end_device_profile_ids.vendor_profile_id}/template",
2360+
"parameters": [
2361+
"application_ids.application_id",
2362+
"end_device_profile_ids.vendor_id",
2363+
"end_device_profile_ids.vendor_profile_id"
2364+
]
23562365
}
23572366
]
23582367
},

sdk/js/generated/api.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -11399,7 +11399,7 @@
1139911399
},
1140011400
{
1140111401
"name": "version_ids",
11402-
"description": "End device version information.\nIf EndDeviceProfileIdentifiers is not present in the request,\nthe End Device Template is constructed from the End Device Profile that matches the BandID within EndDeviceVersionIdentifiers.",
11402+
"description": "End device version information.\nEndDeviceProfileIdentifiers take precedence over this field if both are specified.",
1140311403
"label": "",
1140411404
"type": "EndDeviceVersionIdentifiers",
1140511405
"longType": "EndDeviceVersionIdentifiers",
@@ -11411,7 +11411,7 @@
1141111411
},
1141211412
{
1141311413
"name": "end_device_profile_ids",
11414-
"description": "(Optional) End Device Profile identifiers.\nIf specified, these identifiers will be directly to used to fetch the End Device Profile (if found)",
11414+
"description": "End device profile identifiers.",
1141511415
"label": "",
1141611416
"type": "EndDeviceProfileIdentifiers",
1141711417
"longType": "GetTemplateRequest.EndDeviceProfileIdentifiers",
@@ -11427,7 +11427,7 @@
1142711427
"name": "EndDeviceProfileIdentifiers",
1142811428
"longName": "GetTemplateRequest.EndDeviceProfileIdentifiers",
1142911429
"fullName": "ttn.lorawan.v3.GetTemplateRequest.EndDeviceProfileIdentifiers",
11430-
"description": "Identifiers to uniquely identify a LoRaWAN End Device Profile.",
11430+
"description": "Identifiers to uniquely identify a LoRaWAN end device profile.",
1143111431
"hasExtensions": false,
1143211432
"hasFields": true,
1143311433
"hasOneofs": false,
@@ -11455,7 +11455,7 @@
1145511455
},
1145611456
{
1145711457
"name": "vendor_profile_id",
11458-
"description": "ID of the LoRAWAN device profile. The name of this field follows the TR005 specification.",
11458+
"description": "ID of the LoRaWAN end device profile. The naming of this field follows the TR005 specification.",
1145911459
"label": "",
1146011460
"type": "uint32",
1146111461
"longType": "uint32",

0 commit comments

Comments
 (0)