diff --git a/demo/advanced.html b/demo/advanced.html index 3f4781f..85e1d09 100644 --- a/demo/advanced.html +++ b/demo/advanced.html @@ -226,8 +226,13 @@ // Power up/head close actions modalZplPowerUpAction : HTMLSelectElement modalZplHeadCloseAction: HTMLSelectElement - } + // Networking + modalNetworkProtocolMode : HTMLSelectElement + modalNetworkIpAddress : HTMLInputElement + modalNetworkDefaultGateway: HTMLInputElement + modalNetworkNetmask : HTMLInputElement + } // A function to find and hide any alerts for a given alert ID. function hideAlerts(alertId: string) { @@ -372,6 +377,11 @@

${titleHtml}

const config = printer.printerOptions; // If the printer uses ZPL it will have a special config, show those! const isZpl = config instanceof WebLabel.ZPL.ZplPrinterConfig; + // If the printer has an IP address show the networking config! + let isNetwork = false; + if (isZpl) { + isNetwork = config.ipResolutionMode !== undefined; + } const formElement = this.configModal.querySelector('form')!; const form = formElement.elements as ConfigModalForm; @@ -384,6 +394,13 @@

${titleHtml}

e.classList.add('d-none'); } } + for (const e of formElement.querySelectorAll('.modal-setting-network')) { + if (isNetwork) { + e.classList.remove('d-none'); + } else { + e.classList.add('d-none'); + } + } // Translate the available speeds to options to be selected form.modalSpeed.innerHTML = ''; @@ -440,6 +457,14 @@

${titleHtml}

form.modalZplPowerUpAction.value = config.actionPowerUp.toString(); form.modalZplHeadCloseAction.value = config.actionHeadClose.toString(); + + if (isNetwork) { + form.modalNetworkIpAddress.value = config.ipAddress ?? ""; + form.modalNetworkDefaultGateway.value = config.defaultGateway ?? ""; + form.modalNetworkNetmask.value = config.subnetMask ?? ""; + form.modalNetworkProtocolMode.value = config.ipResolutionMode ?? "ALL"; + // TODO: On protocol change lock out IP settings for DHCP + } } this.configModalHandle.show(); @@ -745,6 +770,17 @@

${titleHtml}

ribbonThreshold : Number(form.modalZplRibbonTHold.value), webThreshold : Number(form.modalZplWebTHold.value), })); + + + const isNetwork = printer.printerOptions.ipResolutionMode !== undefined; + if (isNetwork) { + configDoc.andThen(new WebLabel.ZPL.CmdSetNetworkIpResolutionMode( + form.modalNetworkProtocolMode.value as WebLabel.ZPL.NetworkIpResolutionMode, + form.modalNetworkIpAddress.value, + form.modalNetworkNetmask.value, + form.modalNetworkDefaultGateway.value + )) + } } let doc: WebLabel.IDocument; @@ -1035,6 +1071,54 @@
Printer Settings
+