Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ad3154 committed Oct 23, 2023
1 parent 7d5c771 commit 3691efb
Show file tree
Hide file tree
Showing 73 changed files with 3,867 additions and 0 deletions.
99 changes: 99 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
BasedOnStyle: Google
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel : true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakConstructorInitializersBeforeComma: false
BreakStringLiterals: false
ColumnLimit: 0
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
FixNamespaceComments: false
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
ReflowComments: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 2
UseTab: ForIndentation
60 changes: 60 additions & 0 deletions .cmake-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
format:
disable: false
line_width: 80
tab_size: 2
use_tabchars: false
fractional_tab_policy: use-space
max_subgroups_hwrap: 2
max_pargs_hwrap: 6
max_rows_cmdline: 2
separate_ctrl_name_with_space: false
separate_fn_name_with_space: false
dangle_parens: false
dangle_align: prefix
min_prefix_chars: 4
max_prefix_chars: 10
max_lines_hwrap: 2
line_ending: unix
command_case: canonical
keyword_case: unchanged
always_wrap: []
enable_sort: true
autosort: false
require_valid_layout: false
layout_passes: {}
markup:
bullet_char: "*"
enum_char: .
first_comment_is_literal: false
literal_comment_pattern: null
fence_pattern: ^\s*([`~]{3}[`~]*)(.*)$
ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$
explicit_trailing_pattern: "#<"
hashruler_min_length: 10
canonicalize_hashrulers: true
enable_markup: true
lint:
disabled_codes: [C0301]
function_pattern: "[0-9a-z_]+"
macro_pattern: "[0-9A-Z_]+"
global_var_pattern: "[a-zA-Z][0-9a-zA-Z_]+"
internal_var_pattern: _[A-Z][0-9A-Z_]+
local_var_pattern: "[a-z][a-z0-9_]+"
private_var_pattern: _[0-9a-z_]+
public_var_pattern: "[A-Z][0-9A-Z_]+"
argument_var_pattern: "[a-z][a-z0-9_]+"
keyword_pattern: "[A-Z][0-9A-Z_]+"
max_conditionals_custom_parser: 2
min_statement_spacing: 1
max_statement_spacing: 2
max_returns: 6
max_branches: 12
max_arguments: 5
max_localvars: 15
max_statements: 50
encode:
emit_byteorder_mark: false
input_encoding: utf-8
output_encoding: utf-8
misc:
per_command: {}
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: ad3154
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build

on: push

jobs:
windows_build:
name: Windows Build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Compile
run: |
mkdir build
cmake -S . -B build -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DCAN_DRIVER=None -DCMAKE_BUILD_TYPE=Debug
cmake --build build --config Debug
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@
*.exe
*.out
*.app

# Editors
.vs/
.vscode/
out
build
66 changes: 66 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
cmake_minimum_required(VERSION 3.16)

project(
"AgISOUniversalTerminal"
LANGUAGES CXX
VERSION 0.0.1)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

find_package(JUCE MODULE)
find_package(CAN_Stack MODULE)
find_package(Threads REQUIRED)

# set(CAN_DRIVER "TouCAN") Set this to be whatever your CAN driver is
# add_subdirectory(ISO11783-CAN-Stack)

juce_add_gui_app(
AgISOUniversalTerminal
# ICON_BIG ... # ICON_* arguments specify a path to an
# image file to use as an icon ICON_SMALL ...
COMPANY_NAME
"Open-Agriculture"
PRODUCT_NAME
"AgISOUniversalTerminal")

juce_generate_juce_header(AgISOUniversalTerminal)

target_sources(
AgISOUniversalTerminal
PRIVATE src/Main.cpp
"src/ServerMainComponent.cpp"
"src/DataMaskComponent.cpp"
"src/WorkingSetSelectorComponent.cpp"
"src/PictureGraphicComponent.cpp"
"src/WorkingSetComponent.cpp"
"src/AlarmMaskComponent.cpp"
"src/DataMaskRenderAreaComponent.cpp"
"src/JuceManagedWorkingSetCache.cpp"
"src/OutputRectangleComponent.cpp"
"src/OutputStringComponent.cpp"
"src/ButtonComponent.cpp"
"src/ContainerComponent.cpp"
"src/ObjectPointerComponent.cpp"
"src/OutputNumberComponent.cpp"
"src/SoftkeyMaskRenderArea.cpp"
"src/KeyComponent.cpp"
"src/SoftKeyMaskComponent.cpp"
"src/OutputMeterComponent.cpp"
"src/InputBooleanComponent.cpp"
"src/LoggerComponent.cpp"
"src/InputNumberComponent.cpp"
"src/OutputEllipseComponent.cpp"
"src/OutputLineComponent.cpp"
"src/OutputLinearBarGraphComponent.cpp"
"src/OutputPolygonComponent.cpp"
"src/InputListComponent.cpp")

