Skip to content

Commit

Permalink
Updated CMake to allow building on Linux, tackled some GCC warnings
Browse files Browse the repository at this point in the history
Also added an application icon.
  • Loading branch information
ad3154 committed Nov 19, 2023
1 parent 55f5213 commit 73ef491
Show file tree
Hide file tree
Showing 35 changed files with 75 additions and 44 deletions.
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ project(

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

set(JUCE_WEB_BROWSER OFF)

find_package(JUCE MODULE)
find_package(CAN_Stack MODULE)
find_package(Threads REQUIRED)
Expand All @@ -16,13 +18,22 @@ find_package(Threads REQUIRED)

juce_add_gui_app(
AgISOVirtualTerminal
# ICON_BIG ... # ICON_* arguments specify a path to an
ICON_BIG smallLogo.png
# image file to use as an icon ICON_SMALL ...
COMPANY_NAME
"Open-Agriculture"
PRODUCT_NAME
NEEDS_CURL FALSE
NEEDS_WEB_BROWSER FALSE
DESCRIPTION "An ISO11783-6 Server"
"AgISOVirtualTerminal")

set_target_properties(AgISOVirtualTerminal PROPERTIES CXX_STANDARD 17)

target_compile_definitions(AgISOVirtualTerminal PRIVATE
JUCE_USE_CURL=0
JUCE_WEB_BROWSER=0)

juce_generate_juce_header(AgISOVirtualTerminal)

target_sources(
Expand Down Expand Up @@ -64,5 +75,4 @@ target_link_libraries(
AgISOVirtualTerminal
PRIVATE juce::juce_gui_extra juce::juce_audio_basics juce::juce_audio_utils isobus::Isobus isobus::HardwareIntegration
isobus::Utility
PUBLIC juce::juce_recommended_config_flags juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)
PUBLIC juce::juce_recommended_config_flags juce::juce_recommended_lto_flags)
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ 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
- Alarm masks
Expand All @@ -36,12 +35,13 @@ Supported features:
- Input lists (partial - drawing the selector needs work)
- Most relevant VT server CAN messages
- Logging
- Multiple simultaneous VT clients
- Selecting different working sets

Unimplemented features (for now)

- Arbitrary audio control functionality
- Selecting different working sets
- Window masks
- Window masks (tolerated in the object pool though)
- Aux N/O
- Most macro functionality
- Animations
Expand All @@ -57,6 +57,21 @@ Unimplemented features (for now)

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

CMake 3.22 or higher is required.

### Dependencies

Linux:
```
sudo apt install git cmake pkg-config libfreetype-dev libfreetype6 libfreetype6-dev libasound2-dev libcurl4-openssl-dev libgtk-3-dev libwebkit2gtk-4.0-dev webkit2gtk-4.0
```

Windows:

On Windows, you will need to install Visual Studio to get the MSVC compiler and CMake. The easiest way to do that would be to install [Visual Studio Community](https://visualstudio.microsoft.com/vs/community/) and select the "Desktop development with C++" workload.

### Building

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

Example:
Expand Down
2 changes: 1 addition & 1 deletion include/AlarmMaskComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AlarmMaskComponent : public isobus::AlarmMask
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;
std::vector<std::shared_ptr<Component>> childComponents;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AlarmMaskComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AlarmMaskComponent)
};

#endif // ALARM_MASK_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/ButtonComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ButtonComponent : public isobus::Button
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;
std::vector<std::shared_ptr<Component>> childComponents;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ButtonComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ButtonComponent)
};

#endif // BUTTON_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/ColourMapComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ColourMapComponent : public isobus::ColourMap
private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ColourMapComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ColourMapComponent)
};

#endif // COLOR_MAP_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/ContainerComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ContainerComponent : public isobus::Container
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;
std::vector<std::shared_ptr<Component>> childComponents;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ContainerComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ContainerComponent)
};

#endif // CONTAINER_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/DataMaskComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DataMaskComponent : public isobus::DataMask
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;
std::vector<std::shared_ptr<Component>> childComponents;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DataMaskComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DataMaskComponent)
};

