diff --git a/app/services/cwmp/main_state_machine.ts b/app/services/cwmp/main_state_machine.ts index eab9155..f4bf9f3 100644 --- a/app/services/cwmp/main_state_machine.ts +++ b/app/services/cwmp/main_state_machine.ts @@ -130,7 +130,21 @@ class DiscoveringParametersState extends DeviceState { return { nextState: new CriticalReadsState(), response: '' } } - // Process response and continue + // GPN success — process the response + if (context.message?.success && context.message.data) { + try { + context.device.organizeParameters(context.message.data, new Date()) + context.device.setGpnStatus('supported') + logger.info( + { deviceId: context.device.identifier, paramCount: context.device.getParameters().length }, + '[DiscoveringParameters] GPN response processed' + ) + } catch (e: any) { + logger.error({ error: e?.message }, '[DiscoveringParameters] Error processing GPN response') + } + } + + // Continue with next path in queue if any if (this.parameterQueue.length > 0) { return { response: await this.processNext(context) } }