Skip to content

Latest commit

 

History

History
1242 lines (748 loc) · 59.5 KB

File metadata and controls

1242 lines (748 loc) · 59.5 KB

Summary

Members Descriptions
namespace notecard::binary_helpers
namespace notecard::card
namespace notecard::cobs
namespace notecard::crc32
namespace notecard::env
namespace notecard::file
namespace notecard::gpio
namespace notecard::hub
namespace notecard::md5
namespace notecard::note
namespace notecard::notecard
namespace notecard::timeout
namespace notecard::transaction_manager
namespace notecard::validators

namespace notecard::binary_helpers

Summary

Members Descriptions
private def _md5_hash(data) Create an MD5 digest of the given data.
public def binary_store_decoded_length(Notecard card) Get the length of the decoded binary data store.
public def binary_store_reset(Notecard card) Reset the binary data store.
public def binary_store_transmit(Notecard card,bytearray data,int offset) Write bytes to index offset of the binary data store.
public def binary_store_receive(card,int offset,int length) Receive length bytes from index offset of the binary data store.

Members

private def _md5_hash(data)

Create an MD5 digest of the given data.

Get the length of the decoded binary data store.

public def binary_store_reset(Notecard card)

Reset the binary data store.

public def binary_store_transmit(Notecard card,bytearray data,int offset)

Write bytes to index offset of the binary data store.

public def binary_store_receive(card,int offset,int length)

Receive length bytes from index offset of the binary data store.

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.
public def transport(card,method,allow) Configure the Notecard's connectivity method.

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. Must be one of: "-" to reset to the default mode "auto" to perform automatic band scan mode (default) "m" to restrict the modem to Cat-M1 "nb" to restrict the modem to Cat-NB1 "gprs" to restrict the modem to EGPRS

  • apn Access Point Name (APN) when using an external SIM. Use "-" to reset to the Notecard default APN.

Returns

Returns

dict The result of the Notecard request containing network status and signal information.

public def transport(card,method,allow)

Configure the Notecard's connectivity method.

Parameters

  • card The current Notecard object.

  • method The connectivity method to enable. Must be one of: "-" to reset to device default "wifi-cell" to prioritize WiFi with cellular fallback "wifi" to enable WiFi only "cell" to enable cellular only "ntn" to enable Non-Terrestrial Network mode "wifi-ntn" to prioritize WiFi with NTN fallback "cell-ntn" to prioritize cellular with NTN fallback "wifi-cell-ntn" to prioritize WiFi, then cellular, then NTN

  • allow When True, allows adding Notes to non-compact Notefiles while connected over a non-terrestrial network.

Returns

Returns

dict The result of the Notecard request.

namespace notecard::cobs

Summary

Members Descriptions
public bytearray cobs_encode(bytearray data,int eop) Functions for COBS encoding and decoding of bytearrays.
public bytearray cobs_decode(bytes encoded,int eop) COBS decode an array of bytes, using eop as the end of packet marker.

Members

public bytearray cobs_encode(bytearray data,int eop)

Functions for COBS encoding and decoding of bytearrays.

This module implements Consistent Overhead Byte Stuffing (COBS), an encoding that eliminates zero bytes from arbitrary binary data. The Notecard uses this for binary data transfers to ensure reliable transmission.

COBS encode an array of bytes, using eop as the end of packet marker.

public bytearray cobs_decode(bytes encoded,int eop)

COBS decode an array of bytes, using eop as the end of packet marker.

namespace notecard::crc32

Summary

Members Descriptions
private def _logical_rshift(val,shift_amount,num_bits) Logcally right shift val by shift_amount bits.
public def crc32(data) Compute CRC32 of the given data.

Members

private def _logical_rshift(val,shift_amount,num_bits)

Logcally right shift val by shift_amount bits.

Logical right shift (i.e. right shift that fills with 0s instead of the sign bit) isn't supported natively in Python. This is a simple implementation. See: https://realpython.com/python-bitwise-operators/#arithmetic-vs-logical-shift

public def crc32(data)

Compute CRC32 of the given data.

Small lookup-table half-byte CRC32 algorithm based on: https://create.stephan-brumme.com/crc32/#half-byte

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::gpio

Summary

Members Descriptions
class notecard::gpio::GPIO GPIO abstraction.
class notecard::gpio::CircuitPythonGPIO GPIO for CircuitPython.
class notecard::gpio::MicroPythonGPIO GPIO for MicroPython.
class notecard::gpio::RpiGPIO GPIO for Raspbian (Raspberry Pi).

class notecard::gpio::GPIO

GPIO abstraction.

Supports GPIO on CircuitPython, MicroPython, and Raspbian (Raspberry Pi).

Summary

Members Descriptions
public def direction(self,direction) Set the direction of the pin.
public def pull(self,pull) Set the pull of the pin.
public def value(self,value) Set the output or get the current level of the pin.
public def __init__(self,pin,direction,pull,value) Initialize the GPIO.

Members

public def direction(self,direction)

Set the direction of the pin.

Does nothing in this base class. Should be implemented by subclasses.

public def pull(self,pull)

Set the pull of the pin.

Does nothing in this base class. Should be implemented by subclasses.

public def value(self,value)

Set the output or get the current level of the pin.

Does nothing in this base class. Should be implemented by subclasses.

public def __init__(self,pin,direction,pull,value)

Initialize the GPIO.

Pin and direction are required arguments. Pull and value will be set only if given.

class notecard::gpio::CircuitPythonGPIO

class notecard::gpio::CircuitPythonGPIO
  : public notecard.gpio.GPIO

GPIO for CircuitPython.

Summary

Members Descriptions
public pin
public def direction(self,direction) Set the direction of the pin.
public def pull(self,pull) Set the pull of the pin.
public def value(self,value) Set the output or get the current level of the pin.
public def __init__(self,pin,direction,pull,value) Initialize the GPIO.

Members

public pin

public def direction(self,direction)

Set the direction of the pin.

Allowed direction values are GPIO.IN and GPIO.OUT. Other values cause a ValueError.

public def pull(self,pull)

Set the pull of the pin.

Allowed pull values are GPIO.PULL_UP, GPIO.PULL_DOWN, and GPIO.PULL_NONE. Other values cause a ValueError.

public def value(self,value)

Set the output or get the current level of the pin.

If value is not given, returns the level of the pin (i.e. the pin is an input). If value is given, sets the level of the pin (i.e. the pin is an output).

public def __init__(self,pin,direction,pull,value)

Initialize the GPIO.

Pin and direction are required arguments. Pull and value will be set only if given.

class notecard::gpio::MicroPythonGPIO

class notecard::gpio::MicroPythonGPIO
  : public notecard.gpio.GPIO

GPIO for MicroPython.

Summary

Members Descriptions
public pin
public def direction(self,direction) Set the direction of the pin.
public def pull(self,pull) Set the pull of the pin.
public def value(self,value) Set the output or get the current level of the pin.
public def __init__(self,pin,direction,pull,value) Initialize the GPIO.

Members

public pin

public def direction(self,direction)

Set the direction of the pin.

Allowed direction values are GPIO.IN and GPIO.OUT. Other values cause a ValueError.

public def pull(self,pull)

Set the pull of the pin.

Allowed pull values are GPIO.PULL_UP, GPIO.PULL_DOWN, and GPIO.PULL_NONE. Other values cause a ValueError.

public def value(self,value)

Set the output or get the current level of the pin.

If value is not given, returns the level of the pin (i.e. the pin is an input). If value is given, sets the level of the pin (i.e. the pin is an output).

public def __init__(self,pin,direction,pull,value)

Initialize the GPIO.

Pin and direction are required arguments. Pull and value will be set only if given.

class notecard::gpio::RpiGPIO

class notecard::gpio::RpiGPIO
  : public notecard.gpio.GPIO

GPIO for Raspbian (Raspberry Pi).

Summary

Members Descriptions
public rpi_direction
public pin
public def direction(self,direction) Set the direction of the pin.
public def pull(self,pull) Set the pull of the pin.
public def value(self,value) Set the output or get the current level of the pin.
public def __init__(self,pin,direction,pull,value) Initialize the GPIO.

Members

public pin

public def direction(self,direction)

Set the direction of the pin.

Allowed direction values are GPIO.IN and GPIO.OUT. Other values cause a ValueError.

public def pull(self,pull)

Set the pull of the pin.

Allowed pull values are GPIO.PULL_UP, GPIO.PULL_DOWN, and GPIO.PULL_NONE. Other values cause a ValueError.

public def value(self,value)

Set the output or get the current level of the pin.

If value is not given, returns the level of the pin (i.e. the pin is an input). If value is given, sets the level of the pin (i.e. the pin is an output).

public def __init__(self,pin,direction,pull,value)

Initialize the GPIO.

Pin and direction are required arguments. Pull and value will be set only if given.

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::md5

Summary

Members Descriptions
public def left_rotate(x,amount)
public def md5(message)
public def digest(message)

Members

public def left_rotate(x,amount)

public def md5(message)

public def digest(message)

namespace notecard::note

Summary

Members Descriptions
public def add(card,file,body,payload,sync,port) Add a Note to a Notefile.
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,port,compact) Create a template for new Notes in a Notefile.

Members

public def add(card,file,body,payload,sync,port)

Add a Note to a Notefile.

Parameters

  • card The current Notecard object.

  • file The name of the file. body (JSON object): A developer-defined tracker ID.

  • payload An optional base64-encoded string.

  • sync Perform an immediate sync after adding.

  • port If provided, a unique number to represent a notefile. Required for Notecard LoRa.

Returns

Returns

string The result of the Notecard request.

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,port,compact)

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.

  • port If provided, a unique number to represent a notefile. Required for Notecard LoRa.

  • compact If true, sets the format to compact to tell the Notecard to omit this additional metadata to save on storage and bandwidth. Required for Notecard LoRa.

Returns

Returns

string The result of the Notecard request.

namespace notecard::notecard

Summary

Members Descriptions
class notecard::notecard::SerialLockTimeout A null SerialLockTimeout for when use_serial_lock is False.
class notecard::notecard::NoOpContextManager A no-op context manager for use with NoOpSerialLock.
class notecard::notecard::NoOpSerialLock A no-op serial lock class for when use_serial_lock is False.
class notecard::notecard::Notecard Base Notecard class.
class notecard::notecard::OpenSerial Notecard class for Serial communication.
class notecard::notecard::OpenI2C Notecard class for I2C communication.

class notecard::notecard::SerialLockTimeout

class notecard::notecard::SerialLockTimeout
  : public Exception

A null SerialLockTimeout for when use_serial_lock is False.

Summary

Members Descriptions

Members

class notecard::notecard::NoOpContextManager

A no-op context manager for use with NoOpSerialLock.

Summary

Members Descriptions
public def __enter__(self) No-op enter function.
public def __exit__(self,exc_type,exc_value,traceback) No-op exit function.

Members

public def __enter__(self)

No-op enter function.

Required for context managers.

public def __exit__(self,exc_type,exc_value,traceback)

No-op exit function.

Required for context managers.

class notecard::notecard::NoOpSerialLock

A no-op serial lock class for when use_serial_lock is False.

Summary

Members Descriptions
public def acquire(* args,** kwargs) Acquire the no-op lock.
public def release(* args,** kwargs) Release the no-op lock.

Members

public def acquire(* args,** kwargs)

Acquire the no-op lock.

public def release(* args,** kwargs)

Release the no-op lock.

class notecard::notecard::Notecard

Base Notecard class.

Summary

Members Descriptions
public def __init__(self,debug) Initialize the Notecard object.
public def Transaction(self,req,lock) Send a request to the Notecard and read back a response.
public def Command(self,req) Send a command to the Notecard.
public def GetUserAgent(self) Return the User Agent String for the host for debug purposes.
public def SetAppUserAgent(self,app_user_agent) Set the User Agent info for the app.
public def UserAgentSent(self) Return true if the User Agent has been sent to the Notecard.
public def SetTransactionPins(self,rtx_pin,ctx_pin) Set the pins used for RTX and CTX.

Members

public def __init__(self,debug)

Initialize the Notecard object.

public def Transaction(self,req,lock)

Send a request to the Notecard and read back a response.

If the request is a command (indicated by using 'cmd' in the request instead of 'req'), don't return a response.

The underlying transport channel (serial or I2C) is locked for the duration of the request and response if lock is True.

public def Command(self,req)

Send a command to the Notecard.

Unlike Transaction, Command doesn't return a response from the Notecard.

public def GetUserAgent(self)

Return the User Agent String for the host for debug purposes.

Returns

Returns

dict A dictionary containing user agent information including OS details and any application-specific user agent information.

public def SetAppUserAgent(self,app_user_agent)

Set the User Agent info for the app.

Parameters

  • app_user_agent Dictionary containing application-specific user agent information.

public def UserAgentSent(self)

Return true if the User Agent has been sent to the Notecard.

Returns

Returns

bool True if the User Agent has been sent to the Notecard, False otherwise.

public def SetTransactionPins(self,rtx_pin,ctx_pin)

Set the pins used for RTX and CTX.

Parameters

  • rtx_pin The pin to use for Ready To Transact (RTX) signaling.

  • ctx_pin The pin to use for Clear To Transact (CTX) signaling.

class notecard::notecard::OpenSerial

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

Notecard class for Serial communication.

Summary

Members Descriptions
public uart
public lock_handle
public def receive(self,timeout_secs,delay) Read a newline-terminated batch of data from the Notecard.
public def transmit(self,data,delay) Send data to the Notecard.
public def Reset(self) Reset the Notecard.
public def lock(self) Lock access to the serial bus.
public def unlock(self) Unlock access to the serial bus.
public def __init__(self,uart_id,debug,lock_path) Initialize the Notecard before a reset.

Members

public uart

public def receive(self,timeout_secs,delay)

Read a newline-terminated batch of data from the Notecard.

public def transmit(self,data,delay)

Send data to the Notecard.

public def Reset(self)

Reset the Notecard.

public def lock(self)

Lock access to the serial bus.

public def unlock(self)

Unlock access to the serial bus.

public def __init__(self,uart_id,debug,lock_path)

Initialize the Notecard before a reset.

Parameters

  • uart_id The serial port identifier.

  • debug Enable debug output if True.

  • lock_path Optional path for the serial lock file. Defaults to /tmp/serial.lock or the value of NOTECARD_SERIAL_LOCK_PATH environment variable.

class notecard::notecard::OpenI2C

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

Notecard class for I2C communication.

Summary

Members Descriptions
public i2c
public lock_fn
public unlock_fn
public addr
public max
public def receive(self,timeout_secs,delay) Read a newline-terminated batch of data from the Notecard.
public def transmit(self,data,delay) Send data to the Notecard.
public def Reset(self) Reset the Notecard.
public def lock(self) Lock access to the I2C bus.
public def unlock(self) Unlock access to the I2C bus.
public def __init__(self,i2c,address,max_transfer,debug) Initialize the Notecard before a reset.

Members

public i2c

public lock_fn

public unlock_fn

public addr

public max

public def receive(self,timeout_secs,delay)

Read a newline-terminated batch of data from the Notecard.

public def transmit(self,data,delay)

Send data to the Notecard.

public def Reset(self)

Reset the Notecard.

public def lock(self)

Lock access to the I2C bus.

public def unlock(self)

Unlock access to the I2C bus.

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

Initialize the Notecard before a reset.

namespace notecard::timeout

Summary

Members Descriptions
public def ticks_diff(ticks1,ticks2) Compute the signed difference between two ticks values.
public def has_timed_out(start,timeout_secs) Determine whether a timeout interval has passed during communication.
public def start_timeout() Start the timeout interval for I2C communication.

Members

public def ticks_diff(ticks1,ticks2)

Compute the signed difference between two ticks values.

public def has_timed_out(start,timeout_secs)

Determine whether a timeout interval has passed during communication.

public def start_timeout()

Start the timeout interval for I2C communication.

namespace notecard::transaction_manager

Summary

Members Descriptions
class notecard::transaction_manager::TransactionManager Class for managing the start and end of Notecard transactions.
class notecard::transaction_manager::NoOpTransactionManager Class for transaction start/stop when no transaction pins are set.

class notecard::transaction_manager::TransactionManager

Class for managing the start and end of Notecard transactions.

Some Notecards need to be signaled via GPIO when a transaction is about to start. When the Notecard sees a particular GPIO, called RTX (ready to transact), go high, it responds with a high pulse on another GPIO, CTX (clear to transact). At this point, the transaction can proceed. This class implements this protocol in its start method.

Summary

Members Descriptions
public rtx_pin
public ctx_pin
public def __init__(self,rtx_pin,ctx_pin) Initialize the TransactionManager.
public def start(self,timeout_secs) Prepare the Notecard for a transaction.
public def stop(self) Make RTX an input to conserve power and remove the pull up on CTX.

Members

public rtx_pin

public ctx_pin

public def __init__(self,rtx_pin,ctx_pin)

Initialize the TransactionManager.

Even though RTX is an output, we set it as an input here to conserve power until we need to use it.

public def start(self,timeout_secs)

Prepare the Notecard for a transaction.

public def stop(self)

Make RTX an input to conserve power and remove the pull up on CTX.

class notecard::transaction_manager::NoOpTransactionManager

Class for transaction start/stop when no transaction pins are set.

If the transaction pins aren't set, the start and stop operations should be no-ops.

Summary

Members Descriptions
public def start(self,timeout_secs) No-op start function.
public def stop(self) No-op stop function.

Members

public def start(self,timeout_secs)

No-op start function.

public def stop(self)

No-op stop function.

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.

Skip validation.

Generated by Moxygen