target_include_directories(AgISOUniversalTerminal
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/include)

target_link_libraries(
AgISOUniversalTerminal
PRIVATE juce::juce_gui_extra isobus::Isobus isobus::HardwareIntegration
isobus::Utility
PUBLIC juce::juce_recommended_config_flags juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# AgIsoVirtualTerminal

This project is a free, but experimental ISO11783-6 (ISOBUS) virtual terminal server GUI meant for agricultural and forestry equipment.

The project is written in C++ and is based on AgIsoStack++ and the JUCE GUI framework.

This project is somewhat functional for a single VT client, but is still in the early stages of development, and as such is not fit for general consumption.

## Project Status

This section will be updated as progress is made on the project.

Supported features:

- All basic ISO11783 stuff, such as address claiming, TP, ETP, diagnostic protocol, etc.
- Exactly 1 VT client
- Object pool deserializer (most objects up to version 6 with some exceptions)
- Data masks
- Soft key masks
- Key objects
- Containers
- Object Pointers
- Input numbers
- Output numbers
- Output rectangles
- Output ellipse
- Output polygon
- Output line
- Output linear bar graph (except target line)
- Output arched bar graph (except tick marks and target line)
- Picture graphics (with and without run-length encoding)
- Output Strings (partial - font clipping is not compliant)
- Input lists (partial - drawing the selector needs work)
- Some CAN messages (Object pool upload state machine and handshake messages, change active mask response, change child location response, change numeric value and response, key/button activation and release messages, change numeric value, select input object)

Unimplemented features (for now)

- Alarm masks
- All audio functionality
- Selecting different working sets
- Window masks
- Aux N/O
- Most macro functionality
- Animations
- Output Lists
- Logging
- Input Boolean
- TAN
- Several messages, such as ESC
- Probably more things to be honest

## Compilation

This project is compiled with CMake and your favorite C++17 compiler.

Make sure you select your desired CAN driver as supported by AgIso Stack by defining the `CAN_DRIVER` variable.

Example:

```
cmake -S. -B build -DCAN_DRIVER=TouCAN
cmake --build build
```

### Disclaimers

This project is not associated with the AEF in any way. By acquiring or using this project you agree to the [JUCE License](https://github.com/juce-framework/JUCE/blob/master/LICENSE.md) as well as any applicable licenses provided by dependencies such as AgIsoStack.

It is claimed that compliance with ISO 11783 may involve the use of a patent concerning the controller area network (CAN) protocol referred to throughout this project and the ISO 11783/J1939 standards.

No contributor to this project takes any position concerning the evidence, validity, and scope of said patent.

Some elements of ISO 11783 and J1939 may be subject to patent rights other than the one identified above. No member of this project shall be held responsible for identifying any or all such patent rights.
9 changes: 9 additions & 0 deletions cmake/FindCAN_Stack.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if (NOT TARGET isobus::isobus)
include(FetchContent)
FetchContent_Declare(
CAN_Stack
GIT_REPOSITORY https://github.com/Open-Agriculture/AgIsoStack-plus-plus.git
GIT_TAG vt-server-managed-working-set
)
FetchContent_MakeAvailable(CAN_Stack)
endif()
9 changes: 9 additions & 0 deletions cmake/FindJUCE.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if (NOT TARGET JUCE::JUCE)
include(FetchContent)
FetchContent_Declare(
JUCE
GIT_REPOSITORY https://github.com/juce-framework/JUCE.git
GIT_TAG 7.0.8
)
FetchContent_MakeAvailable(JUCE)
endif()
34 changes: 34 additions & 0 deletions include/AlarmMaskComponent.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//================================================================================================
/// @file AlarmMaskComponent.hpp
///
/// @brief Defines a GUI component to draw a data mask.
/// @author Adrian Del Grosso
///
/// @copyright 2023 Adrian Del Grosso
//================================================================================================
#ifndef ALARM_MASK_COMPONENT_HPP
#define ALARM_MASK_COMPONENT_HPP

#include "isobus/isobus/isobus_virtual_terminal_objects.hpp"
#include "isobus/isobus/isobus_virtual_terminal_server_managed_working_set.hpp"

#include "JuceHeader.h"

class AlarmMaskComponent : public isobus::AlarmMask
, public Component
{
public:
AlarmMaskComponent(std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> workingSet, isobus::AlarmMask sourceObject);

void on_content_changed(bool initial = false);

void paint(Graphics &g) override;

private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;
std::vector<std::shared_ptr<Component>> childComponents;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AlarmMaskComponent);
};

#endif // ALARM_MASK_COMPONENT_HPP
Loading

0 comments on commit 3691efb

Please sign in to comment.