I'm working with Movesense 2.0.0 on Simulator, and I'm implementing my own APIs.
This is (part of) my YAML with the API specification
/hs/Log/{Log_Id}/Data:
get:
description: |
Function returning Log Data
responses:
200:
description: Log Data
schema:
$ref: '#/definitions/LogData'
404:
description: Referenced log not found in LogBook.
parameters:
- $ref: '#/parameters/Log_Id'
parameters:
Log_Id:
name: Log_Id
in: path
required: true
type: integer
format: int32
definitions:
LogData:
required:
- Data
properties:
Data:
description: Log Data
type: array
items:
type: integer
format: int32
And this is the overridden method handling it:
void HSService::onGetRequest(const whiteboard::Request& request,
const whiteboard::ParameterList& parameters)
{
if (mModuleState != WB_RES::ModuleStateValues::STARTED)
{
return returnResult(request, wb::HTTP_CODE_SERVICE_UNAVAILABLE);
}
switch (request.getResourceConstId())
{
case WB_RES::LOCAL::HS_LOG_LOG_ID_DATA::ID:
{
WB_RES::LogData resp;
int32_t tmp[128] = { 0 };
resp.data = wb::MakeArray<int32_t>(tmp, 128);
return returnResult(request, whiteboard::HTTP_CODE_OK, ResponseOptions::Empty, resp);
}
}
break;
default:
return returnResult(request, whiteboard::HTTP_CODE_NOT_FOUND);
}
}
When I send a request with wbcmd it hangs until it shows a 408 - Timeout, but if a make the tmp
buffer smaller (121 or less elements) it works flawlessy.
Am I doing something wrong?
The Whiteboard has (to limit resource use on sensor) the maximum packet size which leads to maximum payload size. Currently the WB_MAX_MESSAGE_PAYLOAD_LENGTH is 466 bytes.
The Whiteboard limitations are defined in the file WhiteboardConfig.h
Full disclaimer: I work for the Movesense team