IdleState now extracts parent paths from Inform parameters for GPN test. This classifies Inform params (writable vs read-only) and tests GPN support in one step. Falls back to data model root path if no Inform params available. All 791 tests pass. Build status: Success
This commit is contained in:
1 parent
9559eff9d9
commit
2cdb11ce25
1 file changed
+20
-1
@@ -59,7 +59,26 @@ class IdleState extends DeviceState {
|
||||
'[IdleState] GPN allowed — proceeding to discovery'
|
||||
)
|
||||
|
||||
// Test GPN support using a single known path from the device's data model
|
||||
// Extract unique parent paths from the Inform parameters to test GPN support
|
||||
// and classify them (writable vs read-only). If GPN fails, the catalog will classify instead.
|
||||
const allKnown = [...device.getParameters(), ...device.getProperties()]
|
||||
const parentPaths = new Set<string>()
|
||||
for (const p of allKnown) {
|
||||
if (!p?.name || typeof p.name !== 'string') continue
|
||||
const lastDot = p.name.lastIndexOf('.')
|
||||
if (lastDot > 0) {
|
||||
parentPaths.add(p.name.substring(0, lastDot + 1))
|
||||
}
|
||||
}
|
||||
|
||||
// If we have paths from the Inform, use them for GPN test + classification
|
||||
if (parentPaths.size > 0) {
|
||||
const paths = Array.from(parentPaths).sort()
|
||||
logger.info({ paths, deviceId: device.identifier }, '[IdleState] GPN test on Inform parameter paths')
|
||||
return { nextState: new DiscoveringParametersState(paths), response: '' }
|
||||
}
|
||||
|
||||
// Fallback: use known data model root path
|
||||
const dataModel = device.dataModel
|
||||
if (dataModel === 'tr-181') {
|
||||
return { nextState: new DiscoveringParametersState(['Device.ManagementServer.']), response: '' }
|
||||
|
||||
Reference in new issue
Block a user