@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api M-Bus HTTPD API
@base /
@version 0.3.5
@endpoints 7
@toc mbus(7)

@endpoint GET /mbus/api
@desc Returns this API specification
@returns(200) OK
@errors {404: Not found}

@endpoint GET /mbus/hat
@desc Gets Raspberry Pi Hat information
@returns(200) {product: str, productId: str, productVer: str, uuid: str, vendor: str} # OK
@errors {404: Not found}

@endpoint POST /mbus/hat/on
@desc Turns on power to the M-Bus
@returns(200) OK
@errors {404: Not found}

@endpoint POST /mbus/hat/off
@desc Turns off power to the M-Bus
@returns(200) OK
@errors {404: Not found}

@endpoint POST /mbus/scan/{device}/{baudrate}
@desc Scan the specified device for slaves
@required {device: str # The serial device to scan - /dev/ is pre-pended to {device} by M-Bus HTTPD before scanning, baudrate: int(int32) # Baudrate to communicate with M-Bus devices}
@returns(200) OK
@errors {400: Bad request, 404: Not found (e.g. device not found, or M-Bus HTTPD is unauthorized to access it, or to change baud rate to that specified, device not responding etc)}

@endpoint POST /mbus/get/{device}/{baudrate}/{address}
@desc Gets data from the slave identified by {address}
@required {device: str # The serial device to scan - /dev/ is pre-pended to {device} by M-Bus HTTPD before scanning, baudrate: int(int32) # Baudrate to communicate with M-Bus devices, address: str(string) # The slave device to get data from}
@returns(200) OK
@errors {400: Bad request, 404: Not found (or M-Bus HTTPD is unauthorized to access it, or to change baud rate to that specified, etc)}

@endpoint POST /mbus/getMulti/{device}/{baudrate}/{address}/{maxframes}
@desc Gets data from the slave identified by {address}, and supports multiple responses from the slave
@required {device: str # The serial device to scan - /dev/ is pre-pended to {device} by M-Bus HTTPD before scanning, baudrate: int(int32) # Baudrate to communicate with M-Bus devices, address: str(string) # The slave device to get data from, maxframes: int(int32) # The slave device to get data from}
@returns(200) OK
@errors {400: Bad request, 404: Not found (or M-Bus HTTPD is unauthorized to access it, or to change baud rate to that specified, etc)}

@end
