NAME
Device::MindWave::Utils
DESCRIPTION
Utility functions used in various libraries.
PUBLIC FUNCTIONS
- checksum
-
Takes an arrayref of bytes as its single argument. Returns the checksum of those bytes as an integer. The checksum is calculated by summing the bytes, taking the lowest eight bits, and returning the one's complement of that value.
- packet_isa
-
Takes an arbitrary object and a packet package name suffix (i.e. without the beginning 'Device::MindWave::Packet::' part) as its arguments. Returns a boolean indicating whether the object is a packet of the relevant type.
- packet_to_bytes
-
Takes an instance of an implementation of Device::MindWave::Packet and returns an arrayref containing the bytes for the packet, including the synchronisation bytes at the beginning and the checksum byte at the end.