Skip to content

Commit c57d3b7

Browse files
committed
BearSSL: add command to get errorCode()
1 parent 4f0b377 commit c57d3b7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

main/CommandHandler.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,6 +1676,22 @@ int brSetECTrustAnchor(const uint8_t command[], uint8_t response[])
16761676
return 6;
16771677
}
16781678

1679+
int brErrorCode(const uint8_t command[], uint8_t response[])
1680+
{
1681+
//[0] CMD_START < 0xE0 >
1682+
//[1] Command < 1 byte >
1683+
//[2] N args < 1 byte >
1684+
1685+
int result = bearsslClient.errorCode();
1686+
int len = sizeof(result);
1687+
1688+
response[2] = 1; // number of parameters
1689+
response[3] = len; // parameter 1 length
1690+
memcpy(&response[4], &result, sizeof(result));
1691+
1692+
return len + 5;
1693+
}
1694+
16791695
//
16801696
// Low-level BSD-like sockets functions
16811697
//
@@ -2152,7 +2168,7 @@ const CommandHandlerType commandHandlers[] = {
21522168
setPinMode, setDigitalWrite, setAnalogWrite, getDigitalRead, getAnalogRead, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
21532169

21542170
// 0x60 -> 0x6f
2155-
writeFile, readFile, deleteFile, existsFile, downloadFile, applyOTA, renameFile, downloadOTA, brSetECTrustAnchor, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
2171+
writeFile, readFile, deleteFile, existsFile, downloadFile, applyOTA, renameFile, downloadOTA, brSetECTrustAnchor, brErrorCode, NULL, NULL, NULL, NULL, NULL, NULL,
21562172

21572173
// Low-level BSD-like sockets functions.
21582174
// 0x70 -> 0x7f

0 commit comments

Comments
 (0)