mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
Merge pull request #1632 from MichaelDvP/dev2
update to all dev changes
This commit is contained in:
13
.gitignore
vendored
13
.gitignore
vendored
@@ -2,7 +2,7 @@
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/extensions.json
|
||||
.vscode/launch.json
|
||||
# .vscode/settings.json
|
||||
.vscode/settings.json
|
||||
|
||||
# c++ compiling
|
||||
.clang_complete
|
||||
@@ -12,11 +12,11 @@ cppcheck.out.xml
|
||||
# platformio
|
||||
.pio
|
||||
pio_local.ini
|
||||
*_old
|
||||
|
||||
# OS specific
|
||||
.DS_Store
|
||||
*Thumbs.db
|
||||
emsesp
|
||||
|
||||
# web specfic
|
||||
build/
|
||||
@@ -38,12 +38,13 @@ stats.html
|
||||
!.yarn/versions
|
||||
yarn.lock
|
||||
interface/analyse.html
|
||||
interface/vite.config.ts.timestamp*
|
||||
|
||||
# scripts
|
||||
test.sh
|
||||
scripts/run.sh
|
||||
scripts/__pycache__
|
||||
/scripts/stackdmp.txt
|
||||
scripts/stackdmp.txt
|
||||
|
||||
# i18n generated files
|
||||
interface/src/i18n/i18n-react.tsx
|
||||
@@ -57,7 +58,5 @@ interface/src/i18n/i18n-util.async.ts
|
||||
sonar/
|
||||
bw-output/
|
||||
|
||||
# entity dump results
|
||||
# dump_entities.csv
|
||||
# dump_entities.xls*
|
||||
|
||||
# testing
|
||||
emsesp
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
## **IMPORTANT! BREAKING CHANGES**
|
||||
|
||||
- new device WATER shows dhw entities from MM100 and SM100 in dhw setting
|
||||
- The Wifi Tx Power setting in Network Settings will be reset to Auto
|
||||
|
||||
## Added
|
||||
|
||||
@@ -13,7 +14,7 @@
|
||||
- heatpump energy meters [#1463](https://github.com/emsesp/EMS-ESP32/issues/1463)
|
||||
- heatpump max power [#1475](https://github.com/emsesp/EMS-ESP32/issues/1475)
|
||||
- checkbox for MQTT-TLS enable [#1474](https://github.com/emsesp/EMS-ESP32/issues/1474)
|
||||
- added SK (Slovenian) language. Thanks @misa1515
|
||||
- added SK (Slovak) language. Thanks @misa1515
|
||||
- CPU info [#1497](https://github.com/emsesp/EMS-ESP32/pull/1497)
|
||||
- Show network hostname in Web UI under Network Status
|
||||
- Improved HA Discovery so each section (EMS device, Scheduler, Analog, Temperature, Custom, Shower) have their own section
|
||||
@@ -31,6 +32,9 @@
|
||||
- MQTT autodiscovery in Domoticz not working [#1360](https://github.com/emsesp/EMS-ESP32/issues/1528)
|
||||
- dhw comfort for new ems+, [#1495](https://github.com/emsesp/EMS-ESP32/issues/1495)
|
||||
- added writeable icon to Web's Custom Entity page for each entity shown in the table
|
||||
- Wifi Tx Power not adjusted [#1614](https://github.com/emsesp/EMS-ESP32/issues/1614)
|
||||
- MQTT discovery of custom entity doesn't consider type of data [#1587](https://github.com/emsesp/EMS-ESP32/issues/1587)
|
||||
- WiFi TxPower wasn't correctly used. Added an 'Auto' setting, which is the default.
|
||||
|
||||
## Changed
|
||||
|
||||
@@ -38,3 +42,6 @@
|
||||
- HA don't set entity_category to Diagnostic/Configuration for EMS entities [#1459](https://github.com/emsesp/EMS-ESP32/discussions/1459)
|
||||
- upgraded ArduinoJson to 7.0.0 #1538 and then 7.0.2
|
||||
- small changes to the API for analog and temperature sensors
|
||||
- Length of mqtt Broker adress [#1619](https://github.com/emsesp/EMS-ESP32/issues/1619)
|
||||
- C++ optimizations - see <https://github.com/emsesp/EMS-ESP32/pull/1615>
|
||||
- Send MQTT heartbeat immediately after connection [#1628](https://github.com/emsesp/EMS-ESP32/issues/1628)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, 0x9000, 0x5000,
|
||||
otadata, data, ota, , 0x2000,
|
||||
app0, app, ota_0, , 0x7F0000,
|
||||
app1, app, ota_1, , 0x7F0000,
|
||||
spiffs, data, spiffs, , 64K,
|
||||
nvs, data, nvs, 0x9000, 0x035000,
|
||||
otadata, data, ota, , 0x002000,
|
||||
app0, app, ota_0, , 0x6E0000,
|
||||
app1, app, ota_1, , 0x6E0000,
|
||||
spiffs, data, spiffs, , 0x200000,
|
||||
|
@@ -36,7 +36,6 @@ build_flags =
|
||||
-D FACTORY_MQTT_PORT=1883
|
||||
-D FACTORY_MQTT_USERNAME=\"\"
|
||||
-D FACTORY_MQTT_PASSWORD=\"\"
|
||||
-D FACTORY_MQTT_CLIENT_ID=\"ems-esp\"
|
||||
-D FACTORY_MQTT_KEEP_ALIVE=60
|
||||
-D FACTORY_MQTT_CLEAN_SESSION=false
|
||||
-D FACTORY_MQTT_MAX_TOPIC_LENGTH=128
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"airbnb/hooks",
|
||||
"airbnb-typescript",
|
||||
// "airbnb/hooks",
|
||||
// "airbnb-typescript",
|
||||
"plugin:react/recommended",
|
||||
"plugin:react/jsx-runtime",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4,4 +4,4 @@ enableGlobalCache: false
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
yarnPath: .yarn/releases/yarn-4.0.2.cjs
|
||||
yarnPath: .yarn/releases/yarn-4.1.0.cjs
|
||||
|
||||
@@ -26,14 +26,14 @@
|
||||
"@babel/core": "^7.23.9",
|
||||
"@emotion/react": "^11.11.3",
|
||||
"@emotion/styled": "^11.11.0",
|
||||
"@mui/icons-material": "^5.15.6",
|
||||
"@mui/material": "^5.15.6",
|
||||
"@mui/icons-material": "^5.15.10",
|
||||
"@mui/material": "^5.15.10",
|
||||
"@table-library/react-table-library": "4.1.7",
|
||||
"@types/imagemin": "^8.0.5",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^20.11.10",
|
||||
"@types/react": "^18.2.48",
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"@types/node": "^20.11.20",
|
||||
"@types/react": "^18.2.57",
|
||||
"@types/react-dom": "^18.2.19",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"alova": "^2.17.0",
|
||||
"async-validator": "^4.2.5",
|
||||
@@ -45,7 +45,7 @@
|
||||
"react-dom": "latest",
|
||||
"react-dropzone": "^14.2.3",
|
||||
"react-icons": "^5.0.1",
|
||||
"react-router-dom": "^6.21.3",
|
||||
"react-router-dom": "^6.22.1",
|
||||
"react-toastify": "^10.0.4",
|
||||
"sockette": "^2.0.6",
|
||||
"typesafe-i18n": "^5.26.2",
|
||||
@@ -54,12 +54,10 @@
|
||||
"devDependencies": {
|
||||
"@preact/compat": "^17.1.2",
|
||||
"@preact/preset-vite": "^2.8.1",
|
||||
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
||||
"@typescript-eslint/parser": "^6.20.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
||||
"@typescript-eslint/parser": "^7.0.2",
|
||||
"concurrently": "^8.2.2",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^17.1.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
"eslint-plugin-autofix": "^1.1.0",
|
||||
@@ -68,11 +66,11 @@
|
||||
"eslint-plugin-prettier": "alpha",
|
||||
"eslint-plugin-react": "^7.33.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"preact": "^10.19.3",
|
||||
"prettier": "^3.2.4",
|
||||
"preact": "^10.19.6",
|
||||
"prettier": "^3.2.5",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"terser": "^5.27.0",
|
||||
"vite": "^5.0.12",
|
||||
"terser": "^5.27.2",
|
||||
"vite": "^5.1.4",
|
||||
"vite-plugin-imagemin": "^0.6.1",
|
||||
"vite-tsconfig-paths": "^4.3.1"
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@ import { readdirSync, existsSync, unlinkSync, readFileSync, createWriteStream }
|
||||
import { resolve, relative, sep } from 'path';
|
||||
import zlib from 'zlib';
|
||||
import mime from 'mime-types';
|
||||
import crypto from 'crypto';
|
||||
|
||||
const ARDUINO_INCLUDES = '#include <Arduino.h>\n\n';
|
||||
const INDENT = ' ';
|
||||
@@ -11,14 +12,17 @@ const bytesPerLine = 20;
|
||||
var totalSize = 0;
|
||||
|
||||
const generateWWWClass = () =>
|
||||
`typedef std::function<void(const String& uri, const String& contentType, const uint8_t * content, size_t len)> RouteRegistrationHandler;
|
||||
`typedef std::function<void(const String& uri, const String& contentType, const uint8_t * content, size_t len, const String& hash)> RouteRegistrationHandler;
|
||||
// Total size is ${totalSize} bytes
|
||||
|
||||
class WWWData {
|
||||
${indent}public:
|
||||
${indent.repeat(2)}static void registerRoutes(RouteRegistrationHandler handler) {
|
||||
${fileInfo
|
||||
.map((file) => `${indent.repeat(3)}handler("${file.uri}", "${file.mimeType}", ${file.variable}, ${file.size});`)
|
||||
.map(
|
||||
(file) =>
|
||||
`${indent.repeat(3)}handler("${file.uri}", "${file.mimeType}", ${file.variable}, ${file.size}, "${file.hash}");`
|
||||
)
|
||||
.join('\n')}
|
||||
${indent.repeat(2)}}
|
||||
};
|
||||
@@ -50,6 +54,12 @@ const writeFile = (relativeFilePath, buffer) => {
|
||||
writeStream.write('const uint8_t ' + variable + '[] = {');
|
||||
// const zipBuffer = zlib.brotliCompressSync(buffer, { quality: 1 });
|
||||
const zipBuffer = zlib.gzipSync(buffer, { level: 9 });
|
||||
|
||||
// create sha
|
||||
const hashSum = crypto.createHash('sha256');
|
||||
hashSum.update(zipBuffer);
|
||||
const hash = hashSum.digest('hex');
|
||||
|
||||
zipBuffer.forEach((b) => {
|
||||
if (!(size % bytesPerLine)) {
|
||||
writeStream.write('\n');
|
||||
@@ -58,15 +68,19 @@ const writeFile = (relativeFilePath, buffer) => {
|
||||
writeStream.write('0x' + ('00' + b.toString(16).toUpperCase()).slice(-2) + ',');
|
||||
size++;
|
||||
});
|
||||
|
||||
if (size % bytesPerLine) {
|
||||
writeStream.write('\n');
|
||||
}
|
||||
|
||||
writeStream.write('};\n\n');
|
||||
|
||||
fileInfo.push({
|
||||
uri: '/' + relativeFilePath.replace(sep, '/'),
|
||||
mimeType,
|
||||
variable,
|
||||
size
|
||||
size,
|
||||
hash
|
||||
});
|
||||
|
||||
// console.log(relativeFilePath + ' (size ' + size + ' bytes)');
|
||||
|
||||
@@ -4,7 +4,6 @@ import { ToastContainer, Slide } from 'react-toastify';
|
||||
import 'react-toastify/dist/ReactToastify.min.css';
|
||||
|
||||
import { localStorageDetector } from 'typesafe-i18n/detectors';
|
||||
import { FeaturesLoader } from './contexts/features';
|
||||
import type { FC } from 'react';
|
||||
import AppRouting from 'AppRouting';
|
||||
import CustomTheme from 'CustomTheme';
|
||||
@@ -27,9 +26,7 @@ const App: FC = () => {
|
||||
return (
|
||||
<TypesafeI18n locale={detectedLocale}>
|
||||
<CustomTheme>
|
||||
<FeaturesLoader>
|
||||
<AppRouting />
|
||||
</FeaturesLoader>
|
||||
<AppRouting />
|
||||
<ToastContainer
|
||||
position="bottom-left"
|
||||
autoClose={3000}
|
||||
|
||||
@@ -3,7 +3,6 @@ import { Box, Paper, Typography, MenuItem, TextField, Button } from '@mui/materi
|
||||
import { useRequest } from 'alova';
|
||||
import { useContext, useState } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
import { FeaturesContext } from './contexts/features';
|
||||
import type { ValidateFieldsError } from 'async-validator';
|
||||
|
||||
import type { Locales } from 'i18n/i18n-types';
|
||||
@@ -35,8 +34,6 @@ const SignIn: FC = () => {
|
||||
|
||||
const { LL, setLocale, locale } = useContext(I18nContext);
|
||||
|
||||
const { features } = useContext(FeaturesContext);
|
||||
|
||||
const [signInRequest, setSignInRequest] = useState<SignInRequest>({
|
||||
username: '',
|
||||
password: ''
|
||||
@@ -112,7 +109,6 @@ const SignIn: FC = () => {
|
||||
})}
|
||||
>
|
||||
<Typography variant="h4">{PROJECT_NAME}</Typography>
|
||||
<Typography variant="subtitle2">{features.version}</Typography>
|
||||
|
||||
<TextField name="locale" variant="outlined" value={locale} onChange={onLocaleSelected} size="small" select>
|
||||
<MenuItem key="de" value="de">
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import { alovaInstance } from './endpoints';
|
||||
|
||||
import type { Features } from 'types';
|
||||
|
||||
export const readFeatures = () => alovaInstance.Get<Features>('/rest/features');
|
||||
@@ -1,25 +0,0 @@
|
||||
import { useRequest } from 'alova';
|
||||
|
||||
import { FeaturesContext } from '.';
|
||||
import type { FC } from 'react';
|
||||
|
||||
import type { RequiredChildrenProps } from 'utils';
|
||||
import * as FeaturesApi from 'api/features';
|
||||
|
||||
const FeaturesLoader: FC<RequiredChildrenProps> = (props) => {
|
||||
const { data: features } = useRequest(FeaturesApi.readFeatures);
|
||||
|
||||
if (features) {
|
||||
return (
|
||||
<FeaturesContext.Provider
|
||||
value={{
|
||||
features
|
||||
}}
|
||||
>
|
||||
{props.children}
|
||||
</FeaturesContext.Provider>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default FeaturesLoader;
|
||||
@@ -1,10 +0,0 @@
|
||||
import { createContext } from 'react';
|
||||
|
||||
import type { Features } from 'types';
|
||||
|
||||
export interface FeaturesContextValue {
|
||||
features: Features;
|
||||
}
|
||||
|
||||
const FeaturesContextDefaultValue = {} as FeaturesContextValue;
|
||||
export const FeaturesContext = createContext(FeaturesContextDefaultValue);
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './context';
|
||||
export { default as FeaturesLoader } from './FeaturesLoader';
|
||||
@@ -72,6 +72,7 @@ const MqttSettingsForm: FC = () => {
|
||||
name="host"
|
||||
label={LL.ADDRESS_OF(LL.BROKER())}
|
||||
fullWidth
|
||||
multiline
|
||||
variant="outlined"
|
||||
value={data.host}
|
||||
onChange={updateFormValue}
|
||||
|
||||
@@ -15,8 +15,8 @@ import {
|
||||
ListItemSecondaryAction,
|
||||
ListItemText,
|
||||
Typography,
|
||||
InputAdornment,
|
||||
TextField
|
||||
TextField,
|
||||
MenuItem
|
||||
} from '@mui/material';
|
||||
// eslint-disable-next-line import/named
|
||||
import { updateState, useRequest } from 'alova';
|
||||
@@ -43,7 +43,7 @@ import {
|
||||
} from 'components';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
|
||||
import { numberValue, updateValueDirty, useRest } from 'utils';
|
||||
import { updateValueDirty, useRest } from 'utils';
|
||||
|
||||
import { validate } from 'validators';
|
||||
import { createNetworkSettingsValidator } from 'validators/network';
|
||||
@@ -88,7 +88,7 @@ const WiFiSettingsForm: FC = () => {
|
||||
static_ip_config: false,
|
||||
enableIPv6: false,
|
||||
bandwidth20: false,
|
||||
tx_power: 20,
|
||||
tx_power: 0,
|
||||
nosleep: false,
|
||||
enableMDNS: true,
|
||||
enableCORS: false,
|
||||
@@ -196,20 +196,27 @@ const WiFiSettingsForm: FC = () => {
|
||||
margin="normal"
|
||||
/>
|
||||
)}
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
<TextField
|
||||
name="tx_power"
|
||||
label={LL.TX_POWER()}
|
||||
InputProps={{
|
||||
endAdornment: <InputAdornment position="end">dBm</InputAdornment>
|
||||
}}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
value={numberValue(data.tx_power)}
|
||||
value={data.tx_power}
|
||||
onChange={updateFormValue}
|
||||
type="number"
|
||||
margin="normal"
|
||||
/>
|
||||
select
|
||||
>
|
||||
<MenuItem value={0}>Auto</MenuItem>
|
||||
<MenuItem value={78}>19.5 dBm</MenuItem>
|
||||
<MenuItem value={76}>19 dBm</MenuItem>
|
||||
<MenuItem value={74}>18.5 dBm</MenuItem>
|
||||
<MenuItem value={68}>17 dBm</MenuItem>
|
||||
<MenuItem value={60}>15 dBm</MenuItem>
|
||||
<MenuItem value={52}>13 dBm</MenuItem>
|
||||
<MenuItem value={44}>11 dBm</MenuItem>
|
||||
<MenuItem value={34}>8.5 dBm</MenuItem>
|
||||
<MenuItem value={28}>7 dBm</MenuItem>
|
||||
</TextField>
|
||||
<BlockFormControlLabel
|
||||
control={<Checkbox name="nosleep" checked={data.nosleep} onChange={updateFormValue} />}
|
||||
label={LL.NETWORK_DISABLE_SLEEP()}
|
||||
|
||||
@@ -29,7 +29,6 @@ import {
|
||||
import { useRequest } from 'alova';
|
||||
import { useContext, useState } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
import { FeaturesContext } from '../../contexts/features';
|
||||
import RestartMonitor from './RestartMonitor';
|
||||
import SystemStatusVersionDialog from './SystemStatusVersionDialog';
|
||||
import type { FC } from 'react';
|
||||
@@ -54,8 +53,6 @@ const SystemStatusForm: FC = () => {
|
||||
const [restarting, setRestarting] = useState<boolean>();
|
||||
const [versionDialogOpen, setVersionDialogOpen] = useState<boolean>(false);
|
||||
|
||||
const { features } = useContext(FeaturesContext);
|
||||
|
||||
const { send: restartCommand } = useRequest(SystemApi.restart(), {
|
||||
immediate: false
|
||||
});
|
||||
@@ -215,7 +212,7 @@ const SystemStatusForm: FC = () => {
|
||||
<DevicesIcon />
|
||||
</Avatar>
|
||||
</ListItemAvatar>
|
||||
<ListItemText primary="SDK" secondary={data.arduino_version + ' / ESP-IDF v' + data.sdk_version} />
|
||||
<ListItemText primary="SDK" secondary={data.arduino_version + ' / ESP-IDF ' + data.sdk_version} />
|
||||
</ListItem>
|
||||
<Divider variant="inset" component="li" />
|
||||
<ListItem>
|
||||
@@ -355,7 +352,7 @@ const SystemStatusForm: FC = () => {
|
||||
open={versionDialogOpen}
|
||||
onClose={() => setVersionDialogOpen(false)}
|
||||
version={data.emsesp_version}
|
||||
platform={features.platform}
|
||||
platform={data.esp_platform}
|
||||
/>
|
||||
)}
|
||||
</SectionContent>
|
||||
|
||||
@@ -94,8 +94,14 @@ const DashboardDevices: FC = () => {
|
||||
}, []);
|
||||
|
||||
const leftOffset = () => {
|
||||
const left = document.getElementById('devices-window')?.getBoundingClientRect().left;
|
||||
const right = document.getElementById('devices-window')?.getBoundingClientRect().right;
|
||||
const devicesWindow = document.getElementById('devices-window');
|
||||
if (!devicesWindow) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const clientRect = devicesWindow.getBoundingClientRect();
|
||||
const left = clientRect.left;
|
||||
const right = clientRect.right;
|
||||
|
||||
if (!left || !right) {
|
||||
return 0;
|
||||
@@ -416,11 +422,11 @@ const DashboardDevices: FC = () => {
|
||||
const renderCoreData = () => (
|
||||
<IconContext.Provider value={{ color: 'lightblue', size: '24', style: { verticalAlign: 'middle' } }}>
|
||||
{!coreData.connected && <MessageBox my={2} level="error" message={LL.EMS_BUS_WARNING()} />}
|
||||
{coreData.connected && coreData.devices.length === 0 && (
|
||||
{/* {coreData.connected && coreData.devices.length === 0 && (
|
||||
<MessageBox my={2} level="warning" message={LL.EMS_BUS_SCANNING()} />
|
||||
)}
|
||||
)} */}
|
||||
|
||||
{coreData.devices.length !== 0 && (
|
||||
{coreData.connected && (
|
||||
<Table data={{ nodes: coreData.devices }} select={device_select} theme={device_theme} layout={{ custom: true }}>
|
||||
{(tableList: any) => (
|
||||
<>
|
||||
|
||||
@@ -26,7 +26,7 @@ import type { ValidateFieldsError } from 'async-validator';
|
||||
import { dialogStyle } from 'CustomTheme';
|
||||
import { ValidatedTextField } from 'components';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
import { updateValue } from 'utils';
|
||||
import { updateValue, numberValue } from 'utils';
|
||||
|
||||
import { validate } from 'validators';
|
||||
|
||||
@@ -133,7 +133,7 @@ const DashboardDevicesDialog = ({
|
||||
fieldErrors={fieldErrors}
|
||||
name="v"
|
||||
label={LL.VALUE(1)}
|
||||
value={Math.round(editItem.v * 10) / 10}
|
||||
value={numberValue(Math.round(editItem.v * 10) / 10)}
|
||||
autoFocus
|
||||
disabled={!writeable}
|
||||
type="number"
|
||||
|
||||
@@ -22,6 +22,26 @@ export const GPIO_VALIDATOR = {
|
||||
}
|
||||
};
|
||||
|
||||
export const GPIO_VALIDATORR = {
|
||||
validator(rule: InternalRuleItem, value: number, callback: (error?: string) => void) {
|
||||
if (
|
||||
value &&
|
||||
(value === 1 ||
|
||||
(value >= 6 && value <= 11) ||
|
||||
(value >= 16 && value <= 17) ||
|
||||
value === 20 ||
|
||||
value === 24 ||
|
||||
(value >= 28 && value <= 31) ||
|
||||
value > 40 ||
|
||||
value < 0)
|
||||
) {
|
||||
callback('Must be an valid GPIO port');
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const GPIO_VALIDATORC3 = {
|
||||
validator(rule: InternalRuleItem, value: number, callback: (error?: string) => void) {
|
||||
if (value && ((value >= 11 && value <= 19) || value > 21 || value < 0)) {
|
||||
@@ -69,6 +89,14 @@ export const createSettingsValidator = (settings: Settings) =>
|
||||
tx_gpio: [{ required: true, message: 'Tx GPIO is required' }, GPIO_VALIDATOR],
|
||||
rx_gpio: [{ required: true, message: 'Rx GPIO is required' }, GPIO_VALIDATOR]
|
||||
}),
|
||||
...(settings.board_profile === 'CUSTOM' &&
|
||||
settings.platform === 'ESP32R' && {
|
||||
led_gpio: [{ required: true, message: 'LED GPIO is required' }, GPIO_VALIDATORR],
|
||||
dallas_gpio: [{ required: true, message: 'GPIO is required' }, GPIO_VALIDATORR],
|
||||
pbutton_gpio: [{ required: true, message: 'Button GPIO is required' }, GPIO_VALIDATORR],
|
||||
tx_gpio: [{ required: true, message: 'Tx GPIO is required' }, GPIO_VALIDATORR],
|
||||
rx_gpio: [{ required: true, message: 'Rx GPIO is required' }, GPIO_VALIDATORR]
|
||||
}),
|
||||
...(settings.board_profile === 'CUSTOM' &&
|
||||
settings.platform === 'ESP32-C3' && {
|
||||
led_gpio: [{ required: true, message: 'LED GPIO is required' }, GPIO_VALIDATORC3],
|
||||
@@ -193,7 +221,15 @@ export const analogSensorItemValidation = (sensors: AnalogSensor[], creating: bo
|
||||
n: [{ required: true, message: 'Name is required' }],
|
||||
g: [
|
||||
{ required: true, message: 'GPIO is required' },
|
||||
platform === 'ESP32-S3' ? GPIO_VALIDATORS3 : platform === 'ESP32-C3' ? GPIO_VALIDATORC3 : GPIO_VALIDATOR,
|
||||
platform === 'ESP32-S3'
|
||||
? GPIO_VALIDATORS3
|
||||
: platform === 'ESP32-S2'
|
||||
? GPIO_VALIDATORS2
|
||||
: platform === 'ESP32-C3'
|
||||
? GPIO_VALIDATORC3
|
||||
: platform === 'ESP32R'
|
||||
? GPIO_VALIDATORR
|
||||
: GPIO_VALIDATOR,
|
||||
...(creating ? [isGPIOUniqueValidator(sensors)] : [])
|
||||
]
|
||||
});
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export * from './ap';
|
||||
export * from './features';
|
||||
export * from './me';
|
||||
export * from './mqtt';
|
||||
export * from './ntp';
|
||||
|
||||
@@ -14,9 +14,5 @@ export const createNetworkSettingsValidator = (networkSettings: NetworkSettings)
|
||||
subnet_mask: [{ required: true, message: 'Subnet mask is required' }, IP_ADDRESS_VALIDATOR],
|
||||
dns_ip_1: IP_ADDRESS_VALIDATOR,
|
||||
dns_ip_2: IP_ADDRESS_VALIDATOR
|
||||
}),
|
||||
tx_power: [
|
||||
{ required: true, message: 'Tx Power is required' },
|
||||
{ type: 'number', min: 0, max: 20, message: 'Tx Power must be between 0 and 20dBm' }
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ export const IP_ADDRESS_VALIDATOR = {
|
||||
}
|
||||
};
|
||||
|
||||
const HOSTNAME_LENGTH_REGEXP = /^.{0,63}$/;
|
||||
const HOSTNAME_LENGTH_REGEXP = /^.{0,200}$/;
|
||||
const HOSTNAME_PATTERN_REGEXP =
|
||||
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$/;
|
||||
|
||||
@@ -42,7 +42,7 @@ const isValidHostname = (value: string) => HOSTNAME_LENGTH_REGEXP.test(value) &&
|
||||
export const HOSTNAME_VALIDATOR = {
|
||||
validator(rule: InternalRuleItem, value: string, callback: (error?: string) => void) {
|
||||
if (value && !isValidHostname(value)) {
|
||||
callback('Must be a valid hostname of up to 63 characters');
|
||||
callback('Must be a valid hostname');
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export const HOSTNAME_VALIDATOR = {
|
||||
export const IP_OR_HOSTNAME_VALIDATOR = {
|
||||
validator(rule: InternalRuleItem, value: string, callback: (error?: string) => void) {
|
||||
if (value && !(isValidIpAddress(value) || isValidHostname(value))) {
|
||||
callback('Must be a valid IP address or hostname of up to 63 characters');
|
||||
callback('Must be a valid IP address or hostname');
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
|
||||
2090
interface/yarn.lock
2090
interface/yarn.lock
File diff suppressed because it is too large
Load Diff
0
lib/ArduinoJson/ArduinoJson.h
Normal file → Executable file
0
lib/ArduinoJson/ArduinoJson.h
Normal file → Executable file
7
lib/ArduinoJson/CHANGELOG.md
Normal file → Executable file
7
lib/ArduinoJson/CHANGELOG.md
Normal file → Executable file
@@ -1,6 +1,13 @@
|
||||
ArduinoJson: change log
|
||||
=======================
|
||||
|
||||
v7.0.3 (2024-02-05)
|
||||
------
|
||||
|
||||
* Improve error messages when using `char` or `char*` (issue #2043)
|
||||
* Reduce stack consumption (issue #2046)
|
||||
* Fix compatibility with GCC 4.8 (issue #2045)
|
||||
|
||||
v7.0.2 (2024-01-19)
|
||||
------
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
# ArduinoJson - https://arduinojson.org
|
||||
# Copyright © 2014-2024, Benoit BLANCHON
|
||||
# MIT License
|
||||
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
if(ESP_PLATFORM)
|
||||
# Build ArduinoJson as an ESP-IDF component
|
||||
idf_component_register(INCLUDE_DIRS src)
|
||||
return()
|
||||
endif()
|
||||
|
||||
project(ArduinoJson VERSION 7.0.2)
|
||||
|
||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
||||
include(CTest)
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
|
||||
include(extras/CompileOptions.cmake)
|
||||
add_subdirectory(extras/tests)
|
||||
add_subdirectory(extras/fuzzing)
|
||||
endif()
|
||||
0
lib/ArduinoJson/LICENSE.txt
Normal file → Executable file
0
lib/ArduinoJson/LICENSE.txt
Normal file → Executable file
155
lib/ArduinoJson/README.md
Executable file
155
lib/ArduinoJson/README.md
Executable file
@@ -0,0 +1,155 @@
|
||||
<p align="center">
|
||||
<a href="https://arduinojson.org/"><img alt="ArduinoJson" src="https://arduinojson.org/images/logo.svg" width="200" /></a>
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
[](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A7.x)
|
||||
[](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/7.x)
|
||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson)
|
||||
[](https://coveralls.io/github/bblanchon/ArduinoJson?branch=7.x)
|
||||
[](https://github.com/bblanchon/ArduinoJson/stargazers)
|
||||
[](https://github.com/sponsors/bblanchon)
|
||||
|
||||
ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).
|
||||
|
||||
## Features
|
||||
|
||||
* [JSON deserialization](https://arduinojson.org/v7/api/json/deserializejson/)
|
||||
* [Optionally decodes UTF-16 escape sequences to UTF-8](https://arduinojson.org/v7/api/config/decode_unicode/)
|
||||
* [Optionally supports comments in the input](https://arduinojson.org/v7/api/config/enable_comments/)
|
||||
* [Optionally filters the input to keep only desired values](https://arduinojson.org/v7/api/json/deserializejson/#filtering)
|
||||
* Supports single quotes as a string delimiter
|
||||
* Compatible with [NDJSON](http://ndjson.org/) and [JSON Lines](https://jsonlines.org/)
|
||||
* [JSON serialization](https://arduinojson.org/v7/api/json/serializejson/)
|
||||
* [Can write to a buffer or a stream](https://arduinojson.org/v7/api/json/serializejson/)
|
||||
* [Optionally indents the document (prettified JSON)](https://arduinojson.org/v7/api/json/serializejsonpretty/)
|
||||
* [MessagePack serialization](https://arduinojson.org/v7/api/msgpack/serializemsgpack/)
|
||||
* [MessagePack deserialization](https://arduinojson.org/v7/api/msgpack/deserializemsgpack/)
|
||||
* Efficient
|
||||
* [Twice smaller than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/)
|
||||
* [Almost 10% faster than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/)
|
||||
* [Consumes roughly 10% less RAM than the "official" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/)
|
||||
* [Deduplicates strings](https://arduinojson.org/news/2020/08/01/version-6-16-0/)
|
||||
* Versatile
|
||||
* Supports [custom allocators (to use external RAM chip, for example)](https://arduinojson.org/v7/how-to/use-external-ram-on-esp32/)
|
||||
* Supports [`String`](https://arduinojson.org/v7/api/config/enable_arduino_string/), [`std::string`](https://arduinojson.org/v7/api/config/enable_std_string/), and [`std::string_view`](https://arduinojson.org/v7/api/config/enable_string_view/)
|
||||
* Supports [`Stream`](https://arduinojson.org/v7/api/config/enable_arduino_stream/) and [`std::istream`/`std::ostream`](https://arduinojson.org/v7/api/config/enable_std_stream/)
|
||||
* Supports [Flash strings](https://arduinojson.org/v7/api/config/enable_progmem/)
|
||||
* Supports [custom readers](https://arduinojson.org/v7/api/json/deserializejson/#custom-reader) and [custom writers](https://arduinojson.org/v7/api/json/serializejson/#custom-writer)
|
||||
* Supports [custom converters](https://arduinojson.org/news/2021/05/04/version-6-18-0/)
|
||||
* Portable
|
||||
* Usable on any C++ project (not limited to Arduino)
|
||||
* Compatible with C++11, C++14 and C++17
|
||||
* Support for C++98/C++03 available on [ArduinoJson 6.20.x](https://github.com/bblanchon/ArduinoJson/tree/6.20.x)
|
||||
* Zero warnings with `-Wall -Wextra -pedantic` and `/W4`
|
||||
* [Header-only library](https://en.wikipedia.org/wiki/Header-only)
|
||||
* Works with virtually any board
|
||||
* Arduino boards: [Uno](https://amzn.to/38aL2ik), [Due](https://amzn.to/36YkWi2), [Micro](https://amzn.to/35WkdwG), [Nano](https://amzn.to/2QTvwRX), [Mega](https://amzn.to/36XWhuf), [Yun](https://amzn.to/30odURc), [Leonardo](https://amzn.to/36XWjlR)...
|
||||
* Espressif chips: [ESP8266](https://amzn.to/36YluV8), [ESP32](https://amzn.to/2G4pRCB)
|
||||
* Lolin (WeMos) boards: [D1 mini](https://amzn.to/2QUpz7q), [D1 Mini Pro](https://amzn.to/36UsGSs)...
|
||||
* Teensy boards: [4.0](https://amzn.to/30ljXGq), [3.2](https://amzn.to/2FT0EuC), [2.0](https://amzn.to/2QXUMXj)
|
||||
* Particle boards: [Argon](https://amzn.to/2FQHa9X), [Boron](https://amzn.to/36WgLUd), [Electron](https://amzn.to/30vEc4k), [Photon](https://amzn.to/387F9Cd)...
|
||||
* Texas Instruments boards: [MSP430](https://amzn.to/30nJWgg)...
|
||||
* Soft cores: [Nios II](https://en.wikipedia.org/wiki/Nios_II)...
|
||||
* Tested on all major development environments
|
||||
* [Arduino IDE](https://www.arduino.cc/en/Main/Software)
|
||||
* [Atmel Studio](http://www.atmel.com/microsite/atmel-studio/)
|
||||
* [Atollic TrueSTUDIO](https://atollic.com/truestudio/)
|
||||
* [Energia](http://energia.nu/)
|
||||
* [IAR Embedded Workbench](https://www.iar.com/iar-embedded-workbench/)
|
||||
* [Keil uVision](http://www.keil.com/)
|
||||
* [MPLAB X IDE](http://www.microchip.com/mplab/mplab-x-ide)
|
||||
* [Particle](https://www.particle.io/)
|
||||
* [PlatformIO](http://platformio.org/)
|
||||
* [Sloeber plugin for Eclipse](https://eclipse.baeyens.it/)
|
||||
* [Visual Micro](http://www.visualmicro.com/)
|
||||
* [Visual Studio](https://www.visualstudio.com/)
|
||||
* [Even works with online compilers like wandbox.org](https://wandbox.org/permlink/RlZSKy17DjJ6HcdN)
|
||||
* [CMake friendly](https://arduinojson.org/v7/how-to/use-arduinojson-with-cmake/)
|
||||
* Well designed
|
||||
* [Elegant API](http://arduinojson.org/v7/example/)
|
||||
* [Thread-safe](https://en.wikipedia.org/wiki/Thread_safety)
|
||||
* Self-contained (no external dependency)
|
||||
* `const` friendly
|
||||
* [`for` friendly](https://arduinojson.org/v7/api/jsonobject/begin_end/)
|
||||
* [TMP friendly](https://en.wikipedia.org/wiki/Template_metaprogramming)
|
||||
* Handles [integer overflows](https://arduinojson.org/v7/api/jsonvariant/as/#integer-overflows)
|
||||
* Well tested
|
||||
* [Unit test coverage close to 100%](https://coveralls.io/github/bblanchon/ArduinoJson?branch=7.x)
|
||||
* Continuously tested on
|
||||
* [Visual Studio 2017, 2019, 2022](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/7.x)
|
||||
* [GCC 4.8, 5, 6, 7, 8, 9, 10, 11, 12](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22)
|
||||
* [Clang 3.9, 4.0, 5.0, 6.0, 7, 8, 9, 10, 11, 12, 13, 14, 15](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22)
|
||||
* [Continuously fuzzed with Google OSS Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson)
|
||||
* Passes all default checks of [clang-tidy](https://releases.llvm.org/10.0.0/tools/clang/tools/extra/docs/clang-tidy/)
|
||||
* Well documented
|
||||
* [Tutorials](https://arduinojson.org/v7/doc/deserialization/)
|
||||
* [Examples](https://arduinojson.org/v7/example/)
|
||||
* [How-tos](https://arduinojson.org/v7/example/)
|
||||
* [FAQ](https://arduinojson.org/v7/faq/)
|
||||
* [Troubleshooter](https://arduinojson.org/v7/troubleshooter/)
|
||||
* [Book](https://arduinojson.org/book/)
|
||||
* [Changelog](CHANGELOG.md)
|
||||
* Vibrant user community
|
||||
* Most popular of all Arduino libraries on [GitHub](https://github.com/search?o=desc&q=arduino+library&s=stars&type=Repositories)
|
||||
* [Used in hundreds of projects](https://www.hackster.io/search?i=projects&q=arduinojson)
|
||||
* [Responsive support](https://github.com/bblanchon/ArduinoJson/issues?q=is%3Aissue+is%3Aclosed)
|
||||
|
||||
## Quickstart
|
||||
|
||||
### Deserialization
|
||||
|
||||
Here is a program that parses a JSON document with ArduinoJson.
|
||||
|
||||
```c++
|
||||
const char* json = "{\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}";
|
||||
|
||||
JsonDocument doc;
|
||||
deserializeJson(doc, json);
|
||||
|
||||
const char* sensor = doc["sensor"];
|
||||
long time = doc["time"];
|
||||
double latitude = doc["data"][0];
|
||||
double longitude = doc["data"][1];
|
||||
```
|
||||
|
||||
See the [tutorial on arduinojson.org](https://arduinojson.org/v7/doc/deserialization/)
|
||||
|
||||
### Serialization
|
||||
|
||||
Here is a program that generates a JSON document with ArduinoJson:
|
||||
|
||||
```c++
|
||||
JsonDocument doc;
|
||||
|
||||
doc["sensor"] = "gps";
|
||||
doc["time"] = 1351824120;
|
||||
doc["data"][0] = 48.756080;
|
||||
doc["data"][1] = 2.302038;
|
||||
|
||||
serializeJson(doc, Serial);
|
||||
// This prints:
|
||||
// {"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]}
|
||||
```
|
||||
|
||||
See the [tutorial on arduinojson.org](https://arduinojson.org/v7/doc/serialization/)
|
||||
|
||||
## Sponsors
|
||||
|
||||
ArduinoJson is thankful to its sponsors. Please give them a visit; they deserve it!
|
||||
|
||||
<p>
|
||||
<a href="https://www.programmingelectronics.com/" rel="sponsored">
|
||||
<img src="https://arduinojson.org/images/2021/10/programmingeleactronicsacademy.png" alt="Programming Electronics Academy" width="200">
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="https://github.com/1technophile" rel="sponsored">
|
||||
<img alt="1technophile" src="https://avatars.githubusercontent.com/u/12672732?s=40&v=4">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
If you run a commercial project that embeds ArduinoJson, think about [sponsoring the library's development](https://github.com/sponsors/bblanchon): it ensures the code that your products rely on stays actively maintained. It can also give your project some exposure to the makers' community.
|
||||
|
||||
If you are an individual user and want to support the development (or give a sign of appreciation), consider purchasing the book [Mastering ArduinoJson](https://arduinojson.org/book/) ❤, or simply [cast a star](https://github.com/bblanchon/ArduinoJson/stargazers) ⭐.
|
||||
27
lib/ArduinoJson/SUPPORT.md
Executable file
27
lib/ArduinoJson/SUPPORT.md
Executable file
@@ -0,0 +1,27 @@
|
||||
# ArduinoJson Support
|
||||
|
||||
First off, thank you very much for using ArduinoJson.
|
||||
|
||||
We'll be very happy to help you, but first please read the following.
|
||||
|
||||
## Before asking for help
|
||||
|
||||
1. Read the [FAQ](https://arduinojson.org/faq/?utm_source=github&utm_medium=support)
|
||||
2. Search in the [API Reference](https://arduinojson.org/api/?utm_source=github&utm_medium=support)
|
||||
|
||||
If you did not find the answer, please create a [new issue on GitHub](https://github.com/bblanchon/ArduinoJson/issues/new).
|
||||
|
||||
It is OK to add a comment to a currently opened issue, but please avoid adding comments to a closed issue.
|
||||
|
||||
## Before hitting the Submit button
|
||||
|
||||
Please provide all the relevant information:
|
||||
|
||||
* Good title
|
||||
* Short description of the problem
|
||||
* Target platform
|
||||
* Compiler model and version
|
||||
* [MVCE](https://stackoverflow.com/help/mcve)
|
||||
* Compiler output
|
||||
|
||||
Good questions get fast answers!
|
||||
@@ -1,13 +0,0 @@
|
||||
version: "7.0.2"
|
||||
description: >-
|
||||
A simple and efficient JSON library for embedded C++.
|
||||
⭐ 6444 stars on GitHub!
|
||||
Supports serialization, deserialization, MessagePack, streams, filtering, and more.
|
||||
Fully tested and documented.
|
||||
url: https://arduinojson.org/
|
||||
files:
|
||||
exclude:
|
||||
- "**/.vs/**/*"
|
||||
- ".devcontainer/**/*"
|
||||
- "examples/**/*"
|
||||
- "extras/**/*"
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"name": "ArduinoJson",
|
||||
"keywords": "json, rest, http, web",
|
||||
"description": "A simple and efficient JSON library for embedded C++. ⭐ 6444 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.",
|
||||
"homepage": "https://arduinojson.org/?utm_source=meta&utm_medium=library.json",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/bblanchon/ArduinoJson.git"
|
||||
},
|
||||
"version": "7.0.2",
|
||||
"authors": {
|
||||
"name": "Benoit Blanchon",
|
||||
"url": "https://blog.benoitblanchon.fr"
|
||||
},
|
||||
"export": {
|
||||
"include": ["src", "examples", "LICENSE.txt", "ArduinoJson.h"]
|
||||
},
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
"build": {
|
||||
"libArchive": false
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
name=ArduinoJson
|
||||
version=7.0.2
|
||||
author=Benoit Blanchon <blog.benoitblanchon.fr>
|
||||
maintainer=Benoit Blanchon <blog.benoitblanchon.fr>
|
||||
sentence=A simple and efficient JSON library for embedded C++.
|
||||
paragraph=⭐ 6444 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.
|
||||
category=Data Processing
|
||||
url=https://arduinojson.org/?utm_source=meta&utm_medium=library.properties
|
||||
architectures=*
|
||||
repository=https://github.com/bblanchon/ArduinoJson.git
|
||||
license=MIT
|
||||
0
lib/ArduinoJson/src/ArduinoJson.h
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson.h
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Array/ArrayData.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Array/ArrayData.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Array/ArrayImpl.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Array/ArrayImpl.hpp
Normal file → Executable file
10
lib/ArduinoJson/src/ArduinoJson/Array/ElementProxy.hpp
Normal file → Executable file
10
lib/ArduinoJson/src/ArduinoJson/Array/ElementProxy.hpp
Normal file → Executable file
@@ -22,25 +22,25 @@ class ElementProxy : public VariantRefBase<ElementProxy<TUpstream>>,
|
||||
ElementProxy(const ElementProxy& src)
|
||||
: upstream_(src.upstream_), index_(src.index_) {}
|
||||
|
||||
FORCE_INLINE ElementProxy& operator=(const ElementProxy& src) {
|
||||
ElementProxy& operator=(const ElementProxy& src) {
|
||||
this->set(src);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
FORCE_INLINE ElementProxy& operator=(const T& src) {
|
||||
ElementProxy& operator=(const T& src) {
|
||||
this->set(src);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
FORCE_INLINE ElementProxy& operator=(T* src) {
|
||||
ElementProxy& operator=(T* src) {
|
||||
this->set(src);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
FORCE_INLINE ResourceManager* getResourceManager() const {
|
||||
ResourceManager* getResourceManager() const {
|
||||
return VariantAttorney::getResourceManager(upstream_);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ class ElementProxy : public VariantRefBase<ElementProxy<TUpstream>>,
|
||||
VariantAttorney::getResourceManager(upstream_));
|
||||
}
|
||||
|
||||
FORCE_INLINE VariantData* getOrCreateData() const {
|
||||
VariantData* getOrCreateData() const {
|
||||
auto data = VariantAttorney::getOrCreateData(upstream_);
|
||||
if (!data)
|
||||
return nullptr;
|
||||
|
||||
29
lib/ArduinoJson/src/ArduinoJson/Array/JsonArray.hpp
Normal file → Executable file
29
lib/ArduinoJson/src/ArduinoJson/Array/JsonArray.hpp
Normal file → Executable file
@@ -20,11 +20,10 @@ class JsonArray : public detail::VariantOperators<JsonArray> {
|
||||
typedef JsonArrayIterator iterator;
|
||||
|
||||
// Constructs an unbound reference.
|
||||
FORCE_INLINE JsonArray() : data_(0), resources_(0) {}
|
||||
JsonArray() : data_(0), resources_(0) {}
|
||||
|
||||
// INTERNAL USE ONLY
|
||||
FORCE_INLINE JsonArray(detail::ArrayData* data,
|
||||
detail::ResourceManager* resources)
|
||||
JsonArray(detail::ArrayData* data, detail::ResourceManager* resources)
|
||||
: data_(data), resources_(resources) {}
|
||||
|
||||
// Returns a JsonVariant pointing to the array.
|
||||
@@ -63,20 +62,20 @@ class JsonArray : public detail::VariantOperators<JsonArray> {
|
||||
// Appends a value to the array.
|
||||
// https://arduinojson.org/v7/api/jsonarray/add/
|
||||
template <typename T>
|
||||
FORCE_INLINE bool add(const T& value) const {
|
||||
bool add(const T& value) const {
|
||||
return add<JsonVariant>().set(value);
|
||||
}
|
||||
|
||||
// Appends a value to the array.
|
||||
// https://arduinojson.org/v7/api/jsonarray/add/
|
||||
template <typename T>
|
||||
FORCE_INLINE bool add(T* value) const {
|
||||
bool add(T* value) const {
|
||||
return add<JsonVariant>().set(value);
|
||||
}
|
||||
|
||||
// Returns an iterator to the first element of the array.
|
||||
// https://arduinojson.org/v7/api/jsonarray/begin/
|
||||
FORCE_INLINE iterator begin() const {
|
||||
iterator begin() const {
|
||||
if (!data_)
|
||||
return iterator();
|
||||
return iterator(data_->createIterator(resources_), resources_);
|
||||
@@ -84,13 +83,13 @@ class JsonArray : public detail::VariantOperators<JsonArray> {
|
||||
|
||||
// Returns an iterator following the last element of the array.
|
||||
// https://arduinojson.org/v7/api/jsonarray/end/
|
||||
FORCE_INLINE iterator end() const {
|
||||
iterator end() const {
|
||||
return iterator();
|
||||
}
|
||||
|
||||
// Copies an array.
|
||||
// https://arduinojson.org/v7/api/jsonarray/set/
|
||||
FORCE_INLINE bool set(JsonArrayConst src) const {
|
||||
bool set(JsonArrayConst src) const {
|
||||
if (!data_)
|
||||
return false;
|
||||
|
||||
@@ -105,13 +104,13 @@ class JsonArray : public detail::VariantOperators<JsonArray> {
|
||||
|
||||
// Removes the element at the specified iterator.
|
||||
// https://arduinojson.org/v7/api/jsonarray/remove/
|
||||
FORCE_INLINE void remove(iterator it) const {
|
||||
void remove(iterator it) const {
|
||||
detail::ArrayData::remove(data_, it.iterator_, resources_);
|
||||
}
|
||||
|
||||
// Removes the element at the specified index.
|
||||
// https://arduinojson.org/v7/api/jsonarray/remove/
|
||||
FORCE_INLINE void remove(size_t index) const {
|
||||
void remove(size_t index) const {
|
||||
detail::ArrayData::removeElement(data_, index, resources_);
|
||||
}
|
||||
|
||||
@@ -123,7 +122,7 @@ class JsonArray : public detail::VariantOperators<JsonArray> {
|
||||
|
||||
// Gets or sets the element at the specified index.
|
||||
// https://arduinojson.org/v7/api/jsonarray/subscript/
|
||||
FORCE_INLINE detail::ElementProxy<JsonArray> operator[](size_t index) const {
|
||||
detail::ElementProxy<JsonArray> operator[](size_t index) const {
|
||||
return {*this, index};
|
||||
}
|
||||
|
||||
@@ -133,25 +132,25 @@ class JsonArray : public detail::VariantOperators<JsonArray> {
|
||||
|
||||
// Returns true if the reference is unbound.
|
||||
// https://arduinojson.org/v7/api/jsonarray/isnull/
|
||||
FORCE_INLINE bool isNull() const {
|
||||
bool isNull() const {
|
||||
return data_ == 0;
|
||||
}
|
||||
|
||||
// Returns true if the reference is bound.
|
||||
// https://arduinojson.org/v7/api/jsonarray/isnull/
|
||||
FORCE_INLINE operator bool() const {
|
||||
operator bool() const {
|
||||
return data_ != 0;
|
||||
}
|
||||
|
||||
// Returns the depth (nesting level) of the array.
|
||||
// https://arduinojson.org/v7/api/jsonarray/nesting/
|
||||
FORCE_INLINE size_t nesting() const {
|
||||
size_t nesting() const {
|
||||
return detail::VariantData::nesting(collectionToVariant(data_), resources_);
|
||||
}
|
||||
|
||||
// Returns the number of elements in the array.
|
||||
// https://arduinojson.org/v7/api/jsonarray/size/
|
||||
FORCE_INLINE size_t size() const {
|
||||
size_t size() const {
|
||||
return data_ ? data_->size(resources_) : 0;
|
||||
}
|
||||
|
||||
|
||||
20
lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayConst.hpp
Normal file → Executable file
20
lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayConst.hpp
Normal file → Executable file
@@ -23,7 +23,7 @@ class JsonArrayConst : public detail::VariantOperators<JsonArrayConst> {
|
||||
|
||||
// Returns an iterator to the first element of the array.
|
||||
// https://arduinojson.org/v7/api/jsonarrayconst/begin/
|
||||
FORCE_INLINE iterator begin() const {
|
||||
iterator begin() const {
|
||||
if (!data_)
|
||||
return iterator();
|
||||
return iterator(data_->createIterator(resources_), resources_);
|
||||
@@ -31,21 +31,21 @@ class JsonArrayConst : public detail::VariantOperators<JsonArrayConst> {
|
||||
|
||||
// Returns an iterator to the element following the last element of the array.
|
||||
// https://arduinojson.org/v7/api/jsonarrayconst/end/
|
||||
FORCE_INLINE iterator end() const {
|
||||
iterator end() const {
|
||||
return iterator();
|
||||
}
|
||||
|
||||
// Creates an unbound reference.
|
||||
FORCE_INLINE JsonArrayConst() : data_(0) {}
|
||||
JsonArrayConst() : data_(0) {}
|
||||
|
||||
// INTERNAL USE ONLY
|
||||
FORCE_INLINE JsonArrayConst(const detail::ArrayData* data,
|
||||
const detail::ResourceManager* resources)
|
||||
JsonArrayConst(const detail::ArrayData* data,
|
||||
const detail::ResourceManager* resources)
|
||||
: data_(data), resources_(resources) {}
|
||||
|
||||
// Returns the element at the specified index.
|
||||
// https://arduinojson.org/v7/api/jsonarrayconst/subscript/
|
||||
FORCE_INLINE JsonVariantConst operator[](size_t index) const {
|
||||
JsonVariantConst operator[](size_t index) const {
|
||||
return JsonVariantConst(
|
||||
detail::ArrayData::getElement(data_, index, resources_), resources_);
|
||||
}
|
||||
@@ -56,25 +56,25 @@ class JsonArrayConst : public detail::VariantOperators<JsonArrayConst> {
|
||||
|
||||
// Returns true if the reference is unbound.
|
||||
// https://arduinojson.org/v7/api/jsonarrayconst/isnull/
|
||||
FORCE_INLINE bool isNull() const {
|
||||
bool isNull() const {
|
||||
return data_ == 0;
|
||||
}
|
||||
|
||||
// Returns true if the reference is bound.
|
||||
// https://arduinojson.org/v7/api/jsonarrayconst/isnull/
|
||||
FORCE_INLINE operator bool() const {
|
||||
operator bool() const {
|
||||
return data_ != 0;
|
||||
}
|
||||
|
||||
// Returns the depth (nesting level) of the array.
|
||||
// https://arduinojson.org/v7/api/jsonarrayconst/nesting/
|
||||
FORCE_INLINE size_t nesting() const {
|
||||
size_t nesting() const {
|
||||
return detail::VariantData::nesting(getData(), resources_);
|
||||
}
|
||||
|
||||
// Returns the number of elements in the array.
|
||||
// https://arduinojson.org/v7/api/jsonarrayconst/size/
|
||||
FORCE_INLINE size_t size() const {
|
||||
size_t size() const {
|
||||
return data_ ? data_->size(resources_) : 0;
|
||||
}
|
||||
|
||||
|
||||
0
lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayIterator.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Array/JsonArrayIterator.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Array/Utilities.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Array/Utilities.hpp
Normal file → Executable file
4
lib/ArduinoJson/src/ArduinoJson/Collection/CollectionData.hpp
Normal file → Executable file
4
lib/ArduinoJson/src/ArduinoJson/Collection/CollectionData.hpp
Normal file → Executable file
@@ -107,6 +107,10 @@ class CollectionData {
|
||||
return collection->remove(it, resources);
|
||||
}
|
||||
|
||||
SlotId head() const {
|
||||
return head_;
|
||||
}
|
||||
|
||||
protected:
|
||||
iterator addSlot(ResourceManager*);
|
||||
|
||||
|
||||
0
lib/ArduinoJson/src/ArduinoJson/Collection/CollectionImpl.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Collection/CollectionImpl.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Configuration.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Configuration.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationOptions.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationOptions.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Filter.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Filter.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/NestingLimit.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/NestingLimit.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Reader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Reader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/FlashReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/FlashReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/RamReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/RamReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/VariantReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/Readers/VariantReader.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/deserialize.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Deserialization/deserialize.hpp
Normal file → Executable file
45
lib/ArduinoJson/src/ArduinoJson/Document/JsonDocument.hpp
Normal file → Executable file
45
lib/ArduinoJson/src/ArduinoJson/Document/JsonDocument.hpp
Normal file → Executable file
@@ -30,7 +30,8 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
||||
}
|
||||
|
||||
// Move-constructor
|
||||
JsonDocument(JsonDocument&& src) : JsonDocument() {
|
||||
JsonDocument(JsonDocument&& src)
|
||||
: JsonDocument(detail::DefaultAllocator::instance()) {
|
||||
swap(*this, src);
|
||||
}
|
||||
|
||||
@@ -169,9 +170,8 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
||||
// Gets or sets a root object's member.
|
||||
// https://arduinojson.org/v7/api/jsondocument/subscript/
|
||||
template <typename TString>
|
||||
FORCE_INLINE typename detail::enable_if<
|
||||
detail::IsString<TString>::value,
|
||||
detail::MemberProxy<JsonDocument&, TString>>::type
|
||||
typename detail::enable_if<detail::IsString<TString>::value,
|
||||
detail::MemberProxy<JsonDocument&, TString>>::type
|
||||
operator[](const TString& key) {
|
||||
return {*this, key};
|
||||
}
|
||||
@@ -179,9 +179,8 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
||||
// Gets or sets a root object's member.
|
||||
// https://arduinojson.org/v7/api/jsondocument/subscript/
|
||||
template <typename TChar>
|
||||
FORCE_INLINE typename detail::enable_if<
|
||||
detail::IsString<TChar*>::value,
|
||||
detail::MemberProxy<JsonDocument&, TChar*>>::type
|
||||
typename detail::enable_if<detail::IsString<TChar*>::value,
|
||||
detail::MemberProxy<JsonDocument&, TChar*>>::type
|
||||
operator[](TChar* key) {
|
||||
return {*this, key};
|
||||
}
|
||||
@@ -189,8 +188,8 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
||||
// Gets a root object's member.
|
||||
// https://arduinojson.org/v7/api/jsondocument/subscript/
|
||||
template <typename TString>
|
||||
FORCE_INLINE typename detail::enable_if<detail::IsString<TString>::value,
|
||||
JsonVariantConst>::type
|
||||
typename detail::enable_if<detail::IsString<TString>::value,
|
||||
JsonVariantConst>::type
|
||||
operator[](const TString& key) const {
|
||||
return JsonVariantConst(
|
||||
data_.getMember(detail::adaptString(key), &resources_), &resources_);
|
||||
@@ -199,8 +198,8 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
||||
// Gets a root object's member.
|
||||
// https://arduinojson.org/v7/api/jsondocument/subscript/
|
||||
template <typename TChar>
|
||||
FORCE_INLINE typename detail::enable_if<detail::IsString<TChar*>::value,
|
||||
JsonVariantConst>::type
|
||||
typename detail::enable_if<detail::IsString<TChar*>::value,
|
||||
JsonVariantConst>::type
|
||||
operator[](TChar* key) const {
|
||||
return JsonVariantConst(
|
||||
data_.getMember(detail::adaptString(key), &resources_), &resources_);
|
||||
@@ -208,13 +207,13 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
||||
|
||||
// Gets or sets a root array's element.
|
||||
// https://arduinojson.org/v7/api/jsondocument/subscript/
|
||||
FORCE_INLINE detail::ElementProxy<JsonDocument&> operator[](size_t index) {
|
||||
detail::ElementProxy<JsonDocument&> operator[](size_t index) {
|
||||
return {*this, index};
|
||||
}
|
||||
|
||||
// Gets a root array's member.
|
||||
// https://arduinojson.org/v7/api/jsondocument/subscript/
|
||||
FORCE_INLINE JsonVariantConst operator[](size_t index) const {
|
||||
JsonVariantConst operator[](size_t index) const {
|
||||
return JsonVariantConst(data_.getElement(index, &resources_), &resources_);
|
||||
}
|
||||
|
||||
@@ -239,28 +238,28 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
||||
// Appends a value to the root array.
|
||||
// https://arduinojson.org/v7/api/jsondocument/add/
|
||||
template <typename TValue>
|
||||
FORCE_INLINE bool add(const TValue& value) {
|
||||
bool add(const TValue& value) {
|
||||
return add<JsonVariant>().set(value);
|
||||
}
|
||||
|
||||
// Appends a value to the root array.
|
||||
// https://arduinojson.org/v7/api/jsondocument/add/
|
||||
template <typename TChar>
|
||||
FORCE_INLINE bool add(TChar* value) {
|
||||
bool add(TChar* value) {
|
||||
return add<JsonVariant>().set(value);
|
||||
}
|
||||
|
||||
// Removes an element of the root array.
|
||||
// https://arduinojson.org/v7/api/jsondocument/remove/
|
||||
FORCE_INLINE void remove(size_t index) {
|
||||
void remove(size_t index) {
|
||||
detail::VariantData::removeElement(getData(), index, getResourceManager());
|
||||
}
|
||||
|
||||
// Removes a member of the root object.
|
||||
// https://arduinojson.org/v7/api/jsondocument/remove/
|
||||
template <typename TChar>
|
||||
FORCE_INLINE typename detail::enable_if<detail::IsString<TChar*>::value>::type
|
||||
remove(TChar* key) {
|
||||
typename detail::enable_if<detail::IsString<TChar*>::value>::type remove(
|
||||
TChar* key) {
|
||||
detail::VariantData::removeMember(getData(), detail::adaptString(key),
|
||||
getResourceManager());
|
||||
}
|
||||
@@ -268,18 +267,18 @@ class JsonDocument : public detail::VariantOperators<const JsonDocument&> {
|
||||
// Removes a member of the root object.
|
||||
// https://arduinojson.org/v7/api/jsondocument/remove/
|
||||
template <typename TString>
|
||||
FORCE_INLINE
|
||||
typename detail::enable_if<detail::IsString<TString>::value>::type
|
||||
remove(const TString& key) {
|
||||
|
||||
typename detail::enable_if<detail::IsString<TString>::value>::type remove(
|
||||
const TString& key) {
|
||||
detail::VariantData::removeMember(getData(), detail::adaptString(key),
|
||||
getResourceManager());
|
||||
}
|
||||
|
||||
FORCE_INLINE operator JsonVariant() {
|
||||
operator JsonVariant() {
|
||||
return getVariant();
|
||||
}
|
||||
|
||||
FORCE_INLINE operator JsonVariantConst() const {
|
||||
operator JsonVariantConst() const {
|
||||
return getVariant();
|
||||
}
|
||||
|
||||
|
||||
0
lib/ArduinoJson/src/ArduinoJson/Json/EscapeSequence.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/EscapeSequence.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/JsonDeserializer.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/JsonDeserializer.hpp
Normal file → Executable file
34
lib/ArduinoJson/src/ArduinoJson/Json/JsonSerializer.hpp
Normal file → Executable file
34
lib/ArduinoJson/src/ArduinoJson/Json/JsonSerializer.hpp
Normal file → Executable file
@@ -19,19 +19,20 @@ class JsonSerializer : public VariantDataVisitor<size_t> {
|
||||
JsonSerializer(TWriter writer, const ResourceManager* resources)
|
||||
: formatter_(writer), resources_(resources) {}
|
||||
|
||||
FORCE_INLINE size_t visit(const ArrayData& array) {
|
||||
size_t visit(const ArrayData& array) {
|
||||
write('[');
|
||||
|
||||
auto it = array.createIterator(resources_);
|
||||
auto slotId = array.head();
|
||||
|
||||
while (!it.done()) {
|
||||
it->accept(*this);
|
||||
while (slotId != NULL_SLOT) {
|
||||
auto slot = resources_->getSlot(slotId);
|
||||
|
||||
it.next(resources_);
|
||||
if (it.done())
|
||||
break;
|
||||
slot->data()->accept(*this);
|
||||
|
||||
write(',');
|
||||
slotId = slot->next();
|
||||
|
||||
if (slotId != NULL_SLOT)
|
||||
write(',');
|
||||
}
|
||||
|
||||
write(']');
|
||||
@@ -41,18 +42,19 @@ class JsonSerializer : public VariantDataVisitor<size_t> {
|
||||
size_t visit(const ObjectData& object) {
|
||||
write('{');
|
||||
|
||||
auto it = object.createIterator(resources_);
|
||||
auto slotId = object.head();
|
||||
|
||||
while (!it.done()) {
|
||||
formatter_.writeString(it.key());
|
||||
while (slotId != NULL_SLOT) {
|
||||
auto slot = resources_->getSlot(slotId);
|
||||
|
||||
formatter_.writeString(slot->key());
|
||||
write(':');
|
||||
it->accept(*this);
|
||||
slot->data()->accept(*this);
|
||||
|
||||
it.next(resources_);
|
||||
if (it.done())
|
||||
break;
|
||||
slotId = slot->next();
|
||||
|
||||
write(',');
|
||||
if (slotId != NULL_SLOT)
|
||||
write(',');
|
||||
}
|
||||
|
||||
write('}');
|
||||
|
||||
0
lib/ArduinoJson/src/ArduinoJson/Json/Latch.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/Latch.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/PrettyJsonSerializer.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/PrettyJsonSerializer.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/TextFormatter.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/TextFormatter.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/Utf16.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/Utf16.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/Utf8.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Json/Utf8.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/Alignment.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/Alignment.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/Allocator.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/Allocator.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/ResourceManager.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/ResourceManager.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/StringBuilder.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/StringBuilder.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/StringNode.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/StringNode.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/StringPool.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/StringPool.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/VariantPool.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/VariantPool.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/VariantPoolImpl.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/VariantPoolImpl.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/VariantPoolList.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Memory/VariantPoolList.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Misc/SerializedValue.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Misc/SerializedValue.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp
Normal file → Executable file
22
lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp
Normal file → Executable file
22
lib/ArduinoJson/src/ArduinoJson/MsgPack/MsgPackSerializer.hpp
Normal file → Executable file
@@ -59,10 +59,14 @@ class MsgPackSerializer : public VariantDataVisitor<size_t> {
|
||||
writeByte(0xDD);
|
||||
writeInteger(uint32_t(n));
|
||||
}
|
||||
for (auto it = array.createIterator(resources_); !it.done();
|
||||
it.next(resources_)) {
|
||||
it->accept(*this);
|
||||
|
||||
auto slotId = array.head();
|
||||
while (slotId != NULL_SLOT) {
|
||||
auto slot = resources_->getSlot(slotId);
|
||||
slot->data()->accept(*this);
|
||||
slotId = slot->next();
|
||||
}
|
||||
|
||||
return bytesWritten();
|
||||
}
|
||||
|
||||
@@ -77,11 +81,15 @@ class MsgPackSerializer : public VariantDataVisitor<size_t> {
|
||||
writeByte(0xDF);
|
||||
writeInteger(uint32_t(n));
|
||||
}
|
||||
for (auto it = object.createIterator(resources_); !it.done();
|
||||
it.next(resources_)) {
|
||||
visit(it.key());
|
||||
it->accept(*this);
|
||||
|
||||
auto slotId = object.head();
|
||||
while (slotId != NULL_SLOT) {
|
||||
auto slot = resources_->getSlot(slotId);
|
||||
visit(slot->key());
|
||||
slot->data()->accept(*this);
|
||||
slotId = slot->next();
|
||||
}
|
||||
|
||||
return bytesWritten();
|
||||
}
|
||||
|
||||
|
||||
0
lib/ArduinoJson/src/ArduinoJson/MsgPack/endianess.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/MsgPack/endianess.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/MsgPack/ieee754.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/MsgPack/ieee754.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Namespace.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Namespace.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/FloatParts.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/FloatParts.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/FloatTraits.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/FloatTraits.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/JsonFloat.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/JsonFloat.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/JsonInteger.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/JsonInteger.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/arithmeticCompare.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/arithmeticCompare.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/convertNumber.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/convertNumber.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/parseNumber.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Numbers/parseNumber.hpp
Normal file → Executable file
47
lib/ArduinoJson/src/ArduinoJson/Object/JsonObject.hpp
Normal file → Executable file
47
lib/ArduinoJson/src/ArduinoJson/Object/JsonObject.hpp
Normal file → Executable file
@@ -20,11 +20,10 @@ class JsonObject : public detail::VariantOperators<JsonObject> {
|
||||
typedef JsonObjectIterator iterator;
|
||||
|
||||
// Creates an unbound reference.
|
||||
FORCE_INLINE JsonObject() : data_(0), resources_(0) {}
|
||||
JsonObject() : data_(0), resources_(0) {}
|
||||
|
||||
// INTERNAL USE ONLY
|
||||
FORCE_INLINE JsonObject(detail::ObjectData* data,
|
||||
detail::ResourceManager* resource)
|
||||
JsonObject(detail::ObjectData* data, detail::ResourceManager* resource)
|
||||
: data_(data), resources_(resource) {}
|
||||
|
||||
operator JsonVariant() const {
|
||||
@@ -43,31 +42,31 @@ class JsonObject : public detail::VariantOperators<JsonObject> {
|
||||
|
||||
// Returns true if the reference is unbound.
|
||||
// https://arduinojson.org/v7/api/jsonobject/isnull/
|
||||
FORCE_INLINE bool isNull() const {
|
||||
bool isNull() const {
|
||||
return data_ == 0;
|
||||
}
|
||||
|
||||
// Returns true if the reference is bound.
|
||||
// https://arduinojson.org/v7/api/jsonobject/isnull/
|
||||
FORCE_INLINE operator bool() const {
|
||||
operator bool() const {
|
||||
return data_ != 0;
|
||||
}
|
||||
|
||||
// Returns the depth (nesting level) of the object.
|
||||
// https://arduinojson.org/v7/api/jsonobject/nesting/
|
||||
FORCE_INLINE size_t nesting() const {
|
||||
size_t nesting() const {
|
||||
return detail::VariantData::nesting(collectionToVariant(data_), resources_);
|
||||
}
|
||||
|
||||
// Returns the number of members in the object.
|
||||
// https://arduinojson.org/v7/api/jsonobject/size/
|
||||
FORCE_INLINE size_t size() const {
|
||||
size_t size() const {
|
||||
return data_ ? data_->size(resources_) : 0;
|
||||
}
|
||||
|
||||
// Returns an iterator to the first key-value pair of the object.
|
||||
// https://arduinojson.org/v7/api/jsonobject/begin/
|
||||
FORCE_INLINE iterator begin() const {
|
||||
iterator begin() const {
|
||||
if (!data_)
|
||||
return iterator();
|
||||
return iterator(data_->createIterator(resources_), resources_);
|
||||
@@ -75,7 +74,7 @@ class JsonObject : public detail::VariantOperators<JsonObject> {
|
||||
|
||||
// Returns an iterator following the last key-value pair of the object.
|
||||
// https://arduinojson.org/v7/api/jsonobject/end/
|
||||
FORCE_INLINE iterator end() const {
|
||||
iterator end() const {
|
||||
return iterator();
|
||||
}
|
||||
|
||||
@@ -87,7 +86,7 @@ class JsonObject : public detail::VariantOperators<JsonObject> {
|
||||
|
||||
// Copies an object.
|
||||
// https://arduinojson.org/v7/api/jsonobject/set/
|
||||
FORCE_INLINE bool set(JsonObjectConst src) {
|
||||
bool set(JsonObjectConst src) {
|
||||
if (!data_ || !src.data_)
|
||||
return false;
|
||||
|
||||
@@ -103,20 +102,20 @@ class JsonObject : public detail::VariantOperators<JsonObject> {
|
||||
// Gets or sets the member with specified key.
|
||||
// https://arduinojson.org/v7/api/jsonobject/subscript/
|
||||
template <typename TString>
|
||||
FORCE_INLINE
|
||||
typename detail::enable_if<detail::IsString<TString>::value,
|
||||
detail::MemberProxy<JsonObject, TString>>::type
|
||||
operator[](const TString& key) const {
|
||||
|
||||
typename detail::enable_if<detail::IsString<TString>::value,
|
||||
detail::MemberProxy<JsonObject, TString>>::type
|
||||
operator[](const TString& key) const {
|
||||
return {*this, key};
|
||||
}
|
||||
|
||||
// Gets or sets the member with specified key.
|
||||
// https://arduinojson.org/v7/api/jsonobject/subscript/
|
||||
template <typename TChar>
|
||||
FORCE_INLINE
|
||||
typename detail::enable_if<detail::IsString<TChar*>::value,
|
||||
detail::MemberProxy<JsonObject, TChar*>>::type
|
||||
operator[](TChar* key) const {
|
||||
|
||||
typename detail::enable_if<detail::IsString<TChar*>::value,
|
||||
detail::MemberProxy<JsonObject, TChar*>>::type
|
||||
operator[](TChar* key) const {
|
||||
return {*this, key};
|
||||
}
|
||||
|
||||
@@ -145,9 +144,9 @@ class JsonObject : public detail::VariantOperators<JsonObject> {
|
||||
// Returns true if the object contains the specified key.
|
||||
// https://arduinojson.org/v7/api/jsonobject/containskey/
|
||||
template <typename TString>
|
||||
FORCE_INLINE
|
||||
typename detail::enable_if<detail::IsString<TString>::value, bool>::type
|
||||
containsKey(const TString& key) const {
|
||||
|
||||
typename detail::enable_if<detail::IsString<TString>::value, bool>::type
|
||||
containsKey(const TString& key) const {
|
||||
return detail::ObjectData::getMember(data_, detail::adaptString(key),
|
||||
resources_) != 0;
|
||||
}
|
||||
@@ -155,9 +154,9 @@ class JsonObject : public detail::VariantOperators<JsonObject> {
|
||||
// Returns true if the object contains the specified key.
|
||||
// https://arduinojson.org/v7/api/jsonobject/containskey/
|
||||
template <typename TChar>
|
||||
FORCE_INLINE
|
||||
typename detail::enable_if<detail::IsString<TChar*>::value, bool>::type
|
||||
containsKey(TChar* key) const {
|
||||
|
||||
typename detail::enable_if<detail::IsString<TChar*>::value, bool>::type
|
||||
containsKey(TChar* key) const {
|
||||
return detail::ObjectData::getMember(data_, detail::adaptString(key),
|
||||
resources_) != 0;
|
||||
}
|
||||
|
||||
24
lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectConst.hpp
Normal file → Executable file
24
lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectConst.hpp
Normal file → Executable file
@@ -32,31 +32,31 @@ class JsonObjectConst : public detail::VariantOperators<JsonObjectConst> {
|
||||
|
||||
// Returns true if the reference is unbound.
|
||||
// https://arduinojson.org/v7/api/jsonobjectconst/isnull/
|
||||
FORCE_INLINE bool isNull() const {
|
||||
bool isNull() const {
|
||||
return data_ == 0;
|
||||
}
|
||||
|
||||
// Returns true if the reference is bound.
|
||||
// https://arduinojson.org/v7/api/jsonobjectconst/isnull/
|
||||
FORCE_INLINE operator bool() const {
|
||||
operator bool() const {
|
||||
return data_ != 0;
|
||||
}
|
||||
|
||||
// Returns the depth (nesting level) of the object.
|
||||
// https://arduinojson.org/v7/api/jsonobjectconst/nesting/
|
||||
FORCE_INLINE size_t nesting() const {
|
||||
size_t nesting() const {
|
||||
return detail::VariantData::nesting(getData(), resources_);
|
||||
}
|
||||
|
||||
// Returns the number of members in the object.
|
||||
// https://arduinojson.org/v7/api/jsonobjectconst/size/
|
||||
FORCE_INLINE size_t size() const {
|
||||
size_t size() const {
|
||||
return data_ ? data_->size(resources_) : 0;
|
||||
}
|
||||
|
||||
// Returns an iterator to the first key-value pair of the object.
|
||||
// https://arduinojson.org/v7/api/jsonobjectconst/begin/
|
||||
FORCE_INLINE iterator begin() const {
|
||||
iterator begin() const {
|
||||
if (!data_)
|
||||
return iterator();
|
||||
return iterator(data_->createIterator(resources_), resources_);
|
||||
@@ -64,14 +64,14 @@ class JsonObjectConst : public detail::VariantOperators<JsonObjectConst> {
|
||||
|
||||
// Returns an iterator following the last key-value pair of the object.
|
||||
// https://arduinojson.org/v7/api/jsonobjectconst/end/
|
||||
FORCE_INLINE iterator end() const {
|
||||
iterator end() const {
|
||||
return iterator();
|
||||
}
|
||||
|
||||
// Returns true if the object contains the specified key.
|
||||
// https://arduinojson.org/v7/api/jsonobjectconst/containskey/
|
||||
template <typename TString>
|
||||
FORCE_INLINE bool containsKey(const TString& key) const {
|
||||
bool containsKey(const TString& key) const {
|
||||
return detail::ObjectData::getMember(data_, detail::adaptString(key),
|
||||
resources_) != 0;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class JsonObjectConst : public detail::VariantOperators<JsonObjectConst> {
|
||||
// Returns true if the object contains the specified key.
|
||||
// https://arduinojson.org/v7/api/jsonobjectconst/containskey/
|
||||
template <typename TChar>
|
||||
FORCE_INLINE bool containsKey(TChar* key) const {
|
||||
bool containsKey(TChar* key) const {
|
||||
return detail::ObjectData::getMember(data_, detail::adaptString(key),
|
||||
resources_) != 0;
|
||||
}
|
||||
@@ -87,8 +87,8 @@ class JsonObjectConst : public detail::VariantOperators<JsonObjectConst> {
|
||||
// Gets the member with specified key.
|
||||
// https://arduinojson.org/v7/api/jsonobjectconst/subscript/
|
||||
template <typename TString>
|
||||
FORCE_INLINE typename detail::enable_if<detail::IsString<TString>::value,
|
||||
JsonVariantConst>::type
|
||||
typename detail::enable_if<detail::IsString<TString>::value,
|
||||
JsonVariantConst>::type
|
||||
operator[](const TString& key) const {
|
||||
return JsonVariantConst(detail::ObjectData::getMember(
|
||||
data_, detail::adaptString(key), resources_),
|
||||
@@ -98,8 +98,8 @@ class JsonObjectConst : public detail::VariantOperators<JsonObjectConst> {
|
||||
// Gets the member with specified key.
|
||||
// https://arduinojson.org/v7/api/jsonobjectconst/subscript/
|
||||
template <typename TChar>
|
||||
FORCE_INLINE typename detail::enable_if<detail::IsString<TChar*>::value,
|
||||
JsonVariantConst>::type
|
||||
typename detail::enable_if<detail::IsString<TChar*>::value,
|
||||
JsonVariantConst>::type
|
||||
operator[](TChar* key) const {
|
||||
return JsonVariantConst(detail::ObjectData::getMember(
|
||||
data_, detail::adaptString(key), resources_),
|
||||
|
||||
0
lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectIterator.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Object/JsonObjectIterator.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Object/JsonPair.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Object/JsonPair.hpp
Normal file → Executable file
14
lib/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp
Normal file → Executable file
14
lib/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp
Normal file → Executable file
@@ -17,41 +17,41 @@ class MemberProxy
|
||||
friend class VariantAttorney;
|
||||
|
||||
public:
|
||||
FORCE_INLINE MemberProxy(TUpstream upstream, TStringRef key)
|
||||
MemberProxy(TUpstream upstream, TStringRef key)
|
||||
: upstream_(upstream), key_(key) {}
|
||||
|
||||
MemberProxy(const MemberProxy& src)
|
||||
: upstream_(src.upstream_), key_(src.key_) {}
|
||||
|
||||
FORCE_INLINE MemberProxy& operator=(const MemberProxy& src) {
|
||||
MemberProxy& operator=(const MemberProxy& src) {
|
||||
this->set(src);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
FORCE_INLINE MemberProxy& operator=(const T& src) {
|
||||
MemberProxy& operator=(const T& src) {
|
||||
this->set(src);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
FORCE_INLINE MemberProxy& operator=(T* src) {
|
||||
MemberProxy& operator=(T* src) {
|
||||
this->set(src);
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
FORCE_INLINE ResourceManager* getResourceManager() const {
|
||||
ResourceManager* getResourceManager() const {
|
||||
return VariantAttorney::getResourceManager(upstream_);
|
||||
}
|
||||
|
||||
FORCE_INLINE VariantData* getData() const {
|
||||
VariantData* getData() const {
|
||||
return VariantData::getMember(
|
||||
VariantAttorney::getData(upstream_), adaptString(key_),
|
||||
VariantAttorney::getResourceManager(upstream_));
|
||||
}
|
||||
|
||||
FORCE_INLINE VariantData* getOrCreateData() const {
|
||||
VariantData* getOrCreateData() const {
|
||||
auto data = VariantAttorney::getOrCreateData(upstream_);
|
||||
if (!data)
|
||||
return nullptr;
|
||||
|
||||
0
lib/ArduinoJson/src/ArduinoJson/Object/ObjectData.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Object/ObjectData.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Object/ObjectImpl.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Object/ObjectImpl.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Polyfills/alias_cast.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Polyfills/alias_cast.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Polyfills/assert.hpp
Normal file → Executable file
0
lib/ArduinoJson/src/ArduinoJson/Polyfills/assert.hpp
Normal file → Executable file
3
lib/ArduinoJson/src/ArduinoJson/Polyfills/attributes.hpp
Normal file → Executable file
3
lib/ArduinoJson/src/ArduinoJson/Polyfills/attributes.hpp
Normal file → Executable file
@@ -7,7 +7,6 @@
|
||||
#ifdef _MSC_VER // Visual Studio
|
||||
|
||||
# define FORCE_INLINE // __forceinline causes C4714 when returning std::string
|
||||
# define NO_INLINE __declspec(noinline)
|
||||
|
||||
# ifndef ARDUINOJSON_DEPRECATED
|
||||
# define ARDUINOJSON_DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
@@ -16,7 +15,6 @@
|
||||
#elif defined(__GNUC__) // GCC or Clang
|
||||
|
||||
# define FORCE_INLINE __attribute__((always_inline))
|
||||
# define NO_INLINE __attribute__((noinline))
|
||||
|
||||
# ifndef ARDUINOJSON_DEPRECATED
|
||||
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||
@@ -29,7 +27,6 @@
|
||||
#else // Other compilers
|
||||
|
||||
# define FORCE_INLINE
|
||||
# define NO_INLINE
|
||||
|
||||
# ifndef ARDUINOJSON_DEPRECATED
|
||||
# define ARDUINOJSON_DEPRECATED(msg)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user