#endif // DATA_MASK_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/DataMaskRenderAreaComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DataMaskRenderAreaComponent : public Component
InputNumberListener inputNumberListener;
bool needToRepaintActiveArea = false;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DataMaskRenderAreaComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DataMaskRenderAreaComponent)
};

#endif // DATA_MASK_RENDER_AREA_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/InputListComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class InputListComponent : public isobus::InputList
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;
std::shared_ptr<Component> childComponent;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(InputListComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(InputListComponent)
};

#endif // INPUT_LIST_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/InputNumberComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class InputNumberComponent : public isobus::InputNumber
private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(InputNumberComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(InputNumberComponent)
};

#endif // INPUT_NUMBER_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/KeyComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class KeyComponent : public isobus::Key
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;
std::vector<std::shared_ptr<Component>> childComponents;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(KeyComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(KeyComponent)
};

#endif // KEY_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/LoggerComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LoggerComponent : public Component
static constexpr std::size_t MAX_NUMBER_MESSAGES = 3000;
std::deque<LogData> loggedMessages;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LoggerComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LoggerComponent)
};

#endif // LOGGER_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/ObjectPointerComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ObjectPointerComponent : public isobus::ObjectPointer
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;
std::shared_ptr<Component> childComponent;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ObjectPointerComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ObjectPointerComponent)
};

#endif // OBJECT_POINTER_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/OutputEllipseComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OutputEllipseComponent : public isobus::OutputEllipse
private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputEllipseComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputEllipseComponent)
};

#endif // OUTPUT_ELLIPSE_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/OutputLineComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OutputLineComponent : public isobus::OutputLine
private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputLineComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputLineComponent)
};

#endif // OUTPUT_LINE_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/OutputLinearBarGraphComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OutputLinearBarGraphComponent : public isobus::OutputLinearBarGraph
private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputLinearBarGraphComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputLinearBarGraphComponent)
};

#endif // OUTPUT_LINEAR_BAR_GRAPH_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/OutputMeterComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OutputMeterComponent : public isobus::OutputMeter
private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputMeterComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputMeterComponent)
};

#endif // OUTPUT_METER_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/OutputNumberComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class OutputNumberComponent : public isobus::OutputNumber
private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputNumberComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputNumberComponent)
};

#endif // OUTPUT_NUMBER_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/OutputPolygonComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OutputPolygonComponent : public isobus::OutputPolygon
private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputPolygonComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputPolygonComponent)
};

#endif // OUTPUT_POLYGON_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/OutputRectangleComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class OutputRectangleComponent : public isobus::OutputRectangle
private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputRectangleComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputRectangleComponent)
};

#endif // OUTPUT_RECTANGLE_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/OutputStringComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class OutputStringComponent : public isobus::OutputString
private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputStringComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OutputStringComponent)
};

#endif // OUTPUT_STRING_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/PictureGraphicComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PictureGraphicComponent : public isobus::PictureGraphic
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;
Image reconstructedImage;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PictureGraphicComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PictureGraphicComponent)
};

#endif // PICTURE_GRAPHIC_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/SoftKeyMaskComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SoftKeyMaskComponent : public isobus::SoftKeyMask
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;
std::vector<std::shared_ptr<Component>> childComponents;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SoftKeyMaskComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SoftKeyMaskComponent)
};

#endif // SOFT_KEY_MASK_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/SoftKeyMaskRenderAreaComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SoftKeyMaskRenderAreaComponent : public Component
std::vector<std::shared_ptr<Component>> childComponents;
ServerMainComponent &ownerServer;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SoftKeyMaskRenderAreaComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SoftKeyMaskRenderAreaComponent)
};

#endif // SOFT_KEY_MASK_RENDER_AREA_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/WorkingSetComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class WorkingSetComponent : public isobus::WorkingSet
private:
std::shared_ptr<isobus::VirtualTerminalServerManagedWorkingSet> parentWorkingSet;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(WorkingSetComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(WorkingSetComponent)
};

