going to try grabbing the old CS implementation.
This commit is contained in:
parent
093e77bba4
commit
54d4fb0f73
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.If do
|
||||
@moduledoc """
|
||||
_if
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Calibrate do
|
||||
@moduledoc """
|
||||
calibrate
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.CheckUpdates do
|
||||
@moduledoc """
|
||||
check_updates
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.ConfigUpdate do
|
||||
@moduledoc """
|
||||
config_update
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Coordinate do
|
||||
@moduledoc """
|
||||
coordinate
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.DataUpdate do
|
||||
@moduledoc """
|
||||
data_update
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.EmergencyLock do
|
||||
@moduledoc """
|
||||
emergency_lock
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.EmergencyUnlock do
|
||||
@moduledoc """
|
||||
emergency_unlock
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,19 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Execute do
|
||||
@moduledoc """
|
||||
execute
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
# require IEx; IEx.pry
|
||||
res = Farmbot.HTTP.get!("/api/sequences/#{ast.args.sequence_id}") |> Map.get(:body) |> Poison.decode! |> Farmbot.CeleryScript.AST.parse
|
||||
{:ok, res}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.ExecuteScript do
|
||||
@moduledoc """
|
||||
execute_script
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Explanation do
|
||||
@moduledoc """
|
||||
explanation
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.FactoryReset do
|
||||
@moduledoc """
|
||||
factory_reset
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.FindHome do
|
||||
@moduledoc """
|
||||
find_home
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Home do
|
||||
@moduledoc """
|
||||
home
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.InstallFarmware do
|
||||
@moduledoc """
|
||||
install_farmware
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.InstallFirstPartyFarmware do
|
||||
@moduledoc """
|
||||
install_first_party_farmware
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.MoveAbsolute do
|
||||
@moduledoc """
|
||||
move_absolute
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.MoveRelative do
|
||||
@moduledoc """
|
||||
move_relative
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Nothing do
|
||||
@moduledoc """
|
||||
nothing
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Pair do
|
||||
@moduledoc """
|
||||
pair
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.PowerOff do
|
||||
@moduledoc """
|
||||
power_off
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.ReadAllParams do
|
||||
@moduledoc """
|
||||
read_all_params
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.ReadParam do
|
||||
@moduledoc """
|
||||
read_param
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.ReadPin do
|
||||
@moduledoc """
|
||||
read_pin
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.ReadStatus do
|
||||
@moduledoc """
|
||||
read_status
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Reboot do
|
||||
@moduledoc """
|
||||
reboot
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.RemoveFarmware do
|
||||
@moduledoc """
|
||||
remove_farmware
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule RPCError do
|
||||
@moduledoc """
|
||||
rpc_error
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule RPCOk do
|
||||
@moduledoc """
|
||||
rpc_ok
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule RPCRequest do
|
||||
@moduledoc """
|
||||
rpc_request
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.SendMessage do
|
||||
@moduledoc """
|
||||
send_message
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Sequence do
|
||||
@moduledoc """
|
||||
sequence
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.SetUserEnv do
|
||||
@moduledoc """
|
||||
set_user_env
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Sync do
|
||||
@moduledoc """
|
||||
sync
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.TakePhoto do
|
||||
@moduledoc """
|
||||
take_photo
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.TogglePin do
|
||||
@moduledoc """
|
||||
toggle_pin
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.UpdateFarmware do
|
||||
@moduledoc """
|
||||
update_farmware
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Wait do
|
||||
@moduledoc """
|
||||
wait
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.WritePin do
|
||||
@moduledoc """
|
||||
write_pin
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
defmodule Farmbot.CeleryScript.VirtualMachine.Instruction.Zero do
|
||||
@moduledoc """
|
||||
zero
|
||||
"""
|
||||
|
||||
alias Farmbot.CeleryScript.AST
|
||||
alias Farmbot.CeleryScript.VirtualMachine.Instruction
|
||||
@behaviour Instruction
|
||||
|
||||
def precompile(%AST{} = ast) do
|
||||
{:ok, ast}
|
||||
end
|
||||
|
||||
def execute(args, body) do
|
||||
|
||||
end
|
||||
end
|
|
@ -5,6 +5,24 @@ defmodule Farmbot.Farmware do
|
|||
* A `manifest.json` hosted on the internet somewhere.
|
||||
* A zip package of your farmware.
|
||||
|
||||
# Prerequisites
|
||||
While it is _technically_ possible to use any language to develop a Farmware,
|
||||
We currently only actively support Python (with a small set of dependencies.)
|
||||
|
||||
If you want another language/framework, you have a couple options.
|
||||
* Ask the Farmbot developers to enable a package.
|
||||
* Package the language/framework yourself. (very advanced)
|
||||
|
||||
## Should *I* develop a Farmware?
|
||||
Farmware is not always the correct solution. If you plan on developing a plugin,
|
||||
you should ask yourself a few questions.
|
||||
* Does my plugin need to be running 24/7 to work?
|
||||
* Does my plugin need a realtime interface?
|
||||
* Does my plugin need keyboard input?
|
||||
|
||||
If you answered Yes to any of those questions, you should consider, using an
|
||||
external plugin. See [a Python example](https://github.com/FarmBot-Labs/FarmBot-Python-Examples)
|
||||
|
||||
# Farmware Manifest
|
||||
The `manifest.json` file should contain a number of required fields.
|
||||
* `package` - the name of your package. Should be CamelCase by convention.
|
||||
|
@ -51,7 +69,7 @@ defmodule Farmbot.Farmware do
|
|||
* Raw Websockets - [Docs](Farmbot.BotState.Transport.HTTP.SocketHandler.html)
|
||||
* More difficult to work with.
|
||||
* Not exactly call/response.
|
||||
* No pollinig for state updates.
|
||||
* No polling for state updates.
|
||||
* Logs come in real time.
|
||||
|
||||
# Configuration
|
||||
|
@ -64,6 +82,8 @@ defmodule Farmbot.Farmware do
|
|||
There are two of default configuration's that can not be changed.
|
||||
* `$API_TOKEN` - An encoded binary that can be used to communicate with
|
||||
Farmbot and it's configured cloud server.
|
||||
* `$FARMWARE_URL` - The url to connect your HTTP client too to access Farmbot's REST API.
|
||||
*NOTE* This is *_NOT_* the same API as the cloud REST API.
|
||||
* `$IMAGES_DIR` - A local directory that will be scanned. Photos left in this
|
||||
directory will be uploaded and visable from the web app.
|
||||
|
||||
|
@ -81,7 +101,10 @@ defmodule Farmbot.Farmware do
|
|||
Farmware executes, it will have a key by the name of `$hello_farmware_first_config`
|
||||
that will have the value `100`.
|
||||
|
||||
Config values can however be overwrote by the Farmbot App.
|
||||
Config values can however be overwritten by the Farmbot App.
|
||||
|
||||
# More info
|
||||
See [Here](https://software.farmbot.io/v1.0/docs/farmware-dev) for more info.
|
||||
"""
|
||||
|
||||
defmodule Meta do
|
||||
|
|
|
@ -1,85 +1,6 @@
|
|||
defmodule GenMQTT do
|
||||
@moduledoc ~S"""
|
||||
A behaviour module for implementing MQTT client processes.
|
||||
|
||||
## Example
|
||||
|
||||
This example assumes an MQTT server running on localhost on port 1883.
|
||||
|
||||
defmodule TemperatureLogger do
|
||||
use GenMQTT
|
||||
|
||||
def start_link do
|
||||
GenMQTT.start_link(__MODULE__, nil)
|
||||
end
|
||||
|
||||
def on_connect(state) do
|
||||
:ok = GenMQTT.subscribe(self, "room/+/temp", 0)
|
||||
{:ok, state}
|
||||
end
|
||||
|
||||
def on_publish(["room", location, "temp"], message, state) do
|
||||
IO.puts "It is #{message} degrees in #{location}"
|
||||
{:ok, state}
|
||||
end
|
||||
end
|
||||
|
||||
This will log to the console every time a sensor posts a temperature
|
||||
to the broker.
|
||||
|
||||
## Callbacks
|
||||
|
||||
GenMQTT defines 12 callbacks, all of them are automatically defined
|
||||
when you use GenMQTT in your module, letting you define the callbacks
|
||||
you want to customize. Six of the callbacks are similar to the ones
|
||||
you know from GenServer, and the GenServer documentation should be
|
||||
consulted for info on these. They are: `init/1`, `handle_call/3`,
|
||||
`handle_cast/2`, `handle_info/2`, `terminate/2`, and `code_change/3`.
|
||||
|
||||
The remaining six are specific to GenMQTT and deal with various
|
||||
events in a MQTT life cycle:
|
||||
|
||||
* `on_connect/1` is run when the client connects or reconnects with
|
||||
the broker.
|
||||
|
||||
* `on_connect_error/2` is triggered if the connection fails for
|
||||
whatever reason.
|
||||
|
||||
* `on_disconnect/1` is run when the client disconnects from the MQTT
|
||||
broker.
|
||||
|
||||
* `on_subscribe/2` run when the client subscribes to a topic.
|
||||
|
||||
* `on_unsubscribe/2` run when the client stops subscribing to a
|
||||
topic.
|
||||
|
||||
* `on_publish/3` triggered everytime something is published to the
|
||||
broker.
|
||||
|
||||
All callbacks are optional. A macro will define a default function for
|
||||
undefined callbacks, so you only need to implement `on_publish/3` if
|
||||
that is what you need.
|
||||
|
||||
## Name Registration
|
||||
|
||||
A GenMQTT is bound to the same name registration rules as GenServers.
|
||||
Read more about it in the Elixir `GenServer` docs.
|
||||
"""
|
||||
|
||||
# gen_server ---------------------------------------------------------
|
||||
@doc """
|
||||
Invoked when the server is started. `start_link/3` and `start/3` will
|
||||
block until it returns. `state` is the second term passed into either
|
||||
of the two start functions.
|
||||
|
||||
When this function returns `{:ok, state}` it will enter its loop and
|
||||
will start receiving messages from the broker, or send messages to it
|
||||
as soon as it has entered the connected state.
|
||||
|
||||
Returning `{:stop, reason}` will cause the start function to return
|
||||
`{:error, reason}`, and the process will exit with `reason` without
|
||||
entering its loop or calling `terminate/2`.
|
||||
"""
|
||||
@moduledoc false
|
||||
|
||||
@callback init(state) ::
|
||||
{:ok, state} |
|
||||
{:ok, state, timeout | :hibernate} |
|
||||
|
|
33
mix.exs
33
mix.exs
|
@ -52,15 +52,7 @@ defmodule Farmbot.Mixfile do
|
|||
],
|
||||
source_url: "https://github.com/Farmbot/farmbot_os",
|
||||
homepage_url: "http://farmbot.io",
|
||||
docs: [
|
||||
main: "Farmbot",
|
||||
logo: "priv/static/farmbot_logo.png",
|
||||
extras: [
|
||||
"docs/BUILDING.md",
|
||||
"docs/FAQ.md",
|
||||
"README.md"
|
||||
]
|
||||
]
|
||||
docs: docs()
|
||||
]
|
||||
end
|
||||
|
||||
|
@ -68,6 +60,20 @@ defmodule Farmbot.Mixfile do
|
|||
[mod: {Farmbot, []}, extra_applications: [:logger, :eex, :ssl, :inets]]
|
||||
end
|
||||
|
||||
defp docs do
|
||||
[
|
||||
main: "Farmbot",
|
||||
logo: "priv/static/farmbot_logo.png",
|
||||
source_ref: commit(),
|
||||
extras: [
|
||||
"docs/BUILDING.md",
|
||||
"docs/FAQ.md",
|
||||
"README.md"
|
||||
],
|
||||
# groups_for_modules: generate_doc_mods()
|
||||
]
|
||||
end
|
||||
|
||||
defp deps do
|
||||
[
|
||||
{:nerves, "~> 0.7.5", runtime: false},
|
||||
|
@ -95,7 +101,8 @@ defmodule Farmbot.Mixfile do
|
|||
defp deps("host") do
|
||||
[
|
||||
{:credo, "~> 0.8", only: [:dev, :test], runtime: false},
|
||||
{:ex_doc, "~> 0.14", only: :dev},
|
||||
{:ex_doc, "~> 0.17", only: :dev},
|
||||
{:inch_ex, ">= 0.0.0", only: :dev},
|
||||
{:excoveralls, "~> 0.6", only: :test},
|
||||
{:mock, "~> 0.2.0", only: :test},
|
||||
]
|
||||
|
@ -126,9 +133,9 @@ defmodule Farmbot.Mixfile do
|
|||
|
||||
defp package do
|
||||
[
|
||||
name: "Farmbot OS",
|
||||
maintainers: "Farmbot.io",
|
||||
licenses: "MIT",
|
||||
name: "farmbot",
|
||||
maintainers: ["Farmbot.io"],
|
||||
licenses: ["MIT"],
|
||||
links: %{"github" => "https://github.com/farmbot/farmbot_os"},
|
||||
]
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"ecto": {:hex, :ecto, "2.2.3", "b1896b129db30d54073bedd5f3ba8a99dd6d64ebae3cf59057ae287060b46905", [], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
|
||||
"elixir_make": {:hex, :elixir_make, "0.4.0", "992f38fabe705bb45821a728f20914c554b276838433349d4f2341f7a687cddf", [], [], "hexpm"},
|
||||
"esqlite": {:hex, :esqlite, "0.2.3", "1a8b60877fdd3d50a8a84b342db04032c0231cc27ecff4ddd0d934485d4c0cd5", [], [], "hexpm"},
|
||||
"ex_doc": {:hex, :ex_doc, "0.16.3", "cd2a4cfe5d26e37502d3ec776702c72efa1adfa24ed9ce723bb565f4c30bd31a", [], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"ex_doc": {:hex, :ex_doc, "0.17.1", "39f777415e769992e6732d9589dc5846ea587f01412241f4a774664c746affbb", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"ex_json_schema": {:hex, :ex_json_schema, "0.5.5", "d8d4c3f47b86c9e634e124d518b290dda82a8b94dcc314e45af10042fc369361", [], [], "hexpm"},
|
||||
"excoveralls": {:hex, :excoveralls, "0.7.2", "f69ede8c122ccd3b60afc775348a53fc8c39fe4278aee2f538f0d81cc5e7ff3a", [], [{:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: false]}, {:hackney, ">= 0.12.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"exjsx": {:hex, :exjsx, "4.0.0", "60548841e0212df401e38e63c0078ec57b33e7ea49b032c796ccad8cde794b5c", [], [{:jsx, "~> 2.8.0", [hex: :jsx, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
|
@ -24,6 +24,7 @@
|
|||
"hackney": {:hex, :hackney, "1.10.1", "c38d0ca52ea80254936a32c45bb7eb414e7a96a521b4ce76d00a69753b157f21", [:rebar3], [{:certifi, "2.0.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"httpoison": {:hex, :httpoison, "0.13.0", "bfaf44d9f133a6599886720f3937a7699466d23bb0cd7a88b6ba011f53c6f562", [], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"inch_ex": {:hex, :inch_ex, "0.5.6", "418357418a553baa6d04eccd1b44171936817db61f4c0840112b420b8e378e67", [], [{:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"joken": {:hex, :joken, "1.5.0", "42a0953e80bd933fc98a0874e156771f78bf0e92abe6c3a9c22feb6da28efb0b", [], [{:jose, "~> 1.8", [hex: :jose, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}, {:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm"},
|
||||
"jose": {:hex, :jose, "1.8.4", "7946d1e5c03a76ac9ef42a6e6a20001d35987afd68c2107bcd8f01a84e75aa73", [], [{:base64url, "~> 0.0.1", [hex: :base64url, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"jsx": {:hex, :jsx, "2.8.2", "7acc7d785b5abe8a6e9adbde926a24e481f29956dd8b4df49e3e4e7bcc92a018", [], [], "hexpm"},
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
defmodule SocketHandler do
|
||||
require Logger
|
||||
|
||||
@timeout 60_000
|
||||
|
||||
@behaviour :cowboy_websocket_handler
|
||||
|
||||
def init(_, _req, _opts), do: {:upgrade, :protocol, :cowboy_websocket}
|
||||
|
||||
def websocket_init(_type, req, _options) do
|
||||
Logger.info "Encountered a new local websocket connection."
|
||||
{:ok, req, nil, @timeout}
|
||||
end
|
||||
|
||||
def websocket_handle({:text, data}, req, state), do: {:reply, data, req, state}
|
||||
|
||||
def websocket_info(_, req, state) do
|
||||
{:ok, req, state}
|
||||
# {:reply, {:text, @ping}, req, stage}
|
||||
end
|
||||
|
||||
|
||||
def websocket_terminate(_reason, _req, _stage) do
|
||||
Logger.info "Closing a websocket connection."
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue