Skip to content
okebkal edited this page Apr 4, 2016 · 10 revisions

MODULE

role_at

MODULE SUMMARY

Implements EvoLogics acoustic modem AT/NET middle men as a role_worker behaviour

DESCRIPTION

DATA TYPES

  cfg() = any()

  cfg_command() = 
    {filter, at|net} | 
    {mode, command|data} |
    {waitsync, no|singleline|multiline|binary} |
    {eol, string()} |
    {ext_networking, yes|no} |
    {pid, integer() >= 0} 

  at_reply() =
    {sync, Request :: string(), Sync :: sync()} |
    {async, {pid, Pid :: integer() >= 0}, Recv :: recv()} |
    {async, Async :: async()}

  sync() =
    "string" |
    {noise, integer(),integer(),integer(),integer(),binary()} |
    {error, Reason :: string()} |
    {busy, Busy :: string()}

  async() =
    {recvstart} | 
    {recvend,integer(),integer(),integer(),integer()} | 
    {recvfailed,float(),integer(),integer()} |
    {sendstart,integer(),string(),integer(),integer()} | 
    {sendend,integer(),string(),integer(),integer()} | 
    {phyoff} |
    {phyon} |
    {usbllong,float(),float(),integer(),float(),float(),float(),
              float(),float(),float(),float(),float(),float(),
              integer(),integer(),integer(),float()} |
    {usblangles,float(),float(),integer(),float(),float(),float(),
              float(),float(),float(),float(),integer(),integer(),float()} |
    {usblphyd,float(),float(),integer(),integer(),integer(),integer(),
              integer(),integer(),integer(),integer(),integer(),integer()} |
    {usblphyp,float(),float(),integer(),integer(),float(),float(),float(),
            float(),float(),float(),float(),float(),float(),float(),float(),
            float(),float(),float(),float(),float(),float(),float()}

  recv() = 
    {recv,integer(),integer(),integer(),
          integer(),integer(),integer(),integer(),float(),binary()} | 
    {reclaim,integer(),integer(),integer(),
             flag(),integer(),integer(),integer(),float(),binary()} |
    {recvims,integer(),integer(),integer(),
             integer(),integer(),integer(),integer(),float(),binary()} |
    {recvpbm,integer(),integer(),integer(),
             integer(),integer(),integer(),float(),binary()}

  flag() = ack | noack | force
 
  at_request() = 
    {raw, Data :: binary} |
    {at, {pid, Pid :: integer()},
         "*SEND", Dst :: integer(), Data :: binary()} |
    {at, "*SEND", Dst :: integer(), Data:: binary()} |
    {at, {pid, Pid :: integer()},
        "*SENDIM", Dst :: integer(), flag(), Data :: binary()} |
    {at,"*SENDIM", Dst :: integer(), flag(), Data :: binary()} |
    {at, {pid, Pid :: integer()},
        "*SENDIMS",Dst :: integer(), Usec :: integer(), Data :: binary()} |
    {at,"*SENDIMS",Dst :: integer(), Usec :: integer(), Data :: binary()} |
    {at, {pid, Pid :: integer()},
        "*SENDPBM", Dst :: integer(), Data :: binary()} |
    {at,"*SENDPBM", Dst :: integer(), Data :: binary()} |
    {at, Req :: string(), Params :: string()}

  error() = {error, Reason :: any()}

EXPORTS

start(Role_ID, Mod_ID, MM) -> Result

Types

 RoleID = atom
 ModID = atom
 MiddleMen = mm()
 Result = {ok,pid()} | ignore | {error,any()}
stop(Cfg) -> ok

Types

  Cfg = cfg()
to_term(Module, Tail, Chunk, Cfg) -> Result

Types

  Module = atom
  Tail = binary()
  Chunk = binary()
  Cfg = cfg()
  Result = [[at_reply()], [error()], Raw :: binary(), More :: binary(), cfg()];
from_term(Term, Cfg) -> Result

Types

  Term = at_request()
  Cfg = cfg()
  Result = [binary(), cfg()]
ctrl(Ctlr, Cfg) -> Result

Types

  Ctrl = cfg_command()
  Cfg = cfg()
  Result = cfg()