#endif // WORKING_SET_COMPONENT_HPP
2 changes: 1 addition & 1 deletion include/WorkingSetSelectorComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class WorkingSetSelectorComponent : public Component
std::vector<SELECTOR_CHILD_OBJECTS_STRUCT> children;
ServerMainComponent &parentServer;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(WorkingSetSelectorComponent);
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(WorkingSetSelectorComponent)
};

#endif // WORKING_SET_SELECTOR_COMPONENT_HPP
Binary file added smallLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/DataMaskRenderAreaComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ void DataMaskRenderAreaComponent::mouseUp(const MouseEvent &event)
}
inputListModal->addButton("OK", 0);
auto resultCallback = [this, clickedList](int result) {
auto combo = inputListModal->getComboBoxComponent("Input List Combo");
result = combo->getSelectedItemIndex();
auto inputCombo = inputListModal->getComboBoxComponent("Input List Combo");
result = inputCombo->getSelectedItemIndex();

// Remap the visible index to the actual index
std::uint16_t numberOfNonNullsSeen = 0;
Expand Down
3 changes: 3 additions & 0 deletions src/InputNumberComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Justification InputNumberComponent::convert_justification(HorizontalJustificatio
}
break;

case VerticalJustification::Reserved:
default:
break;
}
Expand Down Expand Up @@ -121,6 +122,7 @@ Justification InputNumberComponent::convert_justification(HorizontalJustificatio
}
break;

case VerticalJustification::Reserved:
default:
break;
}
Expand Down Expand Up @@ -149,6 +151,7 @@ Justification InputNumberComponent::convert_justification(HorizontalJustificatio
}
break;

case VerticalJustification::Reserved:
default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/LoggerComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void LoggerComponent::paint(Graphics &g)

int numberOfLinesFitted = getHeight() / 14;

for (std::size_t i = 0; i < loggedMessages.size() && i < numberOfLinesFitted; i++)
for (std::size_t i = 0; i < static_cast<int>(loggedMessages.size()) && i < numberOfLinesFitted; i++)
{
const auto &message = loggedMessages.at(i);

Expand Down
5 changes: 0 additions & 5 deletions src/OutputMeterComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ void OutputMeterComponent::paint(Graphics &g)
}
auto vtColour = colourTable.get_colour(get_needle_colour());
Path needlePath;
float xCoord = 0.0f;
float yCoord = 0.0f;
float endVtAngleDeg = get_end_angle() * 2.0f;
float startVtAngleDeg = get_start_angle() * 2.0f;

Expand All @@ -86,9 +84,6 @@ void OutputMeterComponent::paint(Graphics &g)
float xOffset = (get_width() / 2.0f) * std::cos(needleEndAngle * 3.14159265f / 180.0f);
float yOffset = -(get_width() / 2.0f) * std::sin(needleEndAngle * 3.14159265f / 180.0f);

xCoord = (get_width() / 2.0f) + xOffset;
yCoord = (get_width() / 2.0f) + yOffset;

g.setColour(Colour::fromFloatRGBA(vtColour.r, vtColour.g, vtColour.b, 1.0f));
g.drawLine((get_width() / 2.0f) + xOffset, (get_width() / 2.0f) + yOffset, get_width() / 2.0f, get_height() / 2.0f, 3.0f);

Expand Down
1 change: 1 addition & 0 deletions src/OutputRectangleComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void OutputRectangleComponent::paint(Graphics &g)
}
break;

case isobus::FillAttributes::FillType::NoFill:
default:
{
// No fill
Expand Down
3 changes: 3 additions & 0 deletions src/OutputStringComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Justification OutputStringComponent::convert_justification(HorizontalJustificati
}
break;

case VerticalJustification::Reserved:
default:
break;
}
Expand Down Expand Up @@ -142,6 +143,7 @@ Justification OutputStringComponent::convert_justification(HorizontalJustificati
}
break;

case VerticalJustification::Reserved:
default:
break;
}
Expand Down Expand Up @@ -170,6 +172,7 @@ Justification OutputStringComponent::convert_justification(HorizontalJustificati
}
break;

case VerticalJustification::Reserved:
default:
break;
}
Expand Down
Loading

0 comments on commit 73ef491

Please sign in to comment.