This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule FarmbotOS.Platform.Target.NervesHubClient do | |
@moduledoc """ | |
NervesHub.Client implementation. | |
This should be one of the very first processes to be started. | |
Because it is started so early, it has to check for things that | |
might not be available in the environment. Environment is checked | |
in this order: | |
* token | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defimpl FarmbotCore.AssetWorker, for: FarmbotCore.Asset.FbosConfig do | |
@moduledoc """ | |
This asset worker does not get restarted. It inistead responds to GenServer | |
calls. | |
""" | |
use GenServer | |
require Logger | |
require FarmbotCore.Logger | |
alias FarmbotCeleryScript.AST |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule FarmbotCeleryScript.Compiler do | |
@moduledoc """ | |
Responsible for compiling canonical CeleryScript AST into | |
Elixir AST. | |
""" | |
require Logger | |
alias FarmbotCeleryScript.{ | |
AST, | |
Compiler, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule FarmbotCore.Asset.Sync do | |
@moduledoc """ | |
""" | |
use FarmbotCore.Asset.Schema, path: "/api/device/sync" | |
defmodule Item do | |
@moduledoc false | |
use Ecto.Schema |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule FarmbotOS.Platform.Target.Leds.CircuitsHandler do | |
alias Circuits.GPIO | |
use GenServer | |
@behaviour FarmbotCore.Leds.Handler | |
alias FarmbotCore.Leds.StubHandler | |
@slow_blink_speed 1000 | |
@fast_blink_speed 100 | |
# @valid_status [:off, :solid, :slow_blink, :fast_blink] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule FarmbotCore.BotState do | |
@moduledoc "Central State accumulator." | |
alias FarmbotCore.BotStateNG | |
require FarmbotCore.Logger | |
use GenServer | |
@doc "Subscribe to BotState changes" | |
def subscribe(bot_state_server \\ __MODULE__) do | |
GenServer.call(bot_state_server, :subscribe) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule FarmbotFirmware.Command do | |
@moduledoc false | |
alias FarmbotFirmware | |
alias FarmbotFirmware.GCODE | |
@spec command(GenServer.server(), GCODE.t() | {GCODE.kind(), GCODE.args()}) :: | |
:ok | {:error, :invalid_command | :firmware_error | :emergency_lock | FarmbotFirmware.status()} | |
def command(firmware_server \\ FarmbotFirmware, code) | |
def command(firmware_server, {_tag, {_, _}} = code) do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule FarmbotFirmware.Command do | |
@moduledoc false | |
alias Farmbot.{Firmware, Firmware.GCODE} | |
@spec command(GenServer.server(), GCODE.t() | {GCODE.kind(), GCODE.args()}) :: | |
:ok | {:error, :invalid_command | :firmware_error | :emergency_lock | Firmware.status()} | |
def command(firmware_server \\ Firmware, code) | |
def command(firmware_server, {_tag, {_, _}} = code) do | |
case GenServer.call(firmware_server, code, :infinity) do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule FarmbotFirmware do | |
@moduledoc """ | |
Firmware wrapper for interacting with Farmbot-Arduino-Firmware. | |
This GenServer is expected to be a pretty simple state machine | |
with no side effects to anything in the rest of the Farmbot application. | |
Side effects should be implemented using a callback/pubsub system. This | |
allows for indpendent testing. | |
Functionality that is needed to boot the firmware: | |
* parameters - Keyword list of {param_atom, float} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule FarmbotExt.AMQP.CeleryScriptChannel do | |
@moduledoc """ | |
Handles inbound CeleryScript RPCs (from user via AMQP/MQTT). | |
""" | |
use GenServer | |
use AMQP | |
alias FarmbotCore.JSON | |
require FarmbotCore.Logger |