note-python/docs/api.md at main · blues/note-python · GitHub
Skip to content

Latest commit

 

History

History
662 lines (394 loc) · 26.9 KB

File metadata and controls

662 lines (394 loc) · 26.9 KB

Summary

Members Descriptions
namespace notecard::card
namespace notecard::env
namespace notecard::file
namespace notecard::hub
namespace notecard::note
namespace notecard::notecard
namespace notecard::validators

namespace notecard::card

Summary

Members Descriptions
public def attn(card,mode,files,seconds,payload,start) Configure interrupt detection between a host and Notecard.
public def time(card) Retrieve the current time and date from the Notecard.
public def status(card) Retrieve the status of the Notecard.
public def temp(card,minutes) Retrieve the current temperature from the Notecard.
public def version(card) Retrieve firmware version information from the Notecard.
public def voltage(card,hours,offset,vmax,vmin) Retrieve current and historical voltage info from the Notecard.
public def wireless(card,mode,apn) Retrieve wireless modem info or customize modem behavior.

Members

public def attn(card,mode,files,seconds,payload,start)

Configure interrupt detection between a host and Notecard.

Parameters

  • card The current Notecard object.

  • mode The attn mode to set.

  • files A collection of notefiles to watch.

  • seconds A timeout to use when arming attn mode.

  • payload When using sleep mode, a payload of data from the host that the Notecard should hold in memory until retrieved by the host.

  • start When using sleep mode and the host has reawakened, request the Notecard to return the stored payload.

Returns

Returns

string The result of the Notecard request.

public def time(card)

Retrieve the current time and date from the Notecard.

Parameters

  • card The current Notecard object.

Returns

Returns

string The result of the Notecard request.

public def status(card)

Retrieve the status of the Notecard.

Parameters

  • card The current Notecard object.

Returns

Returns

string The result of the Notecard request.

public def temp(card,minutes)

Retrieve the current temperature from the Notecard.

Parameters

  • card The current Notecard object.

  • minutes If specified, creates a templated _temp.qo file that gathers Notecard temperature value at the specified interval.

Returns

Returns

string The result of the Notecard request.

public def version(card)

Retrieve firmware version information from the Notecard.

Parameters

  • card The current Notecard object.

Returns

Returns

string The result of the Notecard request.

public def voltage(card,hours,offset,vmax,vmin)

Retrieve current and historical voltage info from the Notecard.

Parameters

  • card The current Notecard object.

  • hours Number of hours to analyze.

  • offset Number of hours to offset.

  • vmax max voltage level to report.

  • vmin min voltage level to report.

Returns

Returns

string The result of the Notecard request.

public def wireless(card,mode,apn)

Retrieve wireless modem info or customize modem behavior.

Parameters

  • card The current Notecard object.

  • mode The wireless module mode to set.

  • apn Access Point Name (APN) when using an external SIM.

Returns

Returns

string The result of the Notecard request.

namespace notecard::env

Summary

Members Descriptions
public def default(card,name,text) Perform an env.default request against a Notecard.
public def get(card,name) Perform an env.get request against a Notecard.
public def modified(card) Perform an env.modified request against a Notecard.
public def set(card,name,text) Perform an env.set request against a Notecard.

Members

public def default(card,name,text)

Perform an env.default request against a Notecard.

Parameters

  • card The current Notecard object.

  • name The name of an environment var to set a default for.

  • text The default value. Omit to delete the default.

Returns

Returns

string The result of the Notecard request.

public def get(card,name)

Perform an env.get request against a Notecard.

Parameters

  • card The current Notecard object.

  • name The name of an environment variable to get.

Returns

Returns

string The result of the Notecard request.

public def modified(card)

Perform an env.modified request against a Notecard.

Parameters

  • card The current Notecard object.

Returns

Returns

string The result of the Notecard request.

public def set(card,name,text)

Perform an env.set request against a Notecard.

Parameters

  • card The current Notecard object.

  • name The name of an environment variable to set.

  • text The variable value. Omit to delete.

Returns

Returns

string The result of the Notecard request.

namespace notecard::file

Summary

Members Descriptions
public def changes(card,tracker,files) Perform individual or batch queries on Notefiles.
public def delete(card,files) Delete individual notefiles and their contents.
public def stats(card) Obtain statistics about local notefiles.
public def pendingChanges(card) Retrieve information about pending Notehub changes.

Members

public def changes(card,tracker,files)

Perform individual or batch queries on Notefiles.

Parameters

  • card The current Notecard object.

  • tracker A developer-defined tracker ID.

  • files A list of Notefiles to retrieve changes for.

Returns

Returns

string The result of the Notecard request.

public def delete(card,files)

Delete individual notefiles and their contents.

Parameters

  • card The current Notecard object.

  • files A list of Notefiles to delete.

Returns

Returns

string The result of the Notecard request.

public def stats(card)

Obtain statistics about local notefiles.

Parameters

  • card The current Notecard object.

Returns

Returns

string The result of the Notecard request.

public def pendingChanges(card)

Retrieve information about pending Notehub changes.

Parameters

  • card The current Notecard object.

Returns

Returns

string The result of the Notecard request.

namespace notecard::hub

Summary

Members Descriptions
public def set(card,product,sn,mode,outbound,inbound,duration,sync,align,voutbound,vinbound,host) Configure Notehub behavior on the Notecard.
public def sync(card) Initiate a sync of the Notecard to Notehub.
public def syncStatus(card,sync) Retrieve the status of a sync request.
public def status(card) Retrieve the status of the Notecard's connection.
public def log(card,text,alert,sync) Send a log request to the Notecard.
public def get(card) Retrieve the current Notehub configuration parameters.

Members

public def set(card,product,sn,mode,outbound,inbound,duration,sync,align,voutbound,vinbound,host)

Configure Notehub behavior on the Notecard.

Parameters

  • card The current Notecard object.

  • product The ProductUID of the project.

  • sn The Serial Number of the device.

  • mode The sync mode to use.

  • outbound Max time to wait to sync outgoing data.

  • inbound Max time to wait to sync incoming data.

  • duration If in continuous mode, the amount of time, in minutes, of each session.

  • sync If in continuous mode, whether to automatically sync each time a change is detected on the device or Notehub.

  • align To align syncs to a regular time-interval, as opposed to using max time values.

  • voutbound Overrides "outbound" with a voltage-variable value.

  • vinbound Overrides "inbound" with a voltage-variable value.

  • host URL of an alternative or private Notehub instance.

Returns

Returns

string The result of the Notecard request.

public def sync(card)

Initiate a sync of the Notecard to Notehub.

Parameters

  • card The current Notecard object.

Returns

Returns

string The result of the Notecard request.

public def syncStatus(card,sync)

Retrieve the status of a sync request.

Parameters

  • card The current Notecard object.

  • sync True if sync should be auto-initiated pending outbound data.

Returns

Returns

string The result of the Notecard request.

public def status(card)

Retrieve the status of the Notecard's connection.

Parameters

  • card The current Notecard object.

Returns

Returns

string The result of the Notecard request.

public def log(card,text,alert,sync)

Send a log request to the Notecard.

Parameters

  • card The current Notecard object.

  • text The ProductUID of the project.

  • alert True if the message is urgent.

  • sync Whether to sync right away.

Returns

Returns

string The result of the Notecard request.

public def get(card)

Retrieve the current Notehub configuration parameters.

Parameters

  • card The current Notecard object.

Returns

Returns

string The result of the Notecard request.

namespace notecard::note

Summary

Members Descriptions
public def changes(card,file,tracker,maximum,start,stop,deleted,delete) Incrementally retrieve changes within a Notefile.
public def get(card,file,note_id,delete,deleted) Retrieve a note from an inbound or DB Notefile.
public def delete(card,file,note_id) Delete a DB note in a Notefile by its ID.
public def update(card,file,note_id,body,payload) Update a note in a DB Notefile by ID.
public def template(card,file,body,length) Create a template for new Notes in a Notefile.

Members

public def changes(card,file,tracker,maximum,start,stop,deleted,delete)

Incrementally retrieve changes within a Notefile.

Parameters

  • card The current Notecard object.

  • file The name of the file.

  • tracker A developer-defined tracker ID.

  • maximum Maximum number of notes to return.

  • start Should tracker be reset to the beginning before a get.

  • stop Should tracker be deleted after get.

  • deleted Should deleted notes be returned.

  • delete Should notes in a response be auto-deleted.

Returns

Returns

string The result of the Notecard request.

public def get(card,file,note_id,delete,deleted)

Retrieve a note from an inbound or DB Notefile.

Parameters

  • card The current Notecard object.

  • file The inbound or DB notefile to retrieve a Notefile from.

  • note_id (DB files only) The ID of the note to retrieve.

  • delete Whether to delete the note after retrieval.

  • deleted Whether to allow retrieval of a deleted note.

Returns

Returns

string The result of the Notecard request.

public def delete(card,file,note_id)

Delete a DB note in a Notefile by its ID.

Parameters

  • card The current Notecard object.

  • file The file name of the DB notefile.

  • note_id The id of the note to delete.

Returns

Returns

string The result of the Notecard request.

public def update(card,file,note_id,body,payload)

Update a note in a DB Notefile by ID.

Parameters

  • card The current Notecard object.

  • file The file name of the DB notefile.

  • note_id The id of the note to update.

  • body The JSON object to add to the note.

  • payload The base64-encoded JSON payload to add to the note.

Returns

Returns

string The result of the Notecard request.

public def template(card,file,body,length)

Create a template for new Notes in a Notefile.

Parameters

  • card The current Notecard object.

  • file The file name of the notefile.

  • body A sample JSON body that specifies field names and values as "hints" for the data type.

  • length If provided, the maximum length of a payload that can be sent in Notes for the template Notefile.

Returns

Returns

string The result of the Notecard request.

namespace notecard::notecard

Summary

Members Descriptions
public def serialReadByte(port) Read a single byte from a Notecard.
public def serialReset(port) Send a reset command to a Notecard.
public def serialTransaction(port,req,debug) Perform a single write to and read from a Notecard.
public def serialCommand(port,req,debug) Perform a single write to and read from a Notecard.
class notecard::notecard::Notecard Base Notecard class.
class notecard::notecard::OpenI2C Notecard class for I2C communication.
class notecard::notecard::OpenSerial Notecard class for Serial communication.

Members

public def serialReadByte(port)

Read a single byte from a Notecard.

public def serialReset(port)

Send a reset command to a Notecard.

public def serialTransaction(port,req,debug)

Perform a single write to and read from a Notecard.

public def serialCommand(port,req,debug)

Perform a single write to and read from a Notecard.

class notecard::notecard::Notecard

Base Notecard class.

Primary Notecard Class, which provides a shared init to reset the Notecard via Serial or I2C.

Summary

Members Descriptions
public def __init__(self) Initialize the Notecard through a reset.

Members

public def __init__(self)

Initialize the Notecard through a reset.

class notecard::notecard::OpenI2C

class notecard::notecard::OpenI2C
  : public notecard.notecard.Notecard

Notecard class for I2C communication.

Summary

Members Descriptions
public i2c
public addr
public max
public def Transaction(self,req) Perform a Notecard transaction and return the result.
public def Reset(self) Reset the Notecard.
public def lock(self) Lock the I2C port so the host can interact with the Notecard.
public def unlock(self) Unlock the I2C port.
public def __init__(self,i2c,address,max_transfer,debug) Initialize the Notecard before a reset.

Members

public i2c

public addr

public max

public def Transaction(self,req)

Perform a Notecard transaction and return the result.

public def Reset(self)

Reset the Notecard.

public def lock(self)

Lock the I2C port so the host can interact with the Notecard.

public def unlock(self)

Unlock the I2C port.

public def __init__(self,i2c,address,max_transfer,debug)

Initialize the Notecard before a reset.

class notecard::notecard::OpenSerial

class notecard::notecard::OpenSerial
  : public notecard.notecard.Notecard

Notecard class for Serial communication.

Summary

Members Descriptions
public uart
public lock
public def Command(self,req) Perform a Notecard command and exit with no response.
public def Transaction(self,req) Perform a Notecard transaction and return the result.
public def Reset(self) Reset the Notecard.
public def __init__(self,uart_id,debug) Initialize the Notecard before a reset.

Members

public uart

public lock

public def Command(self,req)

Perform a Notecard command and exit with no response.

public def Transaction(self,req)

Perform a Notecard transaction and return the result.

public def Reset(self)

Reset the Notecard.

public def __init__(self,uart_id,debug)

Initialize the Notecard before a reset.

namespace notecard::validators

Summary

Members Descriptions
public def validate_card_object(func) Ensure that the passed-in card is a Notecard.

Members

public def validate_card_object(func)

Ensure that the passed-in card is a Notecard.

Generated by Moxygen