Skip to content

Commit

Permalink
Update flatbuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
hhvrc committed Jan 27, 2025
1 parent a8b8704 commit f3ea910
Show file tree
Hide file tree
Showing 20 changed files with 122 additions and 49 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"eslint": "^9.19.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-svelte": "^2.46.1",
"flatbuffers": "^24.12.23",
"flatbuffers": "^25.1.24",
"globals": "^15.14.0",
"lucide-svelte": "^0.474.0",
"prettier": "^3.4.2",
Expand Down
10 changes: 5 additions & 5 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions include/serialization/_fbs/FirmwareBootType_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

namespace OpenShock {
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/GatewayToHubMessage_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

#include "SemVer_generated.h"
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/HubConfig_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

namespace OpenShock {
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/HubToGatewayMessage_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

#include "FirmwareBootType_generated.h"
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/HubToLocalMessage_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

#include "HubConfig_generated.h"
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/LocalToHubMessage_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

namespace OpenShock {
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/OtaUpdateProgressTask_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

namespace OpenShock {
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/SemVer_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

namespace OpenShock {
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/ShockerCommandType_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

namespace OpenShock {
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/ShockerModelType_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

namespace OpenShock {
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/WifiAuthMode_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

namespace OpenShock {
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/WifiNetworkEventType_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

namespace OpenShock {
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/WifiNetwork_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

#include "WifiAuthMode_generated.h"
Expand Down
6 changes: 3 additions & 3 deletions include/serialization/_fbs/WifiScanStatus_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
static_assert(FLATBUFFERS_VERSION_MAJOR == 24 &&
FLATBUFFERS_VERSION_MINOR == 12 &&
FLATBUFFERS_VERSION_REVISION == 23,
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
FLATBUFFERS_VERSION_MINOR == 1 &&
FLATBUFFERS_VERSION_REVISION == 24,
"Non-compatible flatbuffers version included");

namespace OpenShock {
Expand Down
73 changes: 73 additions & 0 deletions scripts/fetch_flatc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import os
import requests
import zipfile
import tempfile
from pathlib import Path


def fetch_latest_flatbuffers_release(output_dir):
# API URL for the latest release
api_url = "https://api.github.com/repos/google/flatbuffers/releases/latest"

try:
# Fetch the latest release data
response = requests.get(api_url)
response.raise_for_status()
release_data = response.json()

# Extract assets matching the desired filenames
assets = release_data.get("assets", [])
linux_asset = next((asset for asset in assets if "Linux.flatc.binary.clang" in asset["name"]), None)
windows_asset = next((asset for asset in assets if "Windows.flatc.binary" in asset["name"]), None)

if not linux_asset or not windows_asset:
raise ValueError("Required assets not found in the latest release.")

# Create a temporary directory for downloads
with tempfile.TemporaryDirectory() as temp_dir:
temp_dir_path = Path(temp_dir)

# Download and extract Linux asset
linux_zip_path = temp_dir_path / linux_asset["name"]
download_file(linux_asset["browser_download_url"], linux_zip_path)
extract_zip(linux_zip_path, output_dir)

# Download and extract Windows asset
windows_zip_path = temp_dir_path / windows_asset["name"]
download_file(windows_asset["browser_download_url"], windows_zip_path)
extract_zip(windows_zip_path, output_dir)

print(f"Files have been successfully downloaded, extracted to {output_dir}, and temporary files deleted.")

except requests.RequestException as e:
print(f"Error fetching release data: {e}")
except Exception as e:
print(f"An error occurred: {e}")


def download_file(url, dest_path):
"""Download a file from a URL to the specified destination."""
response = requests.get(url, stream=True)
response.raise_for_status()

with open(dest_path, "wb") as f:
for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)
print(f"Downloaded: {dest_path}")


def extract_zip(zip_path, extract_to):
"""Extract a ZIP file to the specified directory."""
with zipfile.ZipFile(zip_path, "r") as zip_ref:
zip_ref.extractall(extract_to)
print(f"Extracted: {zip_path} to {extract_to}")


if __name__ == "__main__":
# Specify the output directory for the extracted files
output_directory = Path(input("Enter the directory to extract the files to: ")).resolve()

if not output_directory.exists():
output_directory.mkdir(parents=True)

fetch_latest_flatbuffers_release(output_directory)
Binary file added scripts/flatc
Binary file not shown.
Binary file modified scripts/flatc.exe
Binary file not shown.

0 comments on commit f3ea910

Please sign in to comment.