xcp-0.1.0.1: Partial implementation of the XCP protocol with ethernet as transport layer.

Safe HaskellNone
LanguageHaskell2010

Network.Xcp

Contents

Synopsis

Types and Classes

data XcpCommandId Source

XCP commands from the standard. Note: Not all of these are implemented and a few from the XCP reference are missing. Please add them as needed if you like.

class Storable a => ToByteString a Source

Class for types that can be converted to a lazy ByteString for transmission.

Minimal complete definition

toByteString

data XcpError Source

Constructors

GenericError Word8 

XCP packets

xcpGet Source

Arguments

:: Word32

Memory address

-> Word8

Number of bytes to retrieve

-> ByteString

The XCP packet

Create an XCP packet to get a number of bytes from an address.

xcpSet Source

Arguments

:: ToByteString a 
=> Word32

Memory address

-> a

Value to set at the given address

-> ByteString

The XCP packet

Create an XCP packet to set a number of bytes at an address.

xcpConnect :: ByteString Source

The XCP connect packet.

xcpDisconnect :: ByteString Source

The XCP disconnect packet.

XCP Results and Conversion

data XcpResult Source

Result structure for the result of XCP commands, received from a slave.

byteStringToResult Source

Arguments

:: ByteString

The XCP message as received from the slave.

-> XcpResult

The decoded result.

Convert a result XCP message received from a slave into a XcpResult.

fromBytes Source

Arguments

:: Storable a 
=> a

Just a dummy to fix the type of the return value.

-> [Word8]

The bytes that make up the return value.

-> Maybe a

If the number of bytes are sufficient, the first sizeOf a bytes from the list of bytes are poked into the returned value.

Generate a value from a list of bytes by poking them into memory.

bytesToString :: [Word8] -> String Source

Show a string of bytes.