Request
To send commands, use the Request datatype. When your request is processed the Ravas Redbox will send a Response.
Basic requests
A basic request is shown in the code (C) example below. In this example a Uint32_tag
is sent to the Ravas RedBox.
Example
//Request type is defined in converted protobuf file from compiler
bool protocol_send_basic_request(Request_Type type, uint32_t val)
{
Request request = {};
request.type = type;
request.which_payload = Request_Uint32_tag;
request.payload.Uint32 = val;
return send_request(&request);
}
Scale requests
Request below can be send via a basic request as described above. As payload an Uint32_tag
is filled in with the scale index (0)
Request | Payload | Description |
---|---|---|
SET_ZERO |
scale_number (uint32) | If scale is in zero range set scale to zero |
SET_TARE |
scale_number (uint32) | Do semi-automatic taring. Scale switches to net mode |
RESET_TARE |
scale_number (uint32) | Reset tare. Scale switches back to gross mode |
SET_ZERO_OR_TARE |
scale_number (uint32) | When the scale is in zero range: equivalent to SET_ZERO. If not: scale perform semi-automatic taring and switches to net mode |
SET_SUM_WEIGHING_ADD |
scale_number (uint32) | Add current weight to the totalizing register |
SET_SUM_FINAL |
scale_number (uint32) | Finalize SUM and store to alibi memory |
SET_SUM_RESET |
scale_number (uint32) | Reset totalizing register |
Special scale request
Preset tare
The following code example shows how to send a preset tare value to the scale:
Example
//Request type is defined in converted protobuf file from compiler
bool protocol_send_preset_tare(Request_Type type, uint32_t scale_index, float value)
{
Request request = {};
request.type = type;
request.which_payload = Request_preset_tare_tag;
request.payload.preset_tare.preset_weight = value;
request.payload.preset_tare.scale_number = scale_index;
return send_request(&request);
}
Request | Payload | Description |
---|---|---|
SET_PRESET_TARE |
PresetTare | Set manual tare value. Scale switch to net mode |
Other requests
Request | Payload | Description |
---|---|---|
RESET |
none | Restart the system |