Rename few stuff for consistency

This commit is contained in:
Philippe Teuwen 2019-04-18 12:43:35 +02:00
commit 482db05741
83 changed files with 691 additions and 675 deletions

View file

@ -12,7 +12,7 @@
/**
* The following params expected:
* UsbCommandOLD c
* PacketCommandOLD c
*@brief l_SendCommand
* @param L
* @return
@ -29,19 +29,19 @@ static int l_SendCommand(lua_State *L) {
uint8_t asBytes[USB_CMD_DATA_SIZE]; // 1 byte * 512 = 512 bytes (OR)
uint32_t asDwords[USB_CMD_DATA_SIZE/4]; // 4 byte * 128 = 512 bytes
} d;
} PACKED UsbCommandOLD;
} PACKED PacketCommandOLD;
==> A 544 byte buffer will do.
**/
size_t size;
const char *data = luaL_checklstring(L, 1, &size);
if (size != sizeof(UsbCommandOLD)) {
printf("Got data size %d, expected %d", (int) size, (int) sizeof(UsbCommandOLD));
if (size != sizeof(PacketCommandOLD)) {
printf("Got data size %d, expected %d", (int) size, (int) sizeof(PacketCommandOLD));
lua_pushstring(L, "Wrong data size");
return 1;
}
SendCommand((UsbCommandOLD *)data);
SendCommand((PacketCommandOLD *)data);
return 0; // no return values
}
@ -184,10 +184,10 @@ static int l_WaitForResponseTimeout(lua_State *L) {
ms_timeout = luaL_checkunsigned(L, 2);
}
UsbReplyNG resp;
PacketResponseNG resp;
if (WaitForResponseTimeout(cmd, &resp, ms_timeout)) {
//Push it as a string
lua_pushlstring(L, (const char *)&resp, sizeof(UsbReplyNG));
lua_pushlstring(L, (const char *)&resp, sizeof(PacketResponseNG));
return 1;
} else {
//signal error by returning Nil, errorstring
@ -262,7 +262,7 @@ static int l_foobar(lua_State *L) {
printf("Arguments discarded, stack now contains %d elements", lua_gettop(L));
// todo: this is not used, where was it intended for?
// UsbCommandOLD response = {CMD_MIFARE_READBL, {1337, 1338, 1339}, {{0}}};
// PacketCommandOLD response = {CMD_MIFARE_READBL, {1337, 1338, 1339}, {{0}}};
printf("Now returning a uint64_t as a string");
uint64_t x = 0xDEADC0DE;