Start of 5.X work

This commit is contained in:
Sebastien L
2025-03-18 17:38:34 -04:00
parent c0ddf0a997
commit 73bd096f37
442 changed files with 227862 additions and 21075 deletions

View File

@@ -3,4 +3,4 @@ import 'bootstrap';
import './sass/main.scss';
import './assets/images/favicon-32x32.png';
import './js/custom.ts';
import './js/proto/configuration_pb.js'

View File

@@ -3,13 +3,10 @@ var he = require('he');
// @ts-ignore
import Cookies from 'js-cookie';
var protobuf = require("protobufjs");
import * as bootstrap from 'bootstrap';
declare global {
interface Window {
hideSurrounding: (obj: HTMLElement) => void;
@@ -55,13 +52,7 @@ interface ArgTableEntry {
datatype?: string;
shortopts?: string;
}
type MessageEntry = {
type: string;
message: string;
class: string;
sent_time:number;
current_time:number;
};
interface CommandEntry {
help: string;
hascb: boolean;
@@ -93,15 +84,15 @@ interface ConfigPayload {
}
interface NetworkConnection {
urc: number;
auth: number ;
pwd: string ;
dhcpname: string ;
Action: number ;
ip: string ;
ssid: string ;
rssi: number ;
gw: string ;
netmask: string ;
auth: number;
pwd: string;
dhcpname: string;
Action: number;
ip: string;
ssid: string;
rssi: number;
gw: string;
netmask: string;
}
interface StatusObject {
project_name?: string;
@@ -249,6 +240,7 @@ function handleNVSVisible() {
}
function concatenateOptions(options: object): string {
let commandLine = ' ';
for (const [option, value] of Object.entries(options)) {
if (option !== 'n' && option !== 'o') {
commandLine += `-${option} `;
@@ -260,9 +252,9 @@ function concatenateOptions(options: object): string {
return commandLine;
}
function isEnabled(val:string) {
function isEnabled(val: string) {
const matchResult = val && typeof val === 'string' && val.match("[Yy1]");
return matchResult && matchResult !== null && matchResult.length > 0;
return matchResult && matchResult !== null && matchResult.length > 0;
}
enum NVSType {
@@ -436,7 +428,7 @@ let flashState = {
// Reboot system to recovery mode
this.SetStatusText('Starting recovery mode.')
$.ajax({
url: '/recovery.json',
url: '/recovery.zzz',
context: this,
dataType: 'text',
method: 'POST',
@@ -590,7 +582,7 @@ let flashState = {
}
}
};
xhttp.open('POST', '/flash.json', true);
xhttp.open('POST', '/flash.zzz', true);
xhttp.send(this.flashFileName);
},
TargetReadyStartOTA: function () {
@@ -663,7 +655,7 @@ function post_config(data: object) {
config: data
};
$.ajax({
url: '/config.json',
url: '/config.zzz',
dataType: 'text',
method: 'POST',
cache: false,
@@ -807,14 +799,7 @@ function handleTemplateTypeRadio(outtype: OutputType): void {
}
}
function handleExceptionResponse(xhr: JQuery.jqXHR<any>
, _ajaxOptions: JQuery.Ajax.ErrorTextStatus, thrownError: string) {
console.log(xhr.status);
console.log(thrownError);
if (thrownError !== '') {
showLocalMessage(thrownError, 'MESSAGING_ERROR');
}
}
function HideCmdMessage(cmdname: string) {
$('#toast_' + cmdname)
.removeClass('table-success')
@@ -877,8 +862,8 @@ let validOptions = {
let apList = null;
//let selectedSSID = '';
//let checkStatusInterval = null;
let messagecount = 0;
let messageseverity:string = 'MESSAGING_INFO';
let SystemConfig: any;
let LastCommandsState: number = NaN;
var output = '';
@@ -890,7 +875,6 @@ let depth = 16;
let board_model = '';
let platform_name = versionName;
let preset_name = '';
let btSinkNamesOptSel = '#cfg-audio-bt_source-sink_name';
let ConnectedTo: NetworkConnection;
let ConnectingToSSID: NetworkConnection;
let lmsBaseUrl: string = "";
@@ -949,7 +933,7 @@ function getConfigJson(slimMode: boolean): Config {
function handleHWPreset(allfields: NodeListOf<HTMLInputElement>, reboot: boolean): void {
function handleHWPreset(allfields: NodeListOf<HTMLInputElement>, reboot: boolean): void {
const selJson = JSON.parse(allfields[0].value);
const cmd = allfields[0].getAttribute("cmdname");
console.log(`selected model: ${selJson.name}`);
@@ -980,7 +964,7 @@ function handleHWPreset(allfields: NodeListOf<HTMLInputElement>, reboot: boolea
);
$.ajax({
url: '/config.json',
url: '/config.zzz',
dataType: 'text',
method: 'POST',
cache: false,
@@ -1099,7 +1083,7 @@ function saveAutoexec1(apply: boolean) {
};
$.ajax({
url: '/config.json',
url: '/config.zzz',
dataType: 'text',
method: 'POST',
cache: false,
@@ -1136,7 +1120,7 @@ function saveAutoexec1(apply: boolean) {
}
function handleDisconnect() {
$.ajax({
url: '/connect.json',
url: '/connect.zzz',
dataType: 'text',
method: 'DELETE',
cache: false,
@@ -1161,7 +1145,7 @@ function handleConnect() {
$('#ssid-wait').text(ConnectingToSSID.ssid);
$('.connecting').show();
$.ajax({
url: '/connect.json',
url: '/connect.zzz',
dataType: 'text',
method: 'POST',
cache: false,
@@ -1438,7 +1422,7 @@ $(function () {
ConnectedTo = resetNetworkConnection();
refreshAPHTML2();
$.ajax({
url: '/connect.json',
url: '/connect.zzz',
dataType: 'text',
method: 'DELETE',
cache: false,
@@ -1686,9 +1670,54 @@ function refreshAP() {
$.ajaxSetup({
timeout: 3000 //Time in milliseconds
});
$.getJSON('/scan.json', async function () {
// Create an instance of Payload and set values
var payload = new proto.sys.request.Payload();
payload.setType(proto.sys.request.Type.SCAN); // Example: Setting the type field
payload.setAction(proto.sys.request.Action.SET);
// Serialize the Payload to binary
var serializedPayload = payload.serializeBinary();
$.ajax({
url: '/data.bin', // URL to send the POST request
method: 'POST',
contentType: 'application/octet-stream', // Indicate that the content is binary
processData: false, // Prevent jQuery from converting the binary data to string
data: serializedPayload, // The binary data
success: function(data) {
console.log('Response received:', data);
try {
// Assuming 'proto.sys.Config.decode' is the method to deserialize your data
var ConfigMessage = proto.sys.Config; // Replace with your actual message class
var config = ConfigMessage.deserializeBinary(new Uint8Array(data));
console.log('Config received:', config);
document.title = config.getNames().getDevice();
hostName = config.getNames().getDevice();
releaseURL = config.getServices().getReleaseUrl();
$("#s_airplay").css({ display: config.getServices().getAirplay().getEnabled() ? 'inline' : 'none' })
$("#s_cspot").css({ display: config.getServices().getCspot().getEnabled() ? 'inline' : 'none' })
} catch (error) {
console.error('Error decoding protobuf message:', error);
}
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('Error initiating scan:', textStatus, errorThrown);
}
}).fail(function (xhr, ajaxOptions, thrownError) {
handleExceptionResponse(xhr, ajaxOptions, thrownError);
});
$.getJSON('/scan.bin', async function () {
await sleep(2000);
$.getJSON('/ap.json', function (data: NetworkConnection[]) {
$.getJSON('/ap.bin', function (data: NetworkConnection[]) {
if (data.length > 0) {
// sort by signal strength
data.sort(function (a, b) {
@@ -1767,14 +1796,15 @@ function showTask(task: TaskDetails) {
function btExists(name: string) {
return getBTSinkOpt(name).length > 0;
}
function getBTSinkOpt(name: string) {
return $(`${btSinkNamesOptSel} option:contains('${name}')`);
function getBTSinkOpt(name: string):string {
// return $(`${btSinkNamesOptSel} option:contains('${name}')`);
return "";
}
function getMessages() {
$.ajaxSetup({
timeout: messageInterval //Time in milliseconds
});
$.getJSON('/messages.json', async function (data) {
$.getJSON('/messages.zzz', async function (data) {
for (const msg of data) {
const msgAge = msg.current_time - msg.sent_time;
var msgTime = new Date();
@@ -1818,52 +1848,50 @@ function getMessages() {
showCmdMessage(msgparts[1], msg.type, msgparts[2], true);
break;
case 'MESSAGING_CLASS_BT':
if ($(btSinkNamesOptSel).is('input')) {
const sinkNameCtrl = $(btSinkNamesOptSel)[0] as HTMLInputElement;
var attr = sinkNameCtrl.attributes;
var attrs = '';
for (var j = 0; j < attr.length; j++) {
if (attr.item(j).name != "type") {
attrs += `${attr.item(j).name} = "${attr.item(j).value}" `;
}
}
var curOpt = sinkNameCtrl.value;
$(btSinkNamesOptSel).replaceWith(`<select id="cfg-audio-bt_source-sink_name" ${attrs}><option value="${curOpt}" data-bs-description="${curOpt}">${curOpt}</option></select> `);
}
// if ($(btSinkNamesOptSel).is('input')) {
// const sinkNameCtrl = $(btSinkNamesOptSel)[0] as HTMLInputElement;
// var attr = sinkNameCtrl.attributes;
// var attrs = '';
// for (var j = 0; j < attr.length; j++) {
// if (attr.item(j).name != "type") {
// attrs += `${attr.item(j).name} = "${attr.item(j).value}" `;
// }
// }
// var curOpt = sinkNameCtrl.value;
// $(btSinkNamesOptSel).replaceWith(`<select id="cfg-audio-bt_source-sink_name" ${attrs}><option value="${curOpt}" data-bs-description="${curOpt}">${curOpt}</option></select> `);
// }
JSON.parse(msg.message).forEach(function (btEntry: BTDevice) {
// [{\n\t\t\"name\":\t\"SMSL BT4.2\",\n\t\t\"rssi\":\t-64\n\t}]
//<input type="text" class="form-control bg-success" placeholder="name" hasvalue="true" longopts="sink_name" shortopts="n" checkbox="false" cmdname="cfg-audio-bt_source" id="cfg-audio-bt_source-sink_name" name="cfg-audio-bt_source-sink_name">
//<select hasvalue="true" longopts="jack_behavior" shortopts="j" checkbox="false" cmdname="cfg-audio-general" id="cfg-audio-general-jack_behavior" name="cfg-audio-general-jack_behavior" class="form-control "><option>--</option><option>Headphones</option><option>Subwoofer</option></select>
if (!btExists(btEntry.name)) {
$(btSinkNamesOptSel).append(`<option>${btEntry.name}</option>`);
showMessage({
type: msg.type,
message: `BT Audio device found: ${btEntry.name} RSSI: ${btEntry.rssi} `,
class: '',
sent_time: 0,
current_time: 0
}, msgTime);
}
getBTSinkOpt(btEntry.name).attr('data-bs-description', `${btEntry.name} (${btEntry.rssi}dB)`)
.attr('rssi', btEntry.rssi)
.attr('value', btEntry.name)
.text(`${btEntry.name} [${btEntry.rssi}dB]`).trigger('change');
// JSON.parse(msg.message).forEach(function (btEntry: BTDevice) {
});
// // if (!btExists(btEntry.name)) {
// // $(btSinkNamesOptSel).append(`<option>${btEntry.name}</option>`);
// // showMessage({
// // type: msg.type,
// // message: `BT Audio device found: ${btEntry.name} RSSI: ${btEntry.rssi} `,
// // class: '',
// // sent_time: 0,
// // current_time: 0
// // }, msgTime);
// // }
// getBTSinkOpt(btEntry.name).attr('data-bs-description', `${btEntry.name} (${btEntry.rssi}dB)`)
// .attr('rssi', btEntry.rssi)
// .attr('value', btEntry.name)
// .text(`${btEntry.name} [${btEntry.rssi}dB]`).trigger('change');
// });
// Get the options as an array
const btEntries = Array.from($(btSinkNamesOptSel).find('option'));
// const btEntries = Array.from($(btSinkNamesOptSel).find('option'));
// Sort the options based on the 'rssi' attribute
btEntries.sort(function (a, b) {
const rssiA = parseInt($(a).attr('rssi'), 10);
const rssiB = parseInt($(b).attr('rssi'), 10);
console.log(`${rssiA} < ${rssiB} ? `);
return rssiB - rssiA; // Sort by descending RSSI values
});
// btEntries.sort(function (a, b) {
// const rssiA = parseInt($(a).attr('rssi'), 10);
// const rssiB = parseInt($(b).attr('rssi'), 10);
// console.log(`${rssiA} < ${rssiB} ? `);
// return rssiB - rssiA; // Sort by descending RSSI values
// });
// Clear the select element and append the sorted options
$(btSinkNamesOptSel).empty().append(btEntries);
// // Clear the select element and append the sorted options
// $(btSinkNamesOptSel).empty().append(btEntries);
break;
default:
break;
@@ -1907,7 +1935,7 @@ function handleRecoveryMode(data: StatusObject) {
$('.recovery_element').show();
$('.ota_element').hide();
$('#boot-button').html('Reboot');
$('#boot-form').attr('action', '/reboot_ota.json');
$('#boot-form').attr('action', '/reboot_ota.zzz');
} else {
if (!recovery && messagesHeld) {
messagesHeld = false;
@@ -1918,7 +1946,7 @@ function handleRecoveryMode(data: StatusObject) {
$('.recovery_element').hide();
$('.ota_element').show();
$('#boot-button').html('Recovery');
$('#boot-form').attr('action', '/recovery.json');
$('#boot-form').attr('action', '/recovery.zzz');
}
}
@@ -2067,7 +2095,7 @@ function checkStatus() {
$.ajaxSetup({
timeout: statusInterval //Time in milliseconds
});
$.getJSON('/status.json', function (data) {
$.getJSON('/status.zzz', function (data) {
handleRecoveryMode(data);
handleNVSVisible();
handleNetworkStatus(data);
@@ -2202,10 +2230,10 @@ window.runCommand = function (button, reboot) {
timestamp: Date.now(),
command: cmdstring
};
$.ajax({
url: '/commands.json',
url: '/commands.zzz',
dataType: 'text',
method: 'POST',
cache: false,
@@ -2243,17 +2271,17 @@ window.runCommand = function (button, reboot) {
},
});
}
function getLongOps(data:CommandValues, name:string, longopts:string) {
function getLongOps(data: CommandValues, name: string, longopts: string) {
return data[name] !== undefined ? data[name][longopts] : "";
}
function getCommands() {
$.ajaxSetup({
timeout: 7000 //Time in milliseconds
});
$.getJSON('/commands.json', function (data) {
$.getJSON('/commands.zzz', function (data) {
console.log(data);
$('.orec').show();
data.commands.forEach(function (command:CommandEntry) {
data.commands.forEach(function (command: CommandEntry) {
if ($('#flds-' + command.name).length === 0) {
const cmdParts = command.name.split('-');
const isConfig = cmdParts[0] === 'cfg';
@@ -2326,7 +2354,7 @@ function getCommands() {
});
$(".sclk").off('click').on('click', function () { window.runCommand((this as HTMLButtonElement), false); });
$(".cclk").off('click').on('click', function () { window.runCommand((this as HTMLButtonElement), true); });
data.commands.forEach(function (command:CommandEntry) {
data.commands.forEach(function (command: CommandEntry) {
$('[cmdname=' + command.name + ']:input').val('');
$('[cmdname=' + command.name + ']:checkbox').prop('checked', false);
if (command.argtable) {
@@ -2342,7 +2370,7 @@ function getCommands() {
.trigger('change');
}
if (
($(ctrlselector)[0] as HTMLInputElement).value.length === 0 &&
($(ctrlselector)[0] as HTMLInputElement).value.length === 0 &&
(arg.datatype || '').includes('|')
) {
($(ctrlselector)[0] as HTMLInputElement).value = '--';
@@ -2368,75 +2396,113 @@ function getConfig() {
$.ajaxSetup({
timeout: 7000 //Time in milliseconds
});
$.getJSON('/config.json', function (entries) {
$('#nvsTable tr').remove();
const data = (entries.config ? entries.config : entries);
SystemConfig = data;
commandBTSinkName = '';
Object.keys(data)
.sort()
.forEach(function (key) {
let val = data[key].value;
if (key === 'autoexec1') {
/* call new function to parse the squeezelite options */
processSqueezeliteCommandLine(val);
} else if (key === 'host_name') {
val = val.replaceAll('"', '');
$('input#dhcp-name1').val(val);
$('input#dhcp-name2').val(val);
if ($('#cmd_opt_n').length == 0) {
$('#cmd_opt_n').val(val);
// Create an instance of Payload and set values
var payload = new proto.sys.request.Payload();
payload.setType(proto.sys.request.Type.CONFIG); // Example: Setting the type field
payload.setAction(proto.sys.request.Action.GET);
// Serialize the Payload to binary
var serializedPayload = payload.serializeBinary();
$.ajax({
url: '/data.bin', // URL to send the POST request
method: 'POST',
contentType: 'application/octet-stream', // Indicate that the content is binary
processData: false, // Prevent jQuery from converting the binary data to string
data: serializedPayload, // The binary data
success: function(data) {
console.log('Response received:', data);
try {
// Assuming 'proto.sys.Config.decode' is the method to deserialize your data
var ConfigMessage = proto.sys.Config; // Replace with your actual message class
var config = ConfigMessage.deserializeBinary(new Uint8Array(data));
console.log('Config received:', config);
document.title = config.getNames().getDevice();
hostName = config.getNames().getDevice();
releaseURL = config.getServices().getReleaseUrl();
$("#s_airplay").css({ display: config.getServices().getAirplay().getEnabled() ? 'inline' : 'none' })
$("#s_cspot").css({ display: config.getServices().getCspot().getEnabled() ? 'inline' : 'none' })
} catch (error) {
console.error('Error decoding protobuf message:', error);
}
document.title = val;
hostName = val;
} else if (key === 'rel_api') {
releaseURL = val;
}
else if (key === 'enable_airplay') {
$("#s_airplay").css({ display: isEnabled(val) ? 'inline' : 'none' })
}
else if (key === 'enable_cspot') {
$("#s_cspot").css({ display: isEnabled(val) ? 'inline' : 'none' })
}
else if (key == 'preset_name') {
preset_name = val;
}
else if (key == 'board_model') {
board_model = val;
}
$('tbody#nvsTable').append(
`<tr><td>${key}</td><td class='value'><input type='text' class='form-control nvs' id='${key}' nvs_type=${data[key].type} ></td></tr>`
);
$('input#' + key).val(data[key].value);
});
if (commandBTSinkName.length > 0) {
// persist the sink name found in the autoexec1 command line
$('#cfg-audio-bt_source-sink_name').val(commandBTSinkName);
}
$('tbody#nvsTable').append(
"<tr><td><input type='text' class='form-control' id='nvs-new-key' placeholder='new key'></td><td><input type='text' class='form-control' id='nvs-new-value' placeholder='new value' nvs_type=33 ></td></tr>"
);
if (entries.gpio) {
$('#pins').show();
$('tbody#gpiotable tr').remove();
entries.gpio.forEach(function (gpioEntry: GPIOEntry) {
$('tbody#gpiotable').append(
`<tr class=${gpioEntry.fixed ? 'table-secondary' : 'table-primary'}><th scope="row">${gpioEntry.group}</th><td>${gpioEntry.name}</td><td>${gpioEntry.gpio}</td><td>${gpioEntry.fixed ? 'Fixed' : 'Configuration'}</td></tr>`
);
});
}
else {
$('#pins').hide();
}
}).fail(function (xhr, ajaxOptions, thrownError) {
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('Error sending config:', textStatus, errorThrown);
}
}).fail(function (xhr, ajaxOptions, thrownError) {
handleExceptionResponse(xhr, ajaxOptions, thrownError);
});
// $.getJSON('/config.zzz', function (entries) {
// $('#nvsTable tr').remove();
// const data = (entries.config ? entries.config : entries);
// SystemConfig = data;
// commandBTSinkName = '';
// Object.keys(data)
// .sort()
// .forEach(function (key) {
// let val = data[key].value;
// if (key === 'autoexec1') {
// /* call new function to parse the squeezelite options */
// processSqueezeliteCommandLine(val);
// } else if (key === 'host_name') {
// val = val.replaceAll('"', '');
// $('input#dhcp-name1').val(val);
// $('input#dhcp-name2').val(val);
// if ($('#cmd_opt_n').length == 0) {
// $('#cmd_opt_n').val(val);
// }
// document.title = val;
// hostName = val;
// } else if (key === 'rel_api') {
// releaseURL = val;
// }
// else if (key === 'enable_airplay') {
// $("#s_airplay").css({ display: isEnabled(val) ? 'inline' : 'none' })
// }
// else if (key === 'enable_cspot') {
// $("#s_cspot").css({ display: isEnabled(val) ? 'inline' : 'none' })
// }
// else if (key == 'preset_name') {
// preset_name = val;
// }
// else if (key == 'board_model') {
// board_model = val;
// }
// $('tbody#nvsTable').append(
// `<tr><td>${key}</td><td class='value'><input type='text' class='form-control nvs' id='${key}' nvs_type=${data[key].type} ></td></tr>`
// );
// $('input#' + key).val(data[key].value);
// });
// if (commandBTSinkName.length > 0) {
// // persist the sink name found in the autoexec1 command line
// $('#cfg-audio-bt_source-sink_name').val(commandBTSinkName);
// }
// $('tbody#nvsTable').append(
// "<tr><td><input type='text' class='form-control' id='nvs-new-key' placeholder='new key'></td><td><input type='text' class='form-control' id='nvs-new-value' placeholder='new value' nvs_type=33 ></td></tr>"
// );
// if (entries.gpio) {
// $('#pins').show();
// $('tbody#gpiotable tr').remove();
// entries.gpio.forEach(function (gpioEntry: GPIOEntry) {
// $('tbody#gpiotable').append(
// `<tr class=${gpioEntry.fixed ? 'table-secondary' : 'table-primary'}><th scope="row">${gpioEntry.group}</th><td>${gpioEntry.name}</td><td>${gpioEntry.gpio}</td><td>${gpioEntry.fixed ? 'Fixed' : 'Configuration'}</td></tr>`
// );
// });
// }
// else {
// $('#pins').hide();
// }
}
function processSqueezeliteCommandLine(val:string) {
function processSqueezeliteCommandLine(val: string) {
const parsed = parseSqueezeliteCommandLine(val);
if (parsed.output.toUpperCase().startsWith('I2S')) {
handleTemplateTypeRadio('i2s');
@@ -2454,9 +2520,9 @@ function processSqueezeliteCommandLine(val:string) {
if (!$(`#cmd_opt_${key}`).hasOwnProperty('checked')) {
$(`#cmd_opt_${key}`).val(option);
} else {
if(typeof option === 'boolean'){
($(`#cmd_opt_${key}`)[0] as HTMLInputElement).checked = option ;
}
if (typeof option === 'boolean') {
($(`#cmd_opt_${key}`)[0] as HTMLInputElement).checked = option;
}
}
});
if (parsed.options.hasOwnProperty('u')) {
@@ -2483,55 +2549,14 @@ function processSqueezeliteCommandLine(val:string) {
}
function showLocalMessage(message:string, severity:string) {
const msg:MessageEntry = {
message: message,
type: severity,
class: '',
sent_time: 0,
current_time: 0
};
showMessage(msg, new Date());
}
function showMessage(msg: MessageEntry, msgTime: Date) {
let color = 'table-success';
if (msg.type === 'MESSAGING_WARNING') {
color = 'table-warning';
if (messageseverity === 'MESSAGING_INFO') {
messageseverity = 'MESSAGING_WARNING';
}
} else if (msg.type === 'MESSAGING_ERROR') {
if (
messageseverity === 'MESSAGING_INFO' ||
messageseverity === 'MESSAGING_WARNING'
) {
messageseverity = 'MESSAGING_ERROR';
}
color = 'table-danger';
}
if (++messagecount > 0) {
$('#msgcnt').removeClass('badge-success');
$('#msgcnt').removeClass('badge-warning');
$('#msgcnt').removeClass('badge-danger');
$('#msgcnt').addClass({
MESSAGING_INFO: 'badge-success',
MESSAGING_WARNING: 'badge-warning',
MESSAGING_ERROR: 'badge-danger',
}[messageseverity]);
$('#msgcnt').text(messagecount);
}
$('#syslogTable').append(
`<tr class='${color}'><td>${msgTime.toLocalShort()}</td><td>${msg.message.encodeHTML()}</td></tr>`
);
}
function inRange(x:number, min:number, max:number) {
function inRange(x: number, min: number, max: number) {
return (x - min) * (x - max) <= 0;
}
function sleep(ms:number) {
function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}

View File

@@ -0,0 +1,54 @@
let messagecount = 0;
type MessageEntry = {
type: string;
message: string;
class: string;
sent_time: number;
current_time: number;
};
function showMessage(msg: MessageEntry, msgTime: Date,messageseverity: string= 'MESSAGING_INFO') {
let color = 'table-success';
if (msg.type === 'MESSAGING_WARNING') {
color = 'table-warning';
if (messageseverity === 'MESSAGING_INFO') {
messageseverity = 'MESSAGING_WARNING';
}
} else if (msg.type === 'MESSAGING_ERROR') {
if (
messageseverity === 'MESSAGING_INFO' ||
messageseverity === 'MESSAGING_WARNING'
) {
messageseverity = 'MESSAGING_ERROR';
}
color = 'table-danger';
}
if (++messagecount > 0) {
$('#msgcnt').removeClass('badge-success');
$('#msgcnt').removeClass('badge-warning');
$('#msgcnt').removeClass('badge-danger');
$('#msgcnt').addClass({
MESSAGING_INFO: 'badge-success',
MESSAGING_WARNING: 'badge-warning',
MESSAGING_ERROR: 'badge-danger',
}[messageseverity]);
$('#msgcnt').text(messagecount);
}
$('#syslogTable').append(
`<tr class='${color}'><td>${msgTime.toLocalShort()}</td><td>${msg.message.encodeHTML()}</td></tr>`
);
}
function showLocalMessage(message: string, severity: string) {
const msg: MessageEntry = {
message: message,
type: severity,
class: '',
sent_time: 0,
current_time: 0
};
showMessage(msg, new Date());
}

View File

@@ -0,0 +1,210 @@
// source: AirPlay.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
var customoptions_pb = require('./customoptions_pb.js');
goog.object.extend(proto, customoptions_pb);
goog.exportSymbol('proto.sys.AirPlay', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.AirPlay = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.sys.AirPlay, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.AirPlay.displayName = 'proto.sys.AirPlay';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.AirPlay.prototype.toObject = function(opt_includeInstance) {
return proto.sys.AirPlay.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.AirPlay} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.AirPlay.toObject = function(includeInstance, msg) {
var f, obj = {
enabled: jspb.Message.getBooleanFieldWithDefault(msg, 1, false),
port: jspb.Message.getFieldWithDefault(msg, 2, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.AirPlay}
*/
proto.sys.AirPlay.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.AirPlay;
return proto.sys.AirPlay.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.AirPlay} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.AirPlay}
*/
proto.sys.AirPlay.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {boolean} */ (reader.readBool());
msg.setEnabled(value);
break;
case 2:
var value = /** @type {number} */ (reader.readUint32());
msg.setPort(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.AirPlay.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.AirPlay.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.AirPlay} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.AirPlay.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getEnabled();
if (f) {
writer.writeBool(
1,
f
);
}
f = message.getPort();
if (f !== 0) {
writer.writeUint32(
2,
f
);
}
};
/**
* optional bool enabled = 1;
* @return {boolean}
*/
proto.sys.AirPlay.prototype.getEnabled = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false));
};
/**
* @param {boolean} value
* @return {!proto.sys.AirPlay} returns this
*/
proto.sys.AirPlay.prototype.setEnabled = function(value) {
return jspb.Message.setProto3BooleanField(this, 1, value);
};
/**
* optional uint32 port = 2;
* @return {number}
*/
proto.sys.AirPlay.prototype.getPort = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {number} value
* @return {!proto.sys.AirPlay} returns this
*/
proto.sys.AirPlay.prototype.setPort = function(value) {
return jspb.Message.setProto3IntField(this, 2, value);
};
goog.object.extend(exports, proto.sys);

View File

@@ -0,0 +1,208 @@
// source: Artwork.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
goog.exportSymbol('proto.sys.Artwork', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.Artwork = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.sys.Artwork, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.Artwork.displayName = 'proto.sys.Artwork';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.Artwork.prototype.toObject = function(opt_includeInstance) {
return proto.sys.Artwork.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.Artwork} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Artwork.toObject = function(includeInstance, msg) {
var f, obj = {
enabled: jspb.Message.getBooleanFieldWithDefault(msg, 1, false),
resize: jspb.Message.getBooleanFieldWithDefault(msg, 2, false)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.Artwork}
*/
proto.sys.Artwork.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.Artwork;
return proto.sys.Artwork.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.Artwork} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.Artwork}
*/
proto.sys.Artwork.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {boolean} */ (reader.readBool());
msg.setEnabled(value);
break;
case 2:
var value = /** @type {boolean} */ (reader.readBool());
msg.setResize(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.Artwork.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.Artwork.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.Artwork} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Artwork.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getEnabled();
if (f) {
writer.writeBool(
1,
f
);
}
f = message.getResize();
if (f) {
writer.writeBool(
2,
f
);
}
};
/**
* optional bool enabled = 1;
* @return {boolean}
*/
proto.sys.Artwork.prototype.getEnabled = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false));
};
/**
* @param {boolean} value
* @return {!proto.sys.Artwork} returns this
*/
proto.sys.Artwork.prototype.setEnabled = function(value) {
return jspb.Message.setProto3BooleanField(this, 1, value);
};
/**
* optional bool resize = 2;
* @return {boolean}
*/
proto.sys.Artwork.prototype.getResize = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false));
};
/**
* @param {boolean} value
* @return {!proto.sys.Artwork} returns this
*/
proto.sys.Artwork.prototype.setResize = function(value) {
return jspb.Message.setProto3BooleanField(this, 2, value);
};
goog.object.extend(exports, proto.sys);

View File

@@ -0,0 +1,296 @@
// source: Battery.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
goog.exportSymbol('proto.sys.Battery', null, global);
goog.exportSymbol('proto.sys.BatteryAttenEnum', null, global);
goog.exportSymbol('proto.sys.BatteryChannelEnum', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.Battery = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.sys.Battery, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.Battery.displayName = 'proto.sys.Battery';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.Battery.prototype.toObject = function(opt_includeInstance) {
return proto.sys.Battery.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.Battery} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Battery.toObject = function(includeInstance, msg) {
var f, obj = {
channel: jspb.Message.getFieldWithDefault(msg, 1, 0),
scale: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0),
cells: jspb.Message.getFieldWithDefault(msg, 3, 0),
atten: jspb.Message.getFieldWithDefault(msg, 4, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.Battery}
*/
proto.sys.Battery.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.Battery;
return proto.sys.Battery.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.Battery} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.Battery}
*/
proto.sys.Battery.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {!proto.sys.BatteryChannelEnum} */ (reader.readEnum());
msg.setChannel(value);
break;
case 2:
var value = /** @type {number} */ (reader.readFloat());
msg.setScale(value);
break;
case 3:
var value = /** @type {number} */ (reader.readInt32());
msg.setCells(value);
break;
case 4:
var value = /** @type {!proto.sys.BatteryAttenEnum} */ (reader.readEnum());
msg.setAtten(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.Battery.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.Battery.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.Battery} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Battery.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getChannel();
if (f !== 0.0) {
writer.writeEnum(
1,
f
);
}
f = message.getScale();
if (f !== 0.0) {
writer.writeFloat(
2,
f
);
}
f = message.getCells();
if (f !== 0) {
writer.writeInt32(
3,
f
);
}
f = message.getAtten();
if (f !== 0.0) {
writer.writeEnum(
4,
f
);
}
};
/**
* optional BatteryChannelEnum channel = 1;
* @return {!proto.sys.BatteryChannelEnum}
*/
proto.sys.Battery.prototype.getChannel = function() {
return /** @type {!proto.sys.BatteryChannelEnum} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {!proto.sys.BatteryChannelEnum} value
* @return {!proto.sys.Battery} returns this
*/
proto.sys.Battery.prototype.setChannel = function(value) {
return jspb.Message.setProto3EnumField(this, 1, value);
};
/**
* optional float scale = 2;
* @return {number}
*/
proto.sys.Battery.prototype.getScale = function() {
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0));
};
/**
* @param {number} value
* @return {!proto.sys.Battery} returns this
*/
proto.sys.Battery.prototype.setScale = function(value) {
return jspb.Message.setProto3FloatField(this, 2, value);
};
/**
* optional int32 cells = 3;
* @return {number}
*/
proto.sys.Battery.prototype.getCells = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {number} value
* @return {!proto.sys.Battery} returns this
*/
proto.sys.Battery.prototype.setCells = function(value) {
return jspb.Message.setProto3IntField(this, 3, value);
};
/**
* optional BatteryAttenEnum atten = 4;
* @return {!proto.sys.BatteryAttenEnum}
*/
proto.sys.Battery.prototype.getAtten = function() {
return /** @type {!proto.sys.BatteryAttenEnum} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};
/**
* @param {!proto.sys.BatteryAttenEnum} value
* @return {!proto.sys.Battery} returns this
*/
proto.sys.Battery.prototype.setAtten = function(value) {
return jspb.Message.setProto3EnumField(this, 4, value);
};
/**
* @enum {number}
*/
proto.sys.BatteryChannelEnum = {
UNSPECIFIED_CH: 0,
CH0: 1,
CH1: 2,
CH2: 3,
CH3: 4,
CH4: 5,
CH5: 6,
CH6: 7,
CH7: 8
};
/**
* @enum {number}
*/
proto.sys.BatteryAttenEnum = {
UNSPECIFIED_ATT: 0,
ATT_0: 1,
ATT_1: 2,
ATT_2: 3,
ATT_3: 4
};
goog.object.extend(exports, proto.sys);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,57 @@
// source: Common.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
goog.exportSymbol('proto.sys.DeviceTypeEnum', null, global);
goog.exportSymbol('proto.sys.HostEnum', null, global);
goog.exportSymbol('proto.sys.PortEnum', null, global);
/**
* @enum {number}
*/
proto.sys.DeviceTypeEnum = {
UNSPECIFIED_TYPE: 0,
DEVTYPE_SPI: 1,
DEVTYPE_I2C: 2,
DEVTYPE__RMII: 3
};
/**
* @enum {number}
*/
proto.sys.PortEnum = {
UNSPECIFIED_SYSTPORT: 0,
SYSTEM: 1,
DAC_PORT: 2
};
/**
* @enum {number}
*/
proto.sys.HostEnum = {
UNSPECIFIED_HOST: 0,
HOST0: 1,
HOST1: 2
};
goog.object.extend(exports, proto.sys);

View File

@@ -0,0 +1,578 @@
// source: DAC.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var GPIO_pb = require('./GPIO_pb.js');
goog.object.extend(proto, GPIO_pb);
var DacControlSet_pb = require('./DacControlSet_pb.js');
goog.object.extend(proto, DacControlSet_pb);
var I2CBus_pb = require('./I2CBus_pb.js');
goog.object.extend(proto, I2CBus_pb);
var customoptions_pb = require('./customoptions_pb.js');
goog.object.extend(proto, customoptions_pb);
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
goog.exportSymbol('proto.sys.DAC', null, global);
goog.exportSymbol('proto.sys.DACModelEnum', null, global);
goog.exportSymbol('proto.sys.MCKEnum', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.DAC = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.sys.DAC, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.DAC.displayName = 'proto.sys.DAC';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.DAC.prototype.toObject = function(opt_includeInstance) {
return proto.sys.DAC.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.DAC} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.DAC.toObject = function(includeInstance, msg) {
var f, obj = {
bck: (f = msg.getBck()) && GPIO_pb.GPIO.toObject(includeInstance, f),
ws: (f = msg.getWs()) && GPIO_pb.GPIO.toObject(includeInstance, f),
dout: (f = msg.getDout()) && GPIO_pb.GPIO.toObject(includeInstance, f),
mck: jspb.Message.getFieldWithDefault(msg, 4, 0),
mute: (f = msg.getMute()) && GPIO_pb.GPIO.toObject(includeInstance, f),
model: jspb.Message.getFieldWithDefault(msg, 6, 0),
i2c: (f = msg.getI2c()) && I2CBus_pb.I2CBus.toObject(includeInstance, f),
daccontrolset: (f = msg.getDaccontrolset()) && DacControlSet_pb.DacControlSet.toObject(includeInstance, f),
jackMutesAmp: jspb.Message.getBooleanFieldWithDefault(msg, 9, false)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.DAC}
*/
proto.sys.DAC.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.DAC;
return proto.sys.DAC.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.DAC} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.DAC}
*/
proto.sys.DAC.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new GPIO_pb.GPIO;
reader.readMessage(value,GPIO_pb.GPIO.deserializeBinaryFromReader);
msg.setBck(value);
break;
case 2:
var value = new GPIO_pb.GPIO;
reader.readMessage(value,GPIO_pb.GPIO.deserializeBinaryFromReader);
msg.setWs(value);
break;
case 3:
var value = new GPIO_pb.GPIO;
reader.readMessage(value,GPIO_pb.GPIO.deserializeBinaryFromReader);
msg.setDout(value);
break;
case 4:
var value = /** @type {!proto.sys.MCKEnum} */ (reader.readEnum());
msg.setMck(value);
break;
case 5:
var value = new GPIO_pb.GPIO;
reader.readMessage(value,GPIO_pb.GPIO.deserializeBinaryFromReader);
msg.setMute(value);
break;
case 6:
var value = /** @type {!proto.sys.DACModelEnum} */ (reader.readEnum());
msg.setModel(value);
break;
case 7:
var value = new I2CBus_pb.I2CBus;
reader.readMessage(value,I2CBus_pb.I2CBus.deserializeBinaryFromReader);
msg.setI2c(value);
break;
case 8:
var value = new DacControlSet_pb.DacControlSet;
reader.readMessage(value,DacControlSet_pb.DacControlSet.deserializeBinaryFromReader);
msg.setDaccontrolset(value);
break;
case 9:
var value = /** @type {boolean} */ (reader.readBool());
msg.setJackMutesAmp(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.DAC.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.DAC.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.DAC} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.DAC.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getBck();
if (f != null) {
writer.writeMessage(
1,
f,
GPIO_pb.GPIO.serializeBinaryToWriter
);
}
f = message.getWs();
if (f != null) {
writer.writeMessage(
2,
f,
GPIO_pb.GPIO.serializeBinaryToWriter
);
}
f = message.getDout();
if (f != null) {
writer.writeMessage(
3,
f,
GPIO_pb.GPIO.serializeBinaryToWriter
);
}
f = message.getMck();
if (f !== 0.0) {
writer.writeEnum(
4,
f
);
}
f = message.getMute();
if (f != null) {
writer.writeMessage(
5,
f,
GPIO_pb.GPIO.serializeBinaryToWriter
);
}
f = message.getModel();
if (f !== 0.0) {
writer.writeEnum(
6,
f
);
}
f = message.getI2c();
if (f != null) {
writer.writeMessage(
7,
f,
I2CBus_pb.I2CBus.serializeBinaryToWriter
);
}
f = message.getDaccontrolset();
if (f != null) {
writer.writeMessage(
8,
f,
DacControlSet_pb.DacControlSet.serializeBinaryToWriter
);
}
f = message.getJackMutesAmp();
if (f) {
writer.writeBool(
9,
f
);
}
};
/**
* optional GPIO bck = 1;
* @return {?proto.sys.GPIO}
*/
proto.sys.DAC.prototype.getBck = function() {
return /** @type{?proto.sys.GPIO} */ (
jspb.Message.getWrapperField(this, GPIO_pb.GPIO, 1));
};
/**
* @param {?proto.sys.GPIO|undefined} value
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.setBck = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.clearBck = function() {
return this.setBck(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.DAC.prototype.hasBck = function() {
return jspb.Message.getField(this, 1) != null;
};
/**
* optional GPIO ws = 2;
* @return {?proto.sys.GPIO}
*/
proto.sys.DAC.prototype.getWs = function() {
return /** @type{?proto.sys.GPIO} */ (
jspb.Message.getWrapperField(this, GPIO_pb.GPIO, 2));
};
/**
* @param {?proto.sys.GPIO|undefined} value
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.setWs = function(value) {
return jspb.Message.setWrapperField(this, 2, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.clearWs = function() {
return this.setWs(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.DAC.prototype.hasWs = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* optional GPIO dout = 3;
* @return {?proto.sys.GPIO}
*/
proto.sys.DAC.prototype.getDout = function() {
return /** @type{?proto.sys.GPIO} */ (
jspb.Message.getWrapperField(this, GPIO_pb.GPIO, 3));
};
/**
* @param {?proto.sys.GPIO|undefined} value
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.setDout = function(value) {
return jspb.Message.setWrapperField(this, 3, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.clearDout = function() {
return this.setDout(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.DAC.prototype.hasDout = function() {
return jspb.Message.getField(this, 3) != null;
};
/**
* optional MCKEnum mck = 4;
* @return {!proto.sys.MCKEnum}
*/
proto.sys.DAC.prototype.getMck = function() {
return /** @type {!proto.sys.MCKEnum} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};
/**
* @param {!proto.sys.MCKEnum} value
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.setMck = function(value) {
return jspb.Message.setProto3EnumField(this, 4, value);
};
/**
* optional GPIO mute = 5;
* @return {?proto.sys.GPIO}
*/
proto.sys.DAC.prototype.getMute = function() {
return /** @type{?proto.sys.GPIO} */ (
jspb.Message.getWrapperField(this, GPIO_pb.GPIO, 5));
};
/**
* @param {?proto.sys.GPIO|undefined} value
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.setMute = function(value) {
return jspb.Message.setWrapperField(this, 5, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.clearMute = function() {
return this.setMute(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.DAC.prototype.hasMute = function() {
return jspb.Message.getField(this, 5) != null;
};
/**
* optional DACModelEnum model = 6;
* @return {!proto.sys.DACModelEnum}
*/
proto.sys.DAC.prototype.getModel = function() {
return /** @type {!proto.sys.DACModelEnum} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
};
/**
* @param {!proto.sys.DACModelEnum} value
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.setModel = function(value) {
return jspb.Message.setProto3EnumField(this, 6, value);
};
/**
* optional I2CBus i2c = 7;
* @return {?proto.sys.I2CBus}
*/
proto.sys.DAC.prototype.getI2c = function() {
return /** @type{?proto.sys.I2CBus} */ (
jspb.Message.getWrapperField(this, I2CBus_pb.I2CBus, 7));
};
/**
* @param {?proto.sys.I2CBus|undefined} value
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.setI2c = function(value) {
return jspb.Message.setWrapperField(this, 7, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.clearI2c = function() {
return this.setI2c(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.DAC.prototype.hasI2c = function() {
return jspb.Message.getField(this, 7) != null;
};
/**
* optional DacControlSet daccontrolset = 8;
* @return {?proto.sys.DacControlSet}
*/
proto.sys.DAC.prototype.getDaccontrolset = function() {
return /** @type{?proto.sys.DacControlSet} */ (
jspb.Message.getWrapperField(this, DacControlSet_pb.DacControlSet, 8));
};
/**
* @param {?proto.sys.DacControlSet|undefined} value
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.setDaccontrolset = function(value) {
return jspb.Message.setWrapperField(this, 8, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.clearDaccontrolset = function() {
return this.setDaccontrolset(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.DAC.prototype.hasDaccontrolset = function() {
return jspb.Message.getField(this, 8) != null;
};
/**
* optional bool jack_mutes_amp = 9;
* @return {boolean}
*/
proto.sys.DAC.prototype.getJackMutesAmp = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false));
};
/**
* @param {boolean} value
* @return {!proto.sys.DAC} returns this
*/
proto.sys.DAC.prototype.setJackMutesAmp = function(value) {
return jspb.Message.setProto3BooleanField(this, 9, value);
};
/**
* @enum {number}
*/
proto.sys.DACModelEnum = {
UNSPECIFIED_MODEL: 0,
TAS57XX: 1,
TAS5713: 2,
AC101: 3,
WM8978: 4,
ES8388: 5,
I2S: 6,
CS4265: 7
};
/**
* @enum {number}
*/
proto.sys.MCKEnum = {
UNSPECIFIED_MCK: 0,
MCK0: 1,
MCK1: 2,
MCK2: 3
};
goog.object.extend(exports, proto.sys);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,553 @@
// source: DataRequest.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
var configuration_pb = require('./configuration_pb.js');
goog.object.extend(proto, configuration_pb);
goog.exportSymbol('proto.sys.request.Action', null, global);
goog.exportSymbol('proto.sys.request.Payload', null, global);
goog.exportSymbol('proto.sys.request.Payload.DataCase', null, global);
goog.exportSymbol('proto.sys.request.Response', null, global);
goog.exportSymbol('proto.sys.request.Result', null, global);
goog.exportSymbol('proto.sys.request.Type', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.request.Payload = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, proto.sys.request.Payload.oneofGroups_);
};
goog.inherits(proto.sys.request.Payload, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.request.Payload.displayName = 'proto.sys.request.Payload';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.request.Response = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.sys.request.Response, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.request.Response.displayName = 'proto.sys.request.Response';
}
/**
* Oneof group definitions for this message. Each group defines the field
* numbers belonging to that group. When of these fields' value is set, all
* other fields in the group are cleared. During deserialization, if multiple
* fields are encountered for a group, only the last value seen will be kept.
* @private {!Array<!Array<number>>}
* @const
*/
proto.sys.request.Payload.oneofGroups_ = [[3,4]];
/**
* @enum {number}
*/
proto.sys.request.Payload.DataCase = {
DATA_NOT_SET: 0,
CONFIG: 3,
URL: 4
};
/**
* @return {proto.sys.request.Payload.DataCase}
*/
proto.sys.request.Payload.prototype.getDataCase = function() {
return /** @type {proto.sys.request.Payload.DataCase} */(jspb.Message.computeOneofCase(this, proto.sys.request.Payload.oneofGroups_[0]));
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.request.Payload.prototype.toObject = function(opt_includeInstance) {
return proto.sys.request.Payload.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.request.Payload} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.request.Payload.toObject = function(includeInstance, msg) {
var f, obj = {
type: jspb.Message.getFieldWithDefault(msg, 1, 0),
action: jspb.Message.getFieldWithDefault(msg, 2, 0),
config: (f = msg.getConfig()) && configuration_pb.Config.toObject(includeInstance, f),
url: jspb.Message.getFieldWithDefault(msg, 4, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.request.Payload}
*/
proto.sys.request.Payload.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.request.Payload;
return proto.sys.request.Payload.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.request.Payload} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.request.Payload}
*/
proto.sys.request.Payload.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {!proto.sys.request.Type} */ (reader.readEnum());
msg.setType(value);
break;
case 2:
var value = /** @type {!proto.sys.request.Action} */ (reader.readEnum());
msg.setAction(value);
break;
case 3:
var value = new configuration_pb.Config;
reader.readMessage(value,configuration_pb.Config.deserializeBinaryFromReader);
msg.setConfig(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setUrl(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.request.Payload.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.request.Payload.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.request.Payload} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.request.Payload.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getType();
if (f !== 0.0) {
writer.writeEnum(
1,
f
);
}
f = message.getAction();
if (f !== 0.0) {
writer.writeEnum(
2,
f
);
}
f = message.getConfig();
if (f != null) {
writer.writeMessage(
3,
f,
configuration_pb.Config.serializeBinaryToWriter
);
}
f = /** @type {string} */ (jspb.Message.getField(message, 4));
if (f != null) {
writer.writeString(
4,
f
);
}
};
/**
* optional Type type = 1;
* @return {!proto.sys.request.Type}
*/
proto.sys.request.Payload.prototype.getType = function() {
return /** @type {!proto.sys.request.Type} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {!proto.sys.request.Type} value
* @return {!proto.sys.request.Payload} returns this
*/
proto.sys.request.Payload.prototype.setType = function(value) {
return jspb.Message.setProto3EnumField(this, 1, value);
};
/**
* optional Action action = 2;
* @return {!proto.sys.request.Action}
*/
proto.sys.request.Payload.prototype.getAction = function() {
return /** @type {!proto.sys.request.Action} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {!proto.sys.request.Action} value
* @return {!proto.sys.request.Payload} returns this
*/
proto.sys.request.Payload.prototype.setAction = function(value) {
return jspb.Message.setProto3EnumField(this, 2, value);
};
/**
* optional sys.Config config = 3;
* @return {?proto.sys.Config}
*/
proto.sys.request.Payload.prototype.getConfig = function() {
return /** @type{?proto.sys.Config} */ (
jspb.Message.getWrapperField(this, configuration_pb.Config, 3));
};
/**
* @param {?proto.sys.Config|undefined} value
* @return {!proto.sys.request.Payload} returns this
*/
proto.sys.request.Payload.prototype.setConfig = function(value) {
return jspb.Message.setOneofWrapperField(this, 3, proto.sys.request.Payload.oneofGroups_[0], value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.request.Payload} returns this
*/
proto.sys.request.Payload.prototype.clearConfig = function() {
return this.setConfig(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.request.Payload.prototype.hasConfig = function() {
return jspb.Message.getField(this, 3) != null;
};
/**
* optional string URL = 4;
* @return {string}
*/
proto.sys.request.Payload.prototype.getUrl = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};
/**
* @param {string} value
* @return {!proto.sys.request.Payload} returns this
*/
proto.sys.request.Payload.prototype.setUrl = function(value) {
return jspb.Message.setOneofField(this, 4, proto.sys.request.Payload.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.sys.request.Payload} returns this
*/
proto.sys.request.Payload.prototype.clearUrl = function() {
return jspb.Message.setOneofField(this, 4, proto.sys.request.Payload.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.request.Payload.prototype.hasUrl = function() {
return jspb.Message.getField(this, 4) != null;
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.request.Response.prototype.toObject = function(opt_includeInstance) {
return proto.sys.request.Response.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.request.Response} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.request.Response.toObject = function(includeInstance, msg) {
var f, obj = {
result: jspb.Message.getFieldWithDefault(msg, 1, 0),
message: jspb.Message.getFieldWithDefault(msg, 2, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.request.Response}
*/
proto.sys.request.Response.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.request.Response;
return proto.sys.request.Response.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.request.Response} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.request.Response}
*/
proto.sys.request.Response.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {!proto.sys.request.Result} */ (reader.readEnum());
msg.setResult(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setMessage(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.request.Response.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.request.Response.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.request.Response} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.request.Response.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getResult();
if (f !== 0.0) {
writer.writeEnum(
1,
f
);
}
f = message.getMessage();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
};
/**
* optional Result result = 1;
* @return {!proto.sys.request.Result}
*/
proto.sys.request.Response.prototype.getResult = function() {
return /** @type {!proto.sys.request.Result} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {!proto.sys.request.Result} value
* @return {!proto.sys.request.Response} returns this
*/
proto.sys.request.Response.prototype.setResult = function(value) {
return jspb.Message.setProto3EnumField(this, 1, value);
};
/**
* optional string message = 2;
* @return {string}
*/
proto.sys.request.Response.prototype.getMessage = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.sys.request.Response} returns this
*/
proto.sys.request.Response.prototype.setMessage = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* @enum {number}
*/
proto.sys.request.Type = {
UNKNOWN: 0,
CONFIG: 1,
STATUS: 2,
MESSAGE: 3,
RESTART: 4,
NETWORK: 5,
OTA: 6,
SCAN: 7
};
/**
* @enum {number}
*/
proto.sys.request.Action = {
UNKNOWN_ACTION: 0,
SET: 1,
GET: 2
};
/**
* @enum {number}
*/
proto.sys.request.Result = {
UNKNOWN_RESULT: 0,
SUCCESS: 1,
ERROR: 2
};
goog.object.extend(exports, proto.sys.request);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,236 @@
// source: Equalizer.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
goog.exportSymbol('proto.sys.Equalizer', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.Equalizer = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.sys.Equalizer.repeatedFields_, null);
};
goog.inherits(proto.sys.Equalizer, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.Equalizer.displayName = 'proto.sys.Equalizer';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.sys.Equalizer.repeatedFields_ = [1];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.Equalizer.prototype.toObject = function(opt_includeInstance) {
return proto.sys.Equalizer.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.Equalizer} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Equalizer.toObject = function(includeInstance, msg) {
var f, obj = {
gainsList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 1)) == null ? undefined : f,
loudness: jspb.Message.getFloatingPointFieldWithDefault(msg, 2, 0.0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.Equalizer}
*/
proto.sys.Equalizer.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.Equalizer;
return proto.sys.Equalizer.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.Equalizer} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.Equalizer}
*/
proto.sys.Equalizer.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var values = /** @type {!Array<number>} */ (reader.isDelimited() ? reader.readPackedFloat() : [reader.readFloat()]);
for (var i = 0; i < values.length; i++) {
msg.addGains(values[i]);
}
break;
case 2:
var value = /** @type {number} */ (reader.readFloat());
msg.setLoudness(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.Equalizer.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.Equalizer.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.Equalizer} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Equalizer.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getGainsList();
if (f.length > 0) {
writer.writePackedFloat(
1,
f
);
}
f = message.getLoudness();
if (f !== 0.0) {
writer.writeFloat(
2,
f
);
}
};
/**
* repeated float gains = 1;
* @return {!Array<number>}
*/
proto.sys.Equalizer.prototype.getGainsList = function() {
return /** @type {!Array<number>} */ (jspb.Message.getRepeatedFloatingPointField(this, 1));
};
/**
* @param {!Array<number>} value
* @return {!proto.sys.Equalizer} returns this
*/
proto.sys.Equalizer.prototype.setGainsList = function(value) {
return jspb.Message.setField(this, 1, value || []);
};
/**
* @param {number} value
* @param {number=} opt_index
* @return {!proto.sys.Equalizer} returns this
*/
proto.sys.Equalizer.prototype.addGains = function(value, opt_index) {
return jspb.Message.addToRepeatedField(this, 1, value, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.sys.Equalizer} returns this
*/
proto.sys.Equalizer.prototype.clearGainsList = function() {
return this.setGainsList([]);
};
/**
* optional float loudness = 2;
* @return {number}
*/
proto.sys.Equalizer.prototype.getLoudness = function() {
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0));
};
/**
* @param {number} value
* @return {!proto.sys.Equalizer} returns this
*/
proto.sys.Equalizer.prototype.setLoudness = function(value) {
return jspb.Message.setProto3FloatField(this, 2, value);
};
goog.object.extend(exports, proto.sys);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,322 @@
// source: I2CBus.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var GPIO_pb = require('./GPIO_pb.js');
goog.object.extend(proto, GPIO_pb);
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
goog.exportSymbol('proto.sys.I2CBus', null, global);
goog.exportSymbol('proto.sys.I2CPortEnum', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.I2CBus = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.sys.I2CBus, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.I2CBus.displayName = 'proto.sys.I2CBus';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.I2CBus.prototype.toObject = function(opt_includeInstance) {
return proto.sys.I2CBus.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.I2CBus} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.I2CBus.toObject = function(includeInstance, msg) {
var f, obj = {
port: jspb.Message.getFieldWithDefault(msg, 1, 0),
speed: jspb.Message.getFieldWithDefault(msg, 2, 0),
sda: (f = msg.getSda()) && GPIO_pb.GPIO.toObject(includeInstance, f),
scl: (f = msg.getScl()) && GPIO_pb.GPIO.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.I2CBus}
*/
proto.sys.I2CBus.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.I2CBus;
return proto.sys.I2CBus.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.I2CBus} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.I2CBus}
*/
proto.sys.I2CBus.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {!proto.sys.I2CPortEnum} */ (reader.readEnum());
msg.setPort(value);
break;
case 2:
var value = /** @type {number} */ (reader.readInt32());
msg.setSpeed(value);
break;
case 3:
var value = new GPIO_pb.GPIO;
reader.readMessage(value,GPIO_pb.GPIO.deserializeBinaryFromReader);
msg.setSda(value);
break;
case 4:
var value = new GPIO_pb.GPIO;
reader.readMessage(value,GPIO_pb.GPIO.deserializeBinaryFromReader);
msg.setScl(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.I2CBus.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.I2CBus.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.I2CBus} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.I2CBus.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPort();
if (f !== 0.0) {
writer.writeEnum(
1,
f
);
}
f = message.getSpeed();
if (f !== 0) {
writer.writeInt32(
2,
f
);
}
f = message.getSda();
if (f != null) {
writer.writeMessage(
3,
f,
GPIO_pb.GPIO.serializeBinaryToWriter
);
}
f = message.getScl();
if (f != null) {
writer.writeMessage(
4,
f,
GPIO_pb.GPIO.serializeBinaryToWriter
);
}
};
/**
* optional I2CPortEnum port = 1;
* @return {!proto.sys.I2CPortEnum}
*/
proto.sys.I2CBus.prototype.getPort = function() {
return /** @type {!proto.sys.I2CPortEnum} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {!proto.sys.I2CPortEnum} value
* @return {!proto.sys.I2CBus} returns this
*/
proto.sys.I2CBus.prototype.setPort = function(value) {
return jspb.Message.setProto3EnumField(this, 1, value);
};
/**
* optional int32 speed = 2;
* @return {number}
*/
proto.sys.I2CBus.prototype.getSpeed = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {number} value
* @return {!proto.sys.I2CBus} returns this
*/
proto.sys.I2CBus.prototype.setSpeed = function(value) {
return jspb.Message.setProto3IntField(this, 2, value);
};
/**
* optional GPIO sda = 3;
* @return {?proto.sys.GPIO}
*/
proto.sys.I2CBus.prototype.getSda = function() {
return /** @type{?proto.sys.GPIO} */ (
jspb.Message.getWrapperField(this, GPIO_pb.GPIO, 3));
};
/**
* @param {?proto.sys.GPIO|undefined} value
* @return {!proto.sys.I2CBus} returns this
*/
proto.sys.I2CBus.prototype.setSda = function(value) {
return jspb.Message.setWrapperField(this, 3, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.I2CBus} returns this
*/
proto.sys.I2CBus.prototype.clearSda = function() {
return this.setSda(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.I2CBus.prototype.hasSda = function() {
return jspb.Message.getField(this, 3) != null;
};
/**
* optional GPIO scl = 4;
* @return {?proto.sys.GPIO}
*/
proto.sys.I2CBus.prototype.getScl = function() {
return /** @type{?proto.sys.GPIO} */ (
jspb.Message.getWrapperField(this, GPIO_pb.GPIO, 4));
};
/**
* @param {?proto.sys.GPIO|undefined} value
* @return {!proto.sys.I2CBus} returns this
*/
proto.sys.I2CBus.prototype.setScl = function(value) {
return jspb.Message.setWrapperField(this, 4, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.I2CBus} returns this
*/
proto.sys.I2CBus.prototype.clearScl = function() {
return this.setScl(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.I2CBus.prototype.hasScl = function() {
return jspb.Message.getField(this, 4) != null;
};
/**
* @enum {number}
*/
proto.sys.I2CPortEnum = {
UNSPECIFIED_PORT: 0,
I2CPORT0: 1,
I2CPORT1: 2
};
goog.object.extend(exports, proto.sys);

View File

@@ -0,0 +1,330 @@
// source: Names.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var customoptions_pb = require('./customoptions_pb.js');
goog.object.extend(proto, customoptions_pb);
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
goog.exportSymbol('proto.sys.Names', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.Names = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.sys.Names, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.Names.displayName = 'proto.sys.Names';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.Names.prototype.toObject = function(opt_includeInstance) {
return proto.sys.Names.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.Names} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Names.toObject = function(includeInstance, msg) {
var f, obj = {
device: jspb.Message.getFieldWithDefault(msg, 1, ""),
airplay: jspb.Message.getFieldWithDefault(msg, 2, ""),
spotify: jspb.Message.getFieldWithDefault(msg, 3, ""),
bluetooth: jspb.Message.getFieldWithDefault(msg, 4, ""),
squeezelite: jspb.Message.getFieldWithDefault(msg, 5, ""),
wifiApName: jspb.Message.getFieldWithDefault(msg, 6, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.Names}
*/
proto.sys.Names.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.Names;
return proto.sys.Names.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.Names} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.Names}
*/
proto.sys.Names.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setDevice(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setAirplay(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setSpotify(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setBluetooth(value);
break;
case 5:
var value = /** @type {string} */ (reader.readString());
msg.setSqueezelite(value);
break;
case 6:
var value = /** @type {string} */ (reader.readString());
msg.setWifiApName(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.Names.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.Names.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.Names} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Names.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getDevice();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getAirplay();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getSpotify();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
f = message.getBluetooth();
if (f.length > 0) {
writer.writeString(
4,
f
);
}
f = message.getSqueezelite();
if (f.length > 0) {
writer.writeString(
5,
f
);
}
f = message.getWifiApName();
if (f.length > 0) {
writer.writeString(
6,
f
);
}
};
/**
* optional string device = 1;
* @return {string}
*/
proto.sys.Names.prototype.getDevice = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.sys.Names} returns this
*/
proto.sys.Names.prototype.setDevice = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string airplay = 2;
* @return {string}
*/
proto.sys.Names.prototype.getAirplay = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.sys.Names} returns this
*/
proto.sys.Names.prototype.setAirplay = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* optional string spotify = 3;
* @return {string}
*/
proto.sys.Names.prototype.getSpotify = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* @param {string} value
* @return {!proto.sys.Names} returns this
*/
proto.sys.Names.prototype.setSpotify = function(value) {
return jspb.Message.setProto3StringField(this, 3, value);
};
/**
* optional string bluetooth = 4;
* @return {string}
*/
proto.sys.Names.prototype.getBluetooth = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};
/**
* @param {string} value
* @return {!proto.sys.Names} returns this
*/
proto.sys.Names.prototype.setBluetooth = function(value) {
return jspb.Message.setProto3StringField(this, 4, value);
};
/**
* optional string squeezelite = 5;
* @return {string}
*/
proto.sys.Names.prototype.getSqueezelite = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
};
/**
* @param {string} value
* @return {!proto.sys.Names} returns this
*/
proto.sys.Names.prototype.setSqueezelite = function(value) {
return jspb.Message.setProto3StringField(this, 5, value);
};
/**
* optional string wifi_ap_name = 6;
* @return {string}
*/
proto.sys.Names.prototype.getWifiApName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, ""));
};
/**
* @param {string} value
* @return {!proto.sys.Names} returns this
*/
proto.sys.Names.prototype.setWifiApName = function(value) {
return jspb.Message.setProto3StringField(this, 6, value);
};
goog.object.extend(exports, proto.sys);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,270 @@
// source: Spotify.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var customoptions_pb = require('./customoptions_pb.js');
goog.object.extend(proto, customoptions_pb);
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
goog.exportSymbol('proto.sys.Spotify', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.Spotify = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.sys.Spotify, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.Spotify.displayName = 'proto.sys.Spotify';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.Spotify.prototype.toObject = function(opt_includeInstance) {
return proto.sys.Spotify.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.Spotify} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Spotify.toObject = function(includeInstance, msg) {
var f, obj = {
enabled: jspb.Message.getBooleanFieldWithDefault(msg, 1, false),
bitrate: jspb.Message.getFieldWithDefault(msg, 2, 0),
zeroconf: jspb.Message.getBooleanFieldWithDefault(msg, 3, false),
volume: jspb.Message.getFieldWithDefault(msg, 4, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.Spotify}
*/
proto.sys.Spotify.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.Spotify;
return proto.sys.Spotify.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.Spotify} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.Spotify}
*/
proto.sys.Spotify.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {boolean} */ (reader.readBool());
msg.setEnabled(value);
break;
case 2:
var value = /** @type {number} */ (reader.readUint32());
msg.setBitrate(value);
break;
case 3:
var value = /** @type {boolean} */ (reader.readBool());
msg.setZeroconf(value);
break;
case 4:
var value = /** @type {number} */ (reader.readUint32());
msg.setVolume(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.Spotify.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.Spotify.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.Spotify} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Spotify.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getEnabled();
if (f) {
writer.writeBool(
1,
f
);
}
f = message.getBitrate();
if (f !== 0) {
writer.writeUint32(
2,
f
);
}
f = message.getZeroconf();
if (f) {
writer.writeBool(
3,
f
);
}
f = message.getVolume();
if (f !== 0) {
writer.writeUint32(
4,
f
);
}
};
/**
* optional bool enabled = 1;
* @return {boolean}
*/
proto.sys.Spotify.prototype.getEnabled = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false));
};
/**
* @param {boolean} value
* @return {!proto.sys.Spotify} returns this
*/
proto.sys.Spotify.prototype.setEnabled = function(value) {
return jspb.Message.setProto3BooleanField(this, 1, value);
};
/**
* optional uint32 bitrate = 2;
* @return {number}
*/
proto.sys.Spotify.prototype.getBitrate = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {number} value
* @return {!proto.sys.Spotify} returns this
*/
proto.sys.Spotify.prototype.setBitrate = function(value) {
return jspb.Message.setProto3IntField(this, 2, value);
};
/**
* optional bool zeroconf = 3;
* @return {boolean}
*/
proto.sys.Spotify.prototype.getZeroconf = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
};
/**
* @param {boolean} value
* @return {!proto.sys.Spotify} returns this
*/
proto.sys.Spotify.prototype.setZeroconf = function(value) {
return jspb.Message.setProto3BooleanField(this, 3, value);
};
/**
* optional uint32 volume = 4;
* @return {number}
*/
proto.sys.Spotify.prototype.getVolume = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};
/**
* @param {number} value
* @return {!proto.sys.Spotify} returns this
*/
proto.sys.Spotify.prototype.setVolume = function(value) {
return jspb.Message.setProto3IntField(this, 4, value);
};
goog.object.extend(exports, proto.sys);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,425 @@
// source: State.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var Network_pb = require('./Network_pb.js');
goog.object.extend(proto, Network_pb);
var Equalizer_pb = require('./Equalizer_pb.js');
goog.object.extend(proto, Equalizer_pb);
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
goog.exportSymbol('proto.sys.State', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.State = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.sys.State, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.State.displayName = 'proto.sys.State';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.State.prototype.toObject = function(opt_includeInstance) {
return proto.sys.State.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.State} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.State.toObject = function(includeInstance, msg) {
var f, obj = {
connectedSta: (f = msg.getConnectedSta()) && Network_pb.WifiSTAEntry.toObject(includeInstance, f),
lms: (f = msg.getLms()) && Network_pb.Server.toObject(includeInstance, f),
otaUrl: jspb.Message.getFieldWithDefault(msg, 3, ""),
cspotCredentials: jspb.Message.getFieldWithDefault(msg, 4, ""),
btSinkVolume: jspb.Message.getFieldWithDefault(msg, 5, 0),
equalizer: (f = msg.getEqualizer()) && Equalizer_pb.Equalizer.toObject(includeInstance, f),
target: jspb.Message.getFieldWithDefault(msg, 7, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.State}
*/
proto.sys.State.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.State;
return proto.sys.State.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.State} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.State}
*/
proto.sys.State.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new Network_pb.WifiSTAEntry;
reader.readMessage(value,Network_pb.WifiSTAEntry.deserializeBinaryFromReader);
msg.setConnectedSta(value);
break;
case 2:
var value = new Network_pb.Server;
reader.readMessage(value,Network_pb.Server.deserializeBinaryFromReader);
msg.setLms(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setOtaUrl(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setCspotCredentials(value);
break;
case 5:
var value = /** @type {number} */ (reader.readInt32());
msg.setBtSinkVolume(value);
break;
case 6:
var value = new Equalizer_pb.Equalizer;
reader.readMessage(value,Equalizer_pb.Equalizer.deserializeBinaryFromReader);
msg.setEqualizer(value);
break;
case 7:
var value = /** @type {string} */ (reader.readString());
msg.setTarget(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.State.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.State.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.State} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.State.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getConnectedSta();
if (f != null) {
writer.writeMessage(
1,
f,
Network_pb.WifiSTAEntry.serializeBinaryToWriter
);
}
f = message.getLms();
if (f != null) {
writer.writeMessage(
2,
f,
Network_pb.Server.serializeBinaryToWriter
);
}
f = message.getOtaUrl();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
f = message.getCspotCredentials();
if (f.length > 0) {
writer.writeString(
4,
f
);
}
f = message.getBtSinkVolume();
if (f !== 0) {
writer.writeInt32(
5,
f
);
}
f = message.getEqualizer();
if (f != null) {
writer.writeMessage(
6,
f,
Equalizer_pb.Equalizer.serializeBinaryToWriter
);
}
f = message.getTarget();
if (f.length > 0) {
writer.writeString(
7,
f
);
}
};
/**
* optional WifiSTAEntry connected_sta = 1;
* @return {?proto.sys.WifiSTAEntry}
*/
proto.sys.State.prototype.getConnectedSta = function() {
return /** @type{?proto.sys.WifiSTAEntry} */ (
jspb.Message.getWrapperField(this, Network_pb.WifiSTAEntry, 1));
};
/**
* @param {?proto.sys.WifiSTAEntry|undefined} value
* @return {!proto.sys.State} returns this
*/
proto.sys.State.prototype.setConnectedSta = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.State} returns this
*/
proto.sys.State.prototype.clearConnectedSta = function() {
return this.setConnectedSta(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.State.prototype.hasConnectedSta = function() {
return jspb.Message.getField(this, 1) != null;
};
/**
* optional Server lms = 2;
* @return {?proto.sys.Server}
*/
proto.sys.State.prototype.getLms = function() {
return /** @type{?proto.sys.Server} */ (
jspb.Message.getWrapperField(this, Network_pb.Server, 2));
};
/**
* @param {?proto.sys.Server|undefined} value
* @return {!proto.sys.State} returns this
*/
proto.sys.State.prototype.setLms = function(value) {
return jspb.Message.setWrapperField(this, 2, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.State} returns this
*/
proto.sys.State.prototype.clearLms = function() {
return this.setLms(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.State.prototype.hasLms = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* optional string ota_url = 3;
* @return {string}
*/
proto.sys.State.prototype.getOtaUrl = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* @param {string} value
* @return {!proto.sys.State} returns this
*/
proto.sys.State.prototype.setOtaUrl = function(value) {
return jspb.Message.setProto3StringField(this, 3, value);
};
/**
* optional string cspot_credentials = 4;
* @return {string}
*/
proto.sys.State.prototype.getCspotCredentials = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};
/**
* @param {string} value
* @return {!proto.sys.State} returns this
*/
proto.sys.State.prototype.setCspotCredentials = function(value) {
return jspb.Message.setProto3StringField(this, 4, value);
};
/**
* optional int32 bt_sink_volume = 5;
* @return {number}
*/
proto.sys.State.prototype.getBtSinkVolume = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0));
};
/**
* @param {number} value
* @return {!proto.sys.State} returns this
*/
proto.sys.State.prototype.setBtSinkVolume = function(value) {
return jspb.Message.setProto3IntField(this, 5, value);
};
/**
* optional Equalizer equalizer = 6;
* @return {?proto.sys.Equalizer}
*/
proto.sys.State.prototype.getEqualizer = function() {
return /** @type{?proto.sys.Equalizer} */ (
jspb.Message.getWrapperField(this, Equalizer_pb.Equalizer, 6));
};
/**
* @param {?proto.sys.Equalizer|undefined} value
* @return {!proto.sys.State} returns this
*/
proto.sys.State.prototype.setEqualizer = function(value) {
return jspb.Message.setWrapperField(this, 6, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.State} returns this
*/
proto.sys.State.prototype.clearEqualizer = function() {
return this.setEqualizer(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.State.prototype.hasEqualizer = function() {
return jspb.Message.getField(this, 6) != null;
};
/**
* optional string target = 7;
* @return {string}
*/
proto.sys.State.prototype.getTarget = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, ""));
};
/**
* @param {string} value
* @return {!proto.sys.State} returns this
*/
proto.sys.State.prototype.setTarget = function(value) {
return jspb.Message.setProto3StringField(this, 7, value);
};
goog.object.extend(exports, proto.sys);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,445 @@
// source: configuration.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var Services_pb = require('./Services_pb.js');
goog.object.extend(proto, Services_pb);
var GPIO_pb = require('./GPIO_pb.js');
goog.object.extend(proto, GPIO_pb);
var Devices_pb = require('./Devices_pb.js');
goog.object.extend(proto, Devices_pb);
var Names_pb = require('./Names_pb.js');
goog.object.extend(proto, Names_pb);
var Network_pb = require('./Network_pb.js');
goog.object.extend(proto, Network_pb);
var customoptions_pb = require('./customoptions_pb.js');
goog.object.extend(proto, customoptions_pb);
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
goog.exportSymbol('proto.sys.Config', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.sys.Config = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.sys.Config, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.sys.Config.displayName = 'proto.sys.Config';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.sys.Config.prototype.toObject = function(opt_includeInstance) {
return proto.sys.Config.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.sys.Config} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Config.toObject = function(includeInstance, msg) {
var f, obj = {
gpios: (f = msg.getGpios()) && GPIO_pb.Gpios.toObject(includeInstance, f),
dev: (f = msg.getDev()) && Devices_pb.Dev.toObject(includeInstance, f),
services: (f = msg.getServices()) && Services_pb.Services.toObject(includeInstance, f),
names: (f = msg.getNames()) && Names_pb.Names.toObject(includeInstance, f),
target: jspb.Message.getFieldWithDefault(msg, 5, ""),
net: (f = msg.getNet()) && Network_pb.NetworkConfig.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.sys.Config}
*/
proto.sys.Config.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.sys.Config;
return proto.sys.Config.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.sys.Config} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.sys.Config}
*/
proto.sys.Config.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new GPIO_pb.Gpios;
reader.readMessage(value,GPIO_pb.Gpios.deserializeBinaryFromReader);
msg.setGpios(value);
break;
case 2:
var value = new Devices_pb.Dev;
reader.readMessage(value,Devices_pb.Dev.deserializeBinaryFromReader);
msg.setDev(value);
break;
case 3:
var value = new Services_pb.Services;
reader.readMessage(value,Services_pb.Services.deserializeBinaryFromReader);
msg.setServices(value);
break;
case 4:
var value = new Names_pb.Names;
reader.readMessage(value,Names_pb.Names.deserializeBinaryFromReader);
msg.setNames(value);
break;
case 5:
var value = /** @type {string} */ (reader.readString());
msg.setTarget(value);
break;
case 6:
var value = new Network_pb.NetworkConfig;
reader.readMessage(value,Network_pb.NetworkConfig.deserializeBinaryFromReader);
msg.setNet(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.sys.Config.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.sys.Config.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.sys.Config} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.sys.Config.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getGpios();
if (f != null) {
writer.writeMessage(
1,
f,
GPIO_pb.Gpios.serializeBinaryToWriter
);
}
f = message.getDev();
if (f != null) {
writer.writeMessage(
2,
f,
Devices_pb.Dev.serializeBinaryToWriter
);
}
f = message.getServices();
if (f != null) {
writer.writeMessage(
3,
f,
Services_pb.Services.serializeBinaryToWriter
);
}
f = message.getNames();
if (f != null) {
writer.writeMessage(
4,
f,
Names_pb.Names.serializeBinaryToWriter
);
}
f = message.getTarget();
if (f.length > 0) {
writer.writeString(
5,
f
);
}
f = message.getNet();
if (f != null) {
writer.writeMessage(
6,
f,
Network_pb.NetworkConfig.serializeBinaryToWriter
);
}
};
/**
* optional Gpios gpios = 1;
* @return {?proto.sys.Gpios}
*/
proto.sys.Config.prototype.getGpios = function() {
return /** @type{?proto.sys.Gpios} */ (
jspb.Message.getWrapperField(this, GPIO_pb.Gpios, 1));
};
/**
* @param {?proto.sys.Gpios|undefined} value
* @return {!proto.sys.Config} returns this
*/
proto.sys.Config.prototype.setGpios = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.Config} returns this
*/
proto.sys.Config.prototype.clearGpios = function() {
return this.setGpios(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.Config.prototype.hasGpios = function() {
return jspb.Message.getField(this, 1) != null;
};
/**
* optional Dev dev = 2;
* @return {?proto.sys.Dev}
*/
proto.sys.Config.prototype.getDev = function() {
return /** @type{?proto.sys.Dev} */ (
jspb.Message.getWrapperField(this, Devices_pb.Dev, 2));
};
/**
* @param {?proto.sys.Dev|undefined} value
* @return {!proto.sys.Config} returns this
*/
proto.sys.Config.prototype.setDev = function(value) {
return jspb.Message.setWrapperField(this, 2, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.Config} returns this
*/
proto.sys.Config.prototype.clearDev = function() {
return this.setDev(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.Config.prototype.hasDev = function() {
return jspb.Message.getField(this, 2) != null;
};
/**
* optional Services services = 3;
* @return {?proto.sys.Services}
*/
proto.sys.Config.prototype.getServices = function() {
return /** @type{?proto.sys.Services} */ (
jspb.Message.getWrapperField(this, Services_pb.Services, 3));
};
/**
* @param {?proto.sys.Services|undefined} value
* @return {!proto.sys.Config} returns this
*/
proto.sys.Config.prototype.setServices = function(value) {
return jspb.Message.setWrapperField(this, 3, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.Config} returns this
*/
proto.sys.Config.prototype.clearServices = function() {
return this.setServices(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.Config.prototype.hasServices = function() {
return jspb.Message.getField(this, 3) != null;
};
/**
* optional Names names = 4;
* @return {?proto.sys.Names}
*/
proto.sys.Config.prototype.getNames = function() {
return /** @type{?proto.sys.Names} */ (
jspb.Message.getWrapperField(this, Names_pb.Names, 4));
};
/**
* @param {?proto.sys.Names|undefined} value
* @return {!proto.sys.Config} returns this
*/
proto.sys.Config.prototype.setNames = function(value) {
return jspb.Message.setWrapperField(this, 4, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.Config} returns this
*/
proto.sys.Config.prototype.clearNames = function() {
return this.setNames(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.Config.prototype.hasNames = function() {
return jspb.Message.getField(this, 4) != null;
};
/**
* optional string target = 5;
* @return {string}
*/
proto.sys.Config.prototype.getTarget = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
};
/**
* @param {string} value
* @return {!proto.sys.Config} returns this
*/
proto.sys.Config.prototype.setTarget = function(value) {
return jspb.Message.setProto3StringField(this, 5, value);
};
/**
* optional NetworkConfig net = 6;
* @return {?proto.sys.NetworkConfig}
*/
proto.sys.Config.prototype.getNet = function() {
return /** @type{?proto.sys.NetworkConfig} */ (
jspb.Message.getWrapperField(this, Network_pb.NetworkConfig, 6));
};
/**
* @param {?proto.sys.NetworkConfig|undefined} value
* @return {!proto.sys.Config} returns this
*/
proto.sys.Config.prototype.setNet = function(value) {
return jspb.Message.setWrapperField(this, 6, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.sys.Config} returns this
*/
proto.sys.Config.prototype.clearNet = function() {
return this.setNet(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.sys.Config.prototype.hasNet = function() {
return jspb.Message.getField(this, 6) != null;
};
goog.object.extend(exports, proto.sys);

View File

@@ -0,0 +1,986 @@
// source: customoptions.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var google_protobuf_descriptor_pb = require('google-protobuf/google/protobuf/descriptor_pb.js');
goog.object.extend(proto, google_protobuf_descriptor_pb);
var nanopb_pb = require('./nanopb_pb.js');
goog.object.extend(proto, nanopb_pb);
goog.exportSymbol('proto.CustomOptions', null, global);
goog.exportSymbol('proto.CustomOptions.DefaultValueCase', null, global);
goog.exportSymbol('proto.custEnum', null, global);
goog.exportSymbol('proto.custField', null, global);
goog.exportSymbol('proto.custFile', null, global);
goog.exportSymbol('proto.custMsg', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.CustomOptions = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, 500, null, proto.CustomOptions.oneofGroups_);
};
goog.inherits(proto.CustomOptions, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.CustomOptions.displayName = 'proto.CustomOptions';
}
/**
* Oneof group definitions for this message. Each group defines the field
* numbers belonging to that group. When of these fields' value is set, all
* other fields in the group are cleared. During deserialization, if multiple
* fields are encountered for a group, only the last value seen will be kept.
* @private {!Array<!Array<number>>}
* @const
*/
proto.CustomOptions.oneofGroups_ = [[50050,50051,50052,50053,50054,50055,50056,50057,50058,50059,50060]];
/**
* @enum {number}
*/
proto.CustomOptions.DefaultValueCase = {
DEFAULT_VALUE_NOT_SET: 0,
V_STRING: 50050,
V_UINT32: 50051,
V_INT32: 50052,
V_UINT64: 50053,
V_INT64: 50054,
V_DOUBLE: 50055,
V_FLOAT: 50056,
V_BOOL: 50057,
V_ENUM: 50058,
V_BYTES: 50059,
V_MSG: 50060
};
/**
* @return {proto.CustomOptions.DefaultValueCase}
*/
proto.CustomOptions.prototype.getDefaultValueCase = function() {
return /** @type {proto.CustomOptions.DefaultValueCase} */(jspb.Message.computeOneofCase(this, proto.CustomOptions.oneofGroups_[0]));
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.CustomOptions.prototype.toObject = function(opt_includeInstance) {
return proto.CustomOptions.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.CustomOptions} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.CustomOptions.toObject = function(includeInstance, msg) {
var f, obj = {
initFromMac: jspb.Message.getBooleanFieldWithDefault(msg, 50001, false),
constPrefix: jspb.Message.getFieldWithDefault(msg, 50002, ""),
readOnly: jspb.Message.getBooleanFieldWithDefault(msg, 50003, false),
vString: jspb.Message.getFieldWithDefault(msg, 50050, ""),
vUint32: jspb.Message.getFieldWithDefault(msg, 50051, 0),
vInt32: jspb.Message.getFieldWithDefault(msg, 50052, 0),
vUint64: jspb.Message.getFieldWithDefault(msg, 50053, 0),
vInt64: jspb.Message.getFieldWithDefault(msg, 50054, 0),
vDouble: jspb.Message.getFloatingPointFieldWithDefault(msg, 50055, 0.0),
vFloat: jspb.Message.getFloatingPointFieldWithDefault(msg, 50056, 0.0),
vBool: jspb.Message.getBooleanFieldWithDefault(msg, 50057, false),
vEnum: jspb.Message.getFieldWithDefault(msg, 50058, ""),
vBytes: msg.getVBytes_asB64(),
vMsg: msg.getVMsg_asB64(),
globalName: jspb.Message.getFieldWithDefault(msg, 50005, "")
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.CustomOptions}
*/
proto.CustomOptions.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.CustomOptions;
return proto.CustomOptions.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.CustomOptions} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.CustomOptions}
*/
proto.CustomOptions.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 50001:
var value = /** @type {boolean} */ (reader.readBool());
msg.setInitFromMac(value);
break;
case 50002:
var value = /** @type {string} */ (reader.readString());
msg.setConstPrefix(value);
break;
case 50003:
var value = /** @type {boolean} */ (reader.readBool());
msg.setReadOnly(value);
break;
case 50050:
var value = /** @type {string} */ (reader.readString());
msg.setVString(value);
break;
case 50051:
var value = /** @type {number} */ (reader.readUint32());
msg.setVUint32(value);
break;
case 50052:
var value = /** @type {number} */ (reader.readInt32());
msg.setVInt32(value);
break;
case 50053:
var value = /** @type {number} */ (reader.readUint64());
msg.setVUint64(value);
break;
case 50054:
var value = /** @type {number} */ (reader.readInt64());
msg.setVInt64(value);
break;
case 50055:
var value = /** @type {number} */ (reader.readDouble());
msg.setVDouble(value);
break;
case 50056:
var value = /** @type {number} */ (reader.readFloat());
msg.setVFloat(value);
break;
case 50057:
var value = /** @type {boolean} */ (reader.readBool());
msg.setVBool(value);
break;
case 50058:
var value = /** @type {string} */ (reader.readString());
msg.setVEnum(value);
break;
case 50059:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setVBytes(value);
break;
case 50060:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setVMsg(value);
break;
case 50005:
var value = /** @type {string} */ (reader.readString());
msg.setGlobalName(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.CustomOptions.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.CustomOptions.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.CustomOptions} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.CustomOptions.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getInitFromMac();
if (f) {
writer.writeBool(
50001,
f
);
}
f = message.getConstPrefix();
if (f.length > 0) {
writer.writeString(
50002,
f
);
}
f = message.getReadOnly();
if (f) {
writer.writeBool(
50003,
f
);
}
f = /** @type {string} */ (jspb.Message.getField(message, 50050));
if (f != null) {
writer.writeString(
50050,
f
);
}
f = /** @type {number} */ (jspb.Message.getField(message, 50051));
if (f != null) {
writer.writeUint32(
50051,
f
);
}
f = /** @type {number} */ (jspb.Message.getField(message, 50052));
if (f != null) {
writer.writeInt32(
50052,
f
);
}
f = /** @type {number} */ (jspb.Message.getField(message, 50053));
if (f != null) {
writer.writeUint64(
50053,
f
);
}
f = /** @type {number} */ (jspb.Message.getField(message, 50054));
if (f != null) {
writer.writeInt64(
50054,
f
);
}
f = /** @type {number} */ (jspb.Message.getField(message, 50055));
if (f != null) {
writer.writeDouble(
50055,
f
);
}
f = /** @type {number} */ (jspb.Message.getField(message, 50056));
if (f != null) {
writer.writeFloat(
50056,
f
);
}
f = /** @type {boolean} */ (jspb.Message.getField(message, 50057));
if (f != null) {
writer.writeBool(
50057,
f
);
}
f = /** @type {string} */ (jspb.Message.getField(message, 50058));
if (f != null) {
writer.writeString(
50058,
f
);
}
f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 50059));
if (f != null) {
writer.writeBytes(
50059,
f
);
}
f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 50060));
if (f != null) {
writer.writeBytes(
50060,
f
);
}
f = message.getGlobalName();
if (f.length > 0) {
writer.writeString(
50005,
f
);
}
};
/**
* optional bool init_from_mac = 50001;
* @return {boolean}
*/
proto.CustomOptions.prototype.getInitFromMac = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 50001, false));
};
/**
* @param {boolean} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setInitFromMac = function(value) {
return jspb.Message.setProto3BooleanField(this, 50001, value);
};
/**
* optional string const_prefix = 50002;
* @return {string}
*/
proto.CustomOptions.prototype.getConstPrefix = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 50002, ""));
};
/**
* @param {string} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setConstPrefix = function(value) {
return jspb.Message.setProto3StringField(this, 50002, value);
};
/**
* optional bool read_only = 50003;
* @return {boolean}
*/
proto.CustomOptions.prototype.getReadOnly = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 50003, false));
};
/**
* @param {boolean} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setReadOnly = function(value) {
return jspb.Message.setProto3BooleanField(this, 50003, value);
};
/**
* optional string v_string = 50050;
* @return {string}
*/
proto.CustomOptions.prototype.getVString = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 50050, ""));
};
/**
* @param {string} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setVString = function(value) {
return jspb.Message.setOneofField(this, 50050, proto.CustomOptions.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.clearVString = function() {
return jspb.Message.setOneofField(this, 50050, proto.CustomOptions.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.CustomOptions.prototype.hasVString = function() {
return jspb.Message.getField(this, 50050) != null;
};
/**
* optional uint32 v_uint32 = 50051;
* @return {number}
*/
proto.CustomOptions.prototype.getVUint32 = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 50051, 0));
};
/**
* @param {number} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setVUint32 = function(value) {
return jspb.Message.setOneofField(this, 50051, proto.CustomOptions.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.clearVUint32 = function() {
return jspb.Message.setOneofField(this, 50051, proto.CustomOptions.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.CustomOptions.prototype.hasVUint32 = function() {
return jspb.Message.getField(this, 50051) != null;
};
/**
* optional int32 v_int32 = 50052;
* @return {number}
*/
proto.CustomOptions.prototype.getVInt32 = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 50052, 0));
};
/**
* @param {number} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setVInt32 = function(value) {
return jspb.Message.setOneofField(this, 50052, proto.CustomOptions.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.clearVInt32 = function() {
return jspb.Message.setOneofField(this, 50052, proto.CustomOptions.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.CustomOptions.prototype.hasVInt32 = function() {
return jspb.Message.getField(this, 50052) != null;
};
/**
* optional uint64 v_uint64 = 50053;
* @return {number}
*/
proto.CustomOptions.prototype.getVUint64 = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 50053, 0));
};
/**
* @param {number} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setVUint64 = function(value) {
return jspb.Message.setOneofField(this, 50053, proto.CustomOptions.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.clearVUint64 = function() {
return jspb.Message.setOneofField(this, 50053, proto.CustomOptions.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.CustomOptions.prototype.hasVUint64 = function() {
return jspb.Message.getField(this, 50053) != null;
};
/**
* optional int64 v_int64 = 50054;
* @return {number}
*/
proto.CustomOptions.prototype.getVInt64 = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 50054, 0));
};
/**
* @param {number} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setVInt64 = function(value) {
return jspb.Message.setOneofField(this, 50054, proto.CustomOptions.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.clearVInt64 = function() {
return jspb.Message.setOneofField(this, 50054, proto.CustomOptions.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.CustomOptions.prototype.hasVInt64 = function() {
return jspb.Message.getField(this, 50054) != null;
};
/**
* optional double v_double = 50055;
* @return {number}
*/
proto.CustomOptions.prototype.getVDouble = function() {
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 50055, 0.0));
};
/**
* @param {number} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setVDouble = function(value) {
return jspb.Message.setOneofField(this, 50055, proto.CustomOptions.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.clearVDouble = function() {
return jspb.Message.setOneofField(this, 50055, proto.CustomOptions.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.CustomOptions.prototype.hasVDouble = function() {
return jspb.Message.getField(this, 50055) != null;
};
/**
* optional float v_float = 50056;
* @return {number}
*/
proto.CustomOptions.prototype.getVFloat = function() {
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 50056, 0.0));
};
/**
* @param {number} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setVFloat = function(value) {
return jspb.Message.setOneofField(this, 50056, proto.CustomOptions.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.clearVFloat = function() {
return jspb.Message.setOneofField(this, 50056, proto.CustomOptions.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.CustomOptions.prototype.hasVFloat = function() {
return jspb.Message.getField(this, 50056) != null;
};
/**
* optional bool v_bool = 50057;
* @return {boolean}
*/
proto.CustomOptions.prototype.getVBool = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 50057, false));
};
/**
* @param {boolean} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setVBool = function(value) {
return jspb.Message.setOneofField(this, 50057, proto.CustomOptions.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.clearVBool = function() {
return jspb.Message.setOneofField(this, 50057, proto.CustomOptions.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.CustomOptions.prototype.hasVBool = function() {
return jspb.Message.getField(this, 50057) != null;
};
/**
* optional string v_enum = 50058;
* @return {string}
*/
proto.CustomOptions.prototype.getVEnum = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 50058, ""));
};
/**
* @param {string} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setVEnum = function(value) {
return jspb.Message.setOneofField(this, 50058, proto.CustomOptions.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.clearVEnum = function() {
return jspb.Message.setOneofField(this, 50058, proto.CustomOptions.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.CustomOptions.prototype.hasVEnum = function() {
return jspb.Message.getField(this, 50058) != null;
};
/**
* optional bytes v_bytes = 50059;
* @return {!(string|Uint8Array)}
*/
proto.CustomOptions.prototype.getVBytes = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 50059, ""));
};
/**
* optional bytes v_bytes = 50059;
* This is a type-conversion wrapper around `getVBytes()`
* @return {string}
*/
proto.CustomOptions.prototype.getVBytes_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getVBytes()));
};
/**
* optional bytes v_bytes = 50059;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getVBytes()`
* @return {!Uint8Array}
*/
proto.CustomOptions.prototype.getVBytes_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getVBytes()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setVBytes = function(value) {
return jspb.Message.setOneofField(this, 50059, proto.CustomOptions.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.clearVBytes = function() {
return jspb.Message.setOneofField(this, 50059, proto.CustomOptions.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.CustomOptions.prototype.hasVBytes = function() {
return jspb.Message.getField(this, 50059) != null;
};
/**
* optional bytes v_msg = 50060;
* @return {!(string|Uint8Array)}
*/
proto.CustomOptions.prototype.getVMsg = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 50060, ""));
};
/**
* optional bytes v_msg = 50060;
* This is a type-conversion wrapper around `getVMsg()`
* @return {string}
*/
proto.CustomOptions.prototype.getVMsg_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getVMsg()));
};
/**
* optional bytes v_msg = 50060;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getVMsg()`
* @return {!Uint8Array}
*/
proto.CustomOptions.prototype.getVMsg_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getVMsg()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setVMsg = function(value) {
return jspb.Message.setOneofField(this, 50060, proto.CustomOptions.oneofGroups_[0], value);
};
/**
* Clears the field making it undefined.
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.clearVMsg = function() {
return jspb.Message.setOneofField(this, 50060, proto.CustomOptions.oneofGroups_[0], undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.CustomOptions.prototype.hasVMsg = function() {
return jspb.Message.getField(this, 50060) != null;
};
/**
* optional string global_name = 50005;
* @return {string}
*/
proto.CustomOptions.prototype.getGlobalName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 50005, ""));
};
/**
* @param {string} value
* @return {!proto.CustomOptions} returns this
*/
proto.CustomOptions.prototype.setGlobalName = function(value) {
return jspb.Message.setProto3StringField(this, 50005, value);
};
/**
* A tuple of {field number, class constructor} for the extension
* field named `custFile`.
* @type {!jspb.ExtensionFieldInfo<!proto.CustomOptions>}
*/
proto.custFile = new jspb.ExtensionFieldInfo(
2010,
{custFile: 0},
proto.CustomOptions,
/** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (
proto.CustomOptions.toObject),
0);
google_protobuf_descriptor_pb.FileOptions.extensionsBinary[2010] = new jspb.ExtensionFieldBinaryInfo(
proto.custFile,
jspb.BinaryReader.prototype.readMessage,
jspb.BinaryWriter.prototype.writeMessage,
proto.CustomOptions.serializeBinaryToWriter,
proto.CustomOptions.deserializeBinaryFromReader,
false);
// This registers the extension field with the extended class, so that
// toObject() will function correctly.
google_protobuf_descriptor_pb.FileOptions.extensions[2010] = proto.custFile;
/**
* A tuple of {field number, class constructor} for the extension
* field named `custMsg`.
* @type {!jspb.ExtensionFieldInfo<!proto.CustomOptions>}
*/
proto.custMsg = new jspb.ExtensionFieldInfo(
2010,
{custMsg: 0},
proto.CustomOptions,
/** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (
proto.CustomOptions.toObject),
0);
google_protobuf_descriptor_pb.MessageOptions.extensionsBinary[2010] = new jspb.ExtensionFieldBinaryInfo(
proto.custMsg,
jspb.BinaryReader.prototype.readMessage,
jspb.BinaryWriter.prototype.writeMessage,
proto.CustomOptions.serializeBinaryToWriter,
proto.CustomOptions.deserializeBinaryFromReader,
false);
// This registers the extension field with the extended class, so that
// toObject() will function correctly.
google_protobuf_descriptor_pb.MessageOptions.extensions[2010] = proto.custMsg;
/**
* A tuple of {field number, class constructor} for the extension
* field named `custEnum`.
* @type {!jspb.ExtensionFieldInfo<!proto.CustomOptions>}
*/
proto.custEnum = new jspb.ExtensionFieldInfo(
2010,
{custEnum: 0},
proto.CustomOptions,
/** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (
proto.CustomOptions.toObject),
0);
google_protobuf_descriptor_pb.EnumOptions.extensionsBinary[2010] = new jspb.ExtensionFieldBinaryInfo(
proto.custEnum,
jspb.BinaryReader.prototype.readMessage,
jspb.BinaryWriter.prototype.writeMessage,
proto.CustomOptions.serializeBinaryToWriter,
proto.CustomOptions.deserializeBinaryFromReader,
false);
// This registers the extension field with the extended class, so that
// toObject() will function correctly.
google_protobuf_descriptor_pb.EnumOptions.extensions[2010] = proto.custEnum;
/**
* A tuple of {field number, class constructor} for the extension
* field named `custField`.
* @type {!jspb.ExtensionFieldInfo<!proto.CustomOptions>}
*/
proto.custField = new jspb.ExtensionFieldInfo(
2010,
{custField: 0},
proto.CustomOptions,
/** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ (
proto.CustomOptions.toObject),
0);
google_protobuf_descriptor_pb.FieldOptions.extensionsBinary[2010] = new jspb.ExtensionFieldBinaryInfo(
proto.custField,
jspb.BinaryReader.prototype.readMessage,
jspb.BinaryWriter.prototype.writeMessage,
proto.CustomOptions.serializeBinaryToWriter,
proto.CustomOptions.deserializeBinaryFromReader,
false);
// This registers the extension field with the extended class, so that
// toObject() will function correctly.
google_protobuf_descriptor_pb.FieldOptions.extensions[2010] = proto.custField;
goog.object.extend(exports, proto);

View File

@@ -13,13 +13,13 @@
var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
var google_protobuf_descriptor_pb = require('google-protobuf/google/protobuf/descriptor_pb.js');
goog.object.extend(proto, google_protobuf_descriptor_pb);

View File

@@ -0,0 +1,49 @@
// serviceHandler.ts
const { Config } = require('./proto/configuration_pb');
const { proto } = require('./proto/DataRequest_pb');
function sendRequest(type: proto.sys.request.Type, action: proto.sys.request.Action, data: any, onSuccess: (response: any) => void, onError: (error: any) => void) {
let payload:proto.sys.request.Payload = new proto.sys.request.Payload();
payload.setType(type);
payload.setAction(action);
switch (type) {
case proto.sys.request.Type.CONFIG:
payload.setConfig(data);
break;
case proto.sys.request.Type.OTA:
payload.setUrl(data);
break;
default:
break;
}
let serializedPayload = payload.serializeBinary();
console.log(`Sending data: ${serializedPayload}`)
$.ajax({
url: '/data.bin',
method: 'POST',
contentType: 'application/octet-stream',
processData: false,
data: serializedPayload,
success: function(responseData) {
try {
// Deserialize response here or pass raw data to onSuccess
let response = proto.sys.request.Response.deserializeBinary(new Uint8Array(responseData));
onSuccess(response);
} catch (error) {
console.error('Error decoding protobuf message:', error);
onError(error);
}
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('Error in request:', textStatus, errorThrown);
onError(errorThrown);
}
}).fail(function (xhr, ajaxOptions, thrownError) {
handleExceptionResponse(xhr, ajaxOptions, thrownError);
});
}
export { sendRequest };

View File

@@ -0,0 +1,12 @@
function handleExceptionResponse(xhr: JQuery.jqXHR<any>
, _ajaxOptions: JQuery.Ajax.ErrorTextStatus, thrownError: string) {
console.log(xhr.status);
console.log(thrownError);
if (thrownError !== '') {
showLocalMessage(thrownError, 'MESSAGING_ERROR');
}
}