Files
adam-acs/app/protocol/cwmp-1-0.ts
T
Kevin L'Hereec ab45275a89 fix: SetParameterAttributes XML emits 0/1 for boolean fields and drops xsi:type on Notification
NotificationChange and AccessListChange were emitting 'true'/'false' (JS booleans)
instead of '1'/'0' as required by TR-069 spec.
Notification xsi:type='xsd:int' attribute removed — consistent with old builder output.
2026-07-20 16:39:53 +02:00

1056 lines
33 KiB
TypeScript

// @ts-nocheck — fichier copié de cwmp-connector (papaye)
export class Cwmp_1_0 {
[key: string]: any
public '@class' = '.Cwmp_1_0'
public ID?: ID
public HoldRequests?: HoldRequests
public Fault?: Fault
public GetRPCMethods?: GetRPCMethods
public GetRPCMethodsResponse?: GetRPCMethodsResponse
public SetParameterValues?: SetParameterValues
public SetParameterValuesResponse?: SetParameterValuesResponse
public GetParameterValues?: GetParameterValues
public GetParameterValuesResponse?: GetParameterValuesResponse
public GetParameterNames?: GetParameterNames
public GetParameterNamesResponse?: GetParameterNamesResponse
public SetParameterAttributes?: SetParameterAttributes
public SetParameterAttributesResponse?: SetParameterAttributesResponse
public GetParameterAttributes?: GetParameterAttributes
public GetParameterAttributesResponse?: GetParameterAttributesResponse
public AddObject?: AddObject
public AddObjectResponse?: AddObjectResponse
public DeleteObject?: DeleteObject
public DeleteObjectResponse?: DeleteObjectResponse
public Download?: Download
public DownloadResponse?: DownloadResponse
public Reboot?: Reboot
public RebootResponse?: RebootResponse
public GetQueuedTransfers?: GetQueuedTransfers
public GetQueuedTransfersResponse?: GetQueuedTransfersResponse
public ScheduleInform?: ScheduleInform
public ScheduleInformResponse?: ScheduleInformResponse
public SetVouchers?: SetVouchers
public SetVouchersResponse?: SetVouchersResponse
public GetOptions?: GetOptions
public GetOptionsResponse?: GetOptionsResponse
public Upload?: Upload
public UploadResponse?: UploadResponse
public FactoryReset?: FactoryReset
public FactoryResetResponse?: FactoryResetResponse
public Inform?: Inform
public InformResponse?: InformResponse
public TransferComplete?: TransferComplete
public TransferCompleteResponse?: TransferCompleteResponse
public Kicked?: Kicked
public KickedResponse?: KickedResponse
public RequestDownload?: RequestDownload
public RequestDownloadResponse?: RequestDownloadResponse
constructor(props: any = {}) {
this.ID = props.ID ? new ID(props.ID) : undefined
this.HoldRequests = props.HoldRequests ? new HoldRequests(props.HoldRequests) : undefined
this.Fault = props.Fault ? new Fault(props.Fault) : undefined
this.GetRPCMethods = props.GetRPCMethods ? new GetRPCMethods(props.GetRPCMethods) : undefined
this.GetRPCMethodsResponse = props.GetRPCMethodsResponse ? new GetRPCMethodsResponse(props.GetRPCMethodsResponse) : undefined
this.SetParameterValues = props.SetParameterValues ? new SetParameterValues(props.SetParameterValues) : undefined
this.SetParameterValuesResponse = props.SetParameterValuesResponse ? new SetParameterValuesResponse(props.SetParameterValuesResponse) : undefined
this.GetParameterValues = props.GetParameterValues ? new GetParameterValues(props.GetParameterValues) : undefined
this.GetParameterValuesResponse = props.GetParameterValuesResponse ? new GetParameterValuesResponse(props.GetParameterValuesResponse) : undefined
this.GetParameterNames = props.GetParameterNames ? new GetParameterNames(props.GetParameterNames) : undefined
this.GetParameterNamesResponse = props.GetParameterNamesResponse ? new GetParameterNamesResponse(props.GetParameterNamesResponse) : undefined
this.SetParameterAttributes = props.SetParameterAttributes ? new SetParameterAttributes(props.SetParameterAttributes) : undefined
this.SetParameterAttributesResponse = props.SetParameterAttributesResponse ? new SetParameterAttributesResponse(props.SetParameterAttributesResponse) : undefined
this.GetParameterAttributes = props.GetParameterAttributes ? new GetParameterAttributes(props.GetParameterAttributes) : undefined
this.GetParameterAttributesResponse = props.GetParameterAttributesResponse ? new GetParameterAttributesResponse(props.GetParameterAttributesResponse) : undefined
this.AddObject = props.AddObject ? new AddObject(props.AddObject) : undefined
this.AddObjectResponse = props.AddObjectResponse ? new AddObjectResponse(props.AddObjectResponse) : undefined
this.DeleteObject = props.DeleteObject ? new DeleteObject(props.DeleteObject) : undefined
this.DeleteObjectResponse = props.DeleteObjectResponse ? new DeleteObjectResponse(props.DeleteObjectResponse) : undefined
this.Download = props.Download ? new Download(props.Download) : undefined
this.DownloadResponse = props.DownloadResponse ? new DownloadResponse(props.DownloadResponse) : undefined
this.Reboot = props.Reboot ? new Reboot(props.Reboot) : undefined
this.RebootResponse = props.RebootResponse ? new RebootResponse(props.RebootResponse) : undefined
this.GetQueuedTransfers = props.GetQueuedTransfers ? new GetQueuedTransfers(props.GetQueuedTransfers) : undefined
this.GetQueuedTransfersResponse = props.GetQueuedTransfersResponse ? new GetQueuedTransfersResponse(props.GetQueuedTransfersResponse) : undefined
this.ScheduleInform = props.ScheduleInform ? new ScheduleInform(props.ScheduleInform) : undefined
this.ScheduleInformResponse = props.ScheduleInformResponse ? new ScheduleInformResponse(props.ScheduleInformResponse) : undefined
this.SetVouchers = props.SetVouchers ? new SetVouchers(props.SetVouchers) : undefined
this.SetVouchersResponse = props.SetVouchersResponse ? new SetVouchersResponse(props.SetVouchersResponse) : undefined
this.GetOptions = props.GetOptions ? new GetOptions(props.GetOptions) : undefined
this.GetOptionsResponse = props.GetOptionsResponse ? new GetOptionsResponse(props.GetOptionsResponse) : undefined
this.Upload = props.Upload ? new Upload(props.Upload) : undefined
this.UploadResponse = props.UploadResponse ? new UploadResponse(props.UploadResponse) : undefined
this.FactoryReset = props.FactoryReset ? new FactoryReset(props.FactoryReset) : undefined
this.FactoryResetResponse = props.FactoryResetResponse ? new FactoryResetResponse(props.FactoryResetResponse) : undefined
this.Inform = props.Inform ? new Inform(props.Inform) : undefined
this.InformResponse = props.InformResponse ? new InformResponse(props.InformResponse) : undefined
this.TransferComplete = props.TransferComplete ? new TransferComplete(props.TransferComplete) : undefined
this.TransferCompleteResponse = props.TransferCompleteResponse ? new TransferCompleteResponse(props.TransferCompleteResponse) : undefined
this.Kicked = props.Kicked ? new Kicked(props.Kicked) : undefined
this.KickedResponse = props.KickedResponse ? new KickedResponse(props.KickedResponse) : undefined
this.RequestDownload = props.RequestDownload ? new RequestDownload(props.RequestDownload) : undefined
this.RequestDownloadResponse = props.RequestDownloadResponse ? new RequestDownloadResponse(props.RequestDownloadResponse) : undefined
}
}
export class ID {
public '@class' = '.ID'
public MustUnderstand: string = '1'
public _: string // Content textuel de l'élément ID
constructor(props: any = {}) {
this.MustUnderstand = props.MustUnderstand || '1'
this._ = props._ || props.value || ''
}
getXml(): string {
return `<cwmp:ID soapenv:mustUnderstand="${this.MustUnderstand}">${this._}</cwmp:ID>`
}
}
export class HoldRequests {
public '@class' = '.HoldRequests'
public MustUnderstand: string = '1'
public _: boolean // Contenu boolean de l'élément HoldRequests
constructor(props: any = {}) {
this.MustUnderstand = props.MustUnderstand || '1'
this._ = props._ !== undefined ? props._ : (props.value !== undefined ? props.value : false)
}
getXml(): string {
return `<cwmp:HoldRequests soapenv:mustUnderstand="${this.MustUnderstand}">${this._}</cwmp:HoldRequests>`
}
}
export class Fault {
public '@class' = '.SoapFault'
public Faultcode: string
public Faultstring: string
public Detail?: FaultDetail
constructor(props: any = {}) {
this.Faultcode = props.Faultcode || 'Server'
this.Faultstring = props.Faultstring || 'Internal Error'
this.Detail = props?.Detail
}
getXml() {
return `<Fault>
<faultcode>${this.Faultcode}</faultcode>
<faultstring>${this.Faultstring}</faultstring>
<detail>
${this.Detail?.getXml() || ''}
</detail>
</Fault>`
}
}
export class FaultDetail {
public '@class' = '.FaultDetail'
public Fault: FaultStruct
constructor(props: any) {
this.Fault = new FaultStruct(props.Fault)
}
getXml() {
return '<Fault>' + '<FaultCode>' + this.Fault.FaultCode + '</FaultCode>' + '<FaultString>' + this.Fault.FaultString + '</FaultString>' + '</Fault>'
}
}
export class SetParameterValuesFault {
public '@class' = '.SetParameterValuesFault'
public ParameterName: string
public FaultCode: number | string
public FaultString: string
constructor(props: any) {
this.ParameterName = props.ParameterName || ''
this.FaultCode = props?.FaultCode || ''
this.FaultString = props?.FaultString || ''
}
}
export class MethodList {
public '@class' = '.MethodList'
public String?: string[]
constructor(props: any = {}) {
this.String = props.String
}
}
export class FaultStruct {
public '@class' = '.FaultStruct'
public FaultCode: number
public FaultString: string
constructor(props: { FaultCode: number; FaultString: string }) {
this.FaultCode = props.FaultCode
this.FaultString = props.FaultString || ''
}
}
export class DeviceIdStruct {
public '@class' = '.DeviceIdStruct'
public Manufacturer: string
public OUI: string
public ProductClass: string
public SerialNumber: string
constructor(props: any) {
this.Manufacturer = props?.Manufacturer || ''
this.OUI = props?.OUI || ''
this.ProductClass = props?.ProductClass || ''
this.SerialNumber = props?.SerialNumber || ''
}
}
export class EventStruct {
public '@class' = '.EventStruct'
public EventCode?: EventCode
public CommandKey: string
constructor(props: any) {
const key = (Object.keys(EventCode) as Array<keyof typeof EventCode>).find((key) => EventCode[key] === props?.EventCode)
this.EventCode = key ? EventCode[key] : undefined
this.CommandKey = props?.CommandKey || ''
}
}
export enum EventCode {
BOOTSTRAP = '0 BOOTSTRAP',
BOOT = '1 BOOT',
PERIODIC = '2 PERIODIC',
SCHEDULED = '3 SCHEDULED',
VALUE_CHANGE = '4 VALUE CHANGE',
KICKED = '5 KICKED',
CONNECTION_REQUEST = '6 CONNECTION REQUEST',
TRANSFER_COMPLETE = '7 TRANSFER COMPLETE',
DIAGNOSTICS_COMPLETE = '8 DIAGNOSTICS COMPLETE',
REQUEST_DOWNLOAD = '9 REQUEST DOWNLOAD',
REBOOT = 'M Reboot',
SCHEDULE_INFORM = 'M ScheduleInform',
DOWNLOAD = 'M Download',
UPLOAD = 'M Upload',
X_METHOD = 'M X_',
X_PATTERN = 'X [0-9A-F]{6} .*',
}
export class Event {
public '@class' = '.EventList'
public EventStruct: EventStruct[]
constructor(props: any = {}) {
this.EventStruct = (props.EventStruct || []).map((item: any) => new EventStruct(item))
}
}
export class GetRPCMethods {
public '@class' = '.GetRPCMethods'
constructor(props: any = {}) {}
}
export class GetRPCMethodsResponse {
public '@class' = '.GetRPCMethodsResponse'
public MethodList?: MethodList
constructor(props: any = {}) {
this.MethodList = props.MethodList ? new MethodList(props.MethodList) : undefined
}
}
export class SetParameterValues {
public '@class' = '.SetParameterValues'
public ParameterValueList: ParameterValueList = new ParameterValueList({})
public ParameterKey?: string
constructor(props: any = {}) {
this.ParameterValueList = new ParameterValueList(props.ParameterValueList || {})
this.ParameterKey = props.ParameterKey
}
getXml(): string {
const parameterValueStructXml =
this.ParameterValueList?.ParameterValueStruct.map((param) => {
return `<ParameterValueStruct>
<Name xsi:type="xsd:string">${param.Name}</Name>
<Value xsi:type="${param.Value?.$?.Type}">${param.Value?._}</Value>
</ParameterValueStruct>`
}).join('') || ''
const parameterListXml = `
<ParameterList soap-enc:arrayType="${this.ParameterValueList?.$?.ArrayType}">
${parameterValueStructXml}
</ParameterList>`
return `<cwmp:SetParameterValues>
${parameterListXml}
<ParameterKey xsi:type="xsd:string">${this.ParameterKey || ''}</ParameterKey>
</cwmp:SetParameterValues>`
}
}
export class SetParameterValuesResponse {
public '@class' = '.SetParameterValuesResponse'
public Status?: number
constructor(props: any = {}) {
this.Status = props.Status
}
}
export class GetParameterValues {
public '@class' = '.GetParameterValues'
public ParameterNames: string[] = []
constructor(props: any = {}) {
this.ParameterNames = props.ParameterNames || []
}
getXml() {
const parameterCount = this.ParameterNames.length
const parameterStrings = this.ParameterNames.map((p) => ` <string>${p}</string>`).join('\n')
return [`<cwmp:GetParameterValues>`, ` <ParameterNames soap-enc:arrayType="xsd:string[${parameterCount}]">`, parameterStrings, ` </ParameterNames>`, `</cwmp:GetParameterValues>`].join('\n')
}
}
export class GetParameterValuesResponse {
public '@class' = '.GetParameterValuesResponse'
public ParameterList?: ParameterValueList
constructor(props: any = {}) {
this.ParameterList = props.ParameterList ? new ParameterValueList(props.ParameterList) : undefined
}
}
export class GetParameterNames {
public '@class' = '.GetParameterNames'
public ParameterPath?: string
public NextLevel: boolean = false
constructor(props: any = {}) {
this.ParameterPath = props.ParameterPath
this.NextLevel = props.NextLevel || false
}
getXml() {
return `<cwmp:GetParameterNames>
<ParameterPath>${this.ParameterPath || ''}</ParameterPath>
<NextLevel>${this.NextLevel ? 1 : 0}</NextLevel>
</cwmp:GetParameterNames>`
}
}
export class GetParameterNamesResponse {
public '@class' = '.GetParameterNamesResponse'
public ParameterList?: ParameterInfoList
constructor(props: any = {}) {
this.ParameterList = props.ParameterList ? new ParameterInfoList(props.ParameterList) : undefined
}
}
export class SetParameterAttributes {
public '@class' = '.SetParameterAttributes'
public ParameterList?: SetParameterAttributesList
constructor(props: any = {}) {
this.ParameterList = props.ParameterList ? new SetParameterAttributesList(props.ParameterList) : undefined
}
getXml(): string {
const parameterAttributesXml =
this.ParameterList?.SetParameterAttributesStruct?.map((attr) => {
return `<SetParameterAttributesStruct>
<Name xsi:type="xsd:string">${attr.Name}</Name>
<NotificationChange>${attr.NotificationChange ? 1 : 0}</NotificationChange>
<Notification>${attr.Notification}</Notification>
<AccessListChange>${attr.AccessListChange ? 1 : 0}</AccessListChange>
<AccessList soap-enc:arrayType="xsd:string[${attr.AccessList?.string?.length ?? 0}]">${attr.AccessList ? attr.AccessList.string!.join(', ') : ''}</AccessList>
</SetParameterAttributesStruct>`
}).join('') || ''
return `<cwmp:SetParameterAttributes>
<ParameterList soap-enc:arrayType="cwmp:SetParameterAttributesStruct[${this.ParameterList?.SetParameterAttributesStruct?.length}]">
${parameterAttributesXml}
</ParameterList>
</cwmp:SetParameterAttributes>`
}
}
export class SetParameterAttributesResponse {
public '@class' = '.SetParameterAttributesResponse'
constructor(props: any = {}) {}
}
export class GetParameterAttributes {
public '@class' = '.GetParameterAttributes'
public ParameterNames: string[] = []
constructor(props: any = {}) {
this.ParameterNames = props.ParameterNames || []
}
getXml(): string {
const parameterNamesXml = this.ParameterNames.map((name) => `<xsd:string>${name}</xsd:string>`).join('')
return `<cwmp:GetParameterAttributes>
<cwmp:ParameterNames soap-enc:arrayType="xsd:string[${this.ParameterNames.length}]">
${parameterNamesXml}
</cwmp:ParameterNames>
</cwmp:GetParameterAttributes>`
}
}
export class GetParameterAttributesResponse {
public '@class' = '.GetParameterAttributesResponse'
public ParameterList?: ParameterAttributeList
constructor(props: any = {}) {
this.ParameterList = props.ParameterList ? new ParameterAttributeList(props.ParameterList) : undefined
}
}
export class AddObject {
public '@class' = '.AddObject'
public ObjectName?: string
public ParameterKey?: string
constructor(props: any = {}) {
this.ObjectName = props.ObjectName
this.ParameterKey = props.ParameterKey
}
}
export class AddObjectResponse {
public '@class' = '.AddObjectResponse'
public InstanceNumber?: number
public Status?: number
constructor(props: any = {}) {
this.InstanceNumber = props.InstanceNumber
this.Status = props.Status
}
}
export class DeleteObject {
public '@class' = '.DeleteObject'
public ObjectName?: string
public ParameterKey?: string
constructor(props: any = {}) {
this.ObjectName = props.ObjectName
this.ParameterKey = props.ParameterKey
}
}
export class DeleteObjectResponse {
public '@class' = '.DeleteObjectResponse'
public Status?: number
constructor(props: any = {}) {
this.Status = props.Status
}
}
export class Download {
public '@class' = '.Download'
public CommandKey?: string
public FileType?: string
public URL?: string
public Username?: string
public Password?: string
public FileSize?: number
public TargetFileName?: string
public DelaySeconds?: number
public SuccessURL?: string
public FailureURL?: string
constructor(props: any = {}) {
this.CommandKey = props.CommandKey
this.FileType = props.FileType
this.URL = props.URL
this.Username = props.Username
this.Password = props.Password
this.FileSize = props.FileSize
this.TargetFileName = props.TargetFileName
this.DelaySeconds = props.DelaySeconds
this.SuccessURL = props.SuccessURL
this.FailureURL = props.FailureURL
}
getXml() {
const parts = [
`<cwmp:Download>`,
this.CommandKey ? `<CommandKey>${this.CommandKey}</CommandKey>` : '',
this.FileType ? `<FileType>${this.FileType}</FileType>` : '',
this.URL ? `<URL>${this.URL}</URL>` : '',
this.Username ? `<Username>${this.Username}</Username>` : '',
this.Password ? `<Password>${this.Password}</Password>` : '',
this.FileSize !== undefined ? `<FileSize>${this.FileSize}</FileSize>` : '',
this.TargetFileName ? `<TargetFileName>${this.TargetFileName}</TargetFileName>` : '',
this.DelaySeconds !== undefined ? `<DelaySeconds>${this.DelaySeconds}</DelaySeconds>` : '',
this.SuccessURL ? `<SuccessURL>${this.SuccessURL}</SuccessURL>` : '',
this.FailureURL ? `<FailureURL>${this.FailureURL}</FailureURL>` : '',
`</cwmp:Download>`,
]
return parts.filter(Boolean).join('\n')
}
}
export class DownloadResponse {
public '@class' = '.DownloadResponse'
public Status?: number
public StartTime?: Date
public CompleteTime?: Date
constructor(props: any = {}) {
this.Status = props.Status
this.StartTime = props.StartTime ? new Date(props.StartTime) : undefined
this.CompleteTime = props.CompleteTime ? new Date(props.CompleteTime) : undefined
}
}
export class Reboot {
public '@class' = '.Reboot'
public CommandKey?: string
constructor(props: any = {}) {
this.CommandKey = props.CommandKey
}
getXml() {
return `<cwmp:Reboot>
<CommandKey>${this.CommandKey || 'RebootCommandKey'}</CommandKey>
</cwmp:Reboot>`
}
}
export class RebootResponse {
public '@class' = '.RebootResponse'
constructor(props: any = {}) {}
}
export class GetQueuedTransfers {
public '@class' = '.GetQueuedTransfers'
constructor(props: any = {}) {}
}
export class GetQueuedTransfersResponse {
public '@class' = '.GetQueuedTransfersResponse'
public TransferList?: TransferList
constructor(props: any = {}) {
this.TransferList = props.TransferList ? new TransferList(props.TransferList) : undefined
}
}
export class ScheduleInform {
public '@class' = '.ScheduleInform'
public DelaySeconds?: number
public CommandKey?: string
constructor(props: any = {}) {
this.DelaySeconds = props.DelaySeconds
this.CommandKey = props.CommandKey
}
getXml() {
return `<cwmp:ScheduleInform>
<DelaySeconds>${this.DelaySeconds || 0}</DelaySeconds>
<CommandKey>${this.CommandKey || 'ScheduleInformCommandKey'}</CommandKey>
</cwmp:ScheduleInform>`
}
}
export class ScheduleInformResponse {
public '@class' = '.ScheduleInformResponse'
constructor(props: any = {}) {}
}
export class SetVouchers {
public '@class' = '.SetVouchers'
public VoucherList?: VoucherList
constructor(props: any = {}) {
this.VoucherList = props.VoucherList ? new VoucherList(props.VoucherList) : undefined
}
}
export class SetVouchersResponse {
public '@class' = '.SetVouchersResponse'
constructor(props: any = {}) {}
}
export class GetOptions {
public '@class' = '.GetOptions'
public OptionName?: string
constructor(props: any = {}) {
this.OptionName = props.OptionName
}
}
export class GetOptionsResponse {
public '@class' = '.GetOptionsResponse'
public OptionList?: OptionList
constructor(props: any = {}) {
this.OptionList = props.OptionList ? new OptionList(props.OptionList) : undefined
}
}
export class Upload {
public '@class' = '.Upload'
public CommandKey?: string
public FileType?: string
public URL?: string
public Username?: string
public Password?: string
public DelaySeconds?: number
constructor(props: any = {}) {
this.CommandKey = props.CommandKey
this.FileType = props.FileType
this.URL = props.URL
this.Username = props.Username
this.Password = props.Password
this.DelaySeconds = props.DelaySeconds
}
getXml() {
const parts = [
`<cwmp:Upload>`,
this.CommandKey ? `<CommandKey>${this.CommandKey}</CommandKey>` : '',
this.FileType ? `<FileType>${this.FileType}</FileType>` : '',
this.URL ? `<URL>${this.URL}</URL>` : '',
this.Username ? `<Username>${this.Username}</Username>` : '',
this.Password ? `<Password>${this.Password}</Password>` : '',
this.DelaySeconds !== undefined ? `<DelaySeconds>${this.DelaySeconds}</DelaySeconds>` : '',
`</cwmp:Upload>`,
]
return parts.filter(Boolean).join('\n')
}
}
export class UploadResponse {
public '@class' = '.UploadResponse'
public Status?: number
public StartTime?: Date
public CompleteTime?: Date
constructor(props: any = {}) {
this.Status = props.Status
this.StartTime = props.StartTime ? new Date(props.StartTime) : undefined
this.CompleteTime = props.CompleteTime ? new Date(props.CompleteTime) : undefined
}
}
export class FactoryReset {
public '@class' = '.FactoryReset'
constructor(props: any = {}) {}
getXml() {
return `<cwmp:FactoryReset></cwmp:FactoryReset>`
}
}
export class FactoryResetResponse {
public '@class' = '.FactoryResetResponse'
constructor(props: any) {}
}
export class ParameterValueStruct {
public '@class' = '.ParameterValueStruct'
public Name: string
public Value?: ValueObject
constructor(props: any) {
this.Name = props?.Name || ''
this.Value = new ValueObject(props?.Value)
}
}
export class ValueObject {
public '@class' = '.ValueObject'
public $?: ValueObjectAttribute
public _?: any
constructor(props: any = {}) {
this.$ = props.$ ? new ValueObjectAttribute(props.$) : undefined
this._ = props._
}
}
export class ValueObjectAttribute {
public '@class' = '.ValueObjectAttribute'
public Type: string
constructor(props: any = {}) {
this.Type = props.Type
}
}
export class ParameterValueList {
public '@class' = '.ParameterValueList'
public $: ParameterValueAttribute
public ParameterValueStruct: ParameterValueStruct[] = []
constructor(props: any) {
this.$ = new ParameterValueAttribute(props?.$)
this.ParameterValueStruct = (props.ParameterValueStruct || []).map((item: any) => new ParameterValueStruct(item))
}
}
export class ParameterValueAttribute {
public ArrayType?: string
constructor(props: any) {
this.ArrayType = props?.ArrayType
}
}
export class ParameterInfoStruct {
public '@class' = '.ParameterInfoStruct'
public Name: string = ''
public Writable: boolean = false
constructor(props: any = {}) {
this.Name = props.Name || ''
const writableValue = props.Writable
if (typeof writableValue === 'boolean') {
this.Writable = writableValue
} else if (typeof writableValue === 'string') {
try {
this.Writable = JSON.parse(writableValue.toLowerCase())
} catch {
this.Writable = false
}
}
}
}
export class ParameterInfoList {
public '@class' = '.ParameterInfoList'
public ParameterInfoStruct: ParameterInfoStruct[] = []
constructor(props: any) {
this.ParameterInfoStruct = (props?.ParameterInfoStruct || []).map((item: any) => new ParameterInfoStruct(item))
}
}
export class ParameterNames {
public '@class' = '.ParameterNames'
public string?: string[]
constructor(props: any = {}) {
this.string = props.string
}
}
export class AccessList {
public '@class' = '.AccessList'
public string?: string[]
constructor(props: any = {}) {
this.string = props.string
}
}
export class SetParameterAttributesStruct {
public '@class' = '.SetParameterAttributesStruct'
public Name?: string
public NotificationChange?: boolean
public Notification?: number
public AccessListChange?: boolean
public AccessList?: AccessList
constructor(props: any = {}) {
this.Name = props.Name
this.NotificationChange = props.NotificationChange || false
this.Notification = props.Notification || 1
this.AccessListChange = props.AccessListChange || false
this.AccessList = props.AccessList ? new AccessList(props.AccessList) : undefined
}
}
export class SetParameterAttributesList {
public '@class' = '.SetParameterAttributesList'
public SetParameterAttributesStruct?: SetParameterAttributesStruct[]
constructor(props: any = {}) {
this.SetParameterAttributesStruct = (props.SetParameterAttributesStruct || []).map((item: any) => new SetParameterAttributesStruct(item))
}
}
export class ParameterAttributeStruct {
public '@class' = '.ParameterAttributeStruct'
public Name?: string
public Notification?: number
public AccessList?: AccessList
constructor(props: any = {}) {
this.Name = props.Name
this.Notification = props.Notification
this.AccessList = props.AccessList ? new AccessList(props.AccessList) : undefined
}
}
export class ParameterAttributeList {
public '@class' = '.ParameterAttributeList'
public ParameterAttributeStruct: ParameterAttributeStruct[] = []
constructor(props: any = {}) {
this.ParameterAttributeStruct = (props.ParameterAttributeStruct || []).map((item: any) => new ParameterAttributeStruct(item))
}
}
export class QueuedTransferStruct {
public '@class' = '.QueuedTransferStruct'
public CommandKey: string
public State: number
constructor(props: any) {
this.CommandKey = props.CommandKey || ''
this.State = props.State || 0
}
}
export class TransferList {
public '@class' = '.TransferList'
public QueuedTransferStruct: QueuedTransferStruct[] = []
constructor(props: any) {
this.QueuedTransferStruct = (props?.QueuedTransferStruct || []).map((item: any) => new QueuedTransferStruct(item))
}
}
export class VoucherList {
public '@class' = '.VoucherList'
public Base64: string[] = []
constructor(props: any) {
this.Base64 = props?.Base64 || []
}
}
export class OptionStruct {
public '@class' = '.OptionStruct'
public OptionName: string
public VoucherSN: number
public State: number
public Mode: number
public StartDate: Date
public ExpirationDate: Date
public IsTransferable: number
constructor(props: any) {
this.OptionName = props?.OptionName || ''
this.VoucherSN = props?.VoucherSN || 0
this.State = props?.State || 0
this.Mode = props?.Mode
this.StartDate = props?.StartDate && !isNaN(Date.parse(props?.StartDate)) ? new Date(props?.StartDate) : new Date()
this.ExpirationDate = props?.ExpirationDate && !isNaN(Date.parse(props?.ExpirationDate)) ? new Date(props?.ExpirationDate) : new Date()
this.IsTransferable = props?.IsTransferable || 1
}
}
export class OptionList {
public '@class' = '.OptionList'
public OptionStruct: OptionStruct[] = []
constructor(props: any) {
this.OptionStruct = (props?.OptionStruct || []).map((item: any) => new OptionStruct(item))
}
}
export class ArgStruct {
public '@class' = '.ArgStruct'
public Name: string
public Value: string
constructor(props: any) {
this.Name = props?.Name || ''
this.Value = props?.Value || ''
}
}
export class FileTypeArg {
public '@class' = '.FileTypeArg'
public ArgStruct: ArgStruct[] = []
constructor(props: any) {
this.ArgStruct = (props?.ArgStruct || []).map((item: any) => new ArgStruct(item))
}
}
class ParameterListAttribute {
public ArrayType: string
constructor(props: any) {
this.ArrayType = props?.ArrayType || ''
}
}
class ParameterList {
public '@class' = '.ParameterList'
public $?: ParameterListAttribute
public ParameterValueStruct: Array<ParameterValueStruct> = []
constructor(props: any) {
this.$ = props?.$ ? new ParameterListAttribute(props?.$) : undefined
this.ParameterValueStruct = (props?.ParameterValueStruct || []).map((parameter: any) => new ParameterValueStruct(parameter))
}
}
export class Inform {
public '@class' = '.Inform'
public DeviceId: DeviceIdStruct
public Event: Event
public MaxEnvelopes: number
public CurrentTime: Date
public RetryCount: number
public ParameterList: ParameterList
constructor(props: any) {
this.DeviceId = new DeviceIdStruct(props?.DeviceId)
this.Event = new Event(props?.Event)
this.MaxEnvelopes = parseInt(props?.MaxEnvelopes) || 0
this.CurrentTime = props?.CurrentTime && !isNaN(Date.parse(props?.CurrentTime)) ? new Date(props?.CurrentTime) : new Date()
this.RetryCount = parseInt(props?.RetryCount) || 0
this.ParameterList = new ParameterList(props?.ParameterList)
}
}
export class InformResponse {
public '@class' = '.InformResponse'
public MaxEnvelopes: number
constructor(props: any) {
this.MaxEnvelopes = props?.MaxEnvelopes || 0
}
getXml() {
return `<cwmp:InformResponse>
<MaxEnvelopes>
${this.MaxEnvelopes}
</MaxEnvelopes>
</cwmp:InformResponse>`
}
}
export class TransferComplete {
public '@class' = '.TransferComplete'
public CommandKey?: CommandKeyType
public FaultStruct?: FaultStruct
public StartTime?: Date
public CompleteTime?: Date
constructor(props: any) {
this.CommandKey = props?.CommandKey
this.FaultStruct = props?.FaultStruct ? new FaultStruct(props.FaultStruct) : undefined
this.StartTime = props?.StartTime ? new Date(props.StartTime) : undefined
this.CompleteTime = props?.CompleteTime ? new Date(props.CompleteTime) : undefined
}
}
export class TransferCompleteResponse {
public '@class' = '.TransferCompleteResponse'
constructor(props: any) {}
getXml() {
return ''
}
}
export class Kicked {
public '@class' = '.Kicked'
public Command?: string
public Referer?: string
public Arg?: string
public Next?: string
constructor(props: any) {
this.Command = props?.Command
this.Referer = props?.Referer
this.Arg = props?.Arg
this.Next = props?.Next
}
}
export class KickedResponse {
public '@class' = '.KickedResponse'
public NextURL?: string
constructor(props: any) {
this.NextURL = props?.NextURL
}
}
export class RequestDownload {
public '@class' = '.RequestDownload'
public FileType?: string
public FileTypeArg?: FileTypeArg
constructor(props: any = {}) {
this.FileType = props.FileType
this.FileTypeArg = props.FileTypeArg ? new FileTypeArg(props.FileTypeArg) : undefined
}
}
export class RequestDownloadResponse {
public '@class' = '.RequestDownloadResponse'
constructor(props: any = {}) {}
}
export type CommandKeyType = string
export type ObjectNameType = string
export enum FaultCodeType {
// CPE fault codes
MethodNotSupported = 9000,
RequestDenied = 9001,
InternalError = 9002,
InvalidArguments = 9003,
ResourcesExceeded = 9004,
InvalidParameterName = 9005,
InvalidParameterType = 9006,
InvalidParameterValue = 9007,
NonWritableParameter = 9008,
NotificationRequestRejected = 9009,
DownloadFailure = 9010,
UploadFailure = 9011,
FileTransferServerAuthFailure = 9012,
UnsupportedProtocolForFileTransfer = 9013,
// CPE Vendor fault codes (range)
VendorFaultCodeMin = 9800,
VendorFaultCodeMax = 9899,
// ACS fault codes
ACSMethodNotSupported = 8000,
ACSRequestDenied = 8001,
ACSInternalError = 8002,
ACSInvalidArguments = 8003,
ACSResourcesExceeded = 8004,
ACSRetryRequest = 8005,
// ACS Vendor fault codes (range)
ACSVendorFaultCodeMin = 8800,
ACSVendorFaultCodeMax = 8899,
}