55 #if (HARDWARE != SIMULATION)
58 #include <sys/types.h>
72 gComInstance= _Instance;
81 #define USB_CABLE_DETECT_RATE 15000 // ?? Approx 5 sec. on a good day. Cable detection is a NON-critical
93 void cComPrintTxMsg(
TXBUF *pTxBuf);
97 #define SIZEOFFILESIZE 8
106 RESULT Result = FAIL;
112 #if (HARDWARE != SIMULATION)
115 ComInstance.
Cmdfd = open(COM_CMD_DEVICE_NAME, O_RDWR, 0666);
117 if (ComInstance.
Cmdfd >= 0)
123 for (TmpFileHandle = 0;TmpFileHandle < MAX_FILE_HANDLES;TmpFileHandle++)
126 ComInstance.
Files[TmpFileHandle].
Name[0] = 0;
127 ComInstance.
Files[TmpFileHandle].
File = -1;
174 File = fopen(
"./settings/BrickName",
"r");
178 fgets((
char*)&(ComInstance.
BrickName[0]), (
int)vmBRICKNAMESIZE, File);
205 RESULT Result = FAIL;
215 RESULT Result = FAIL;
235 RESULT Result = FAIL;
237 close(ComInstance.
Cmdfd);
278 strcpy(Musb_Cmd,
"echo otg > /sys/devices/platform/musb_hdrc/mode");
289 f = fopen(
"/sys/devices/platform/musb_hdrc/mode",
"r");
292 fread(buffer, 20, 1, f);
299 printf(
"BUFFER = %s\n\r", buffer);
302 if(strstr(buffer,
"b_peripheral") != 0)
309 printf(
"CABLE connected\n\r");
311 printf(
"CABLE dis-connected :-(\n\r");
320 void cComShow(
UBYTE *pB)
325 Lng += (
UWORD)pB[1] << 8;
327 printf(
"[%02X%02X",pB[0],pB[1]);
344 void cComPrintTxMsg(
TXBUF *pTxBuf)
351 printf(
"Tx Buf content: \r\n");
352 for(Cnt = 0; ((Cnt < ((*pComRpl).CmdSize + 2)) && (Cnt < 1024)); Cnt++)
354 for(Cnt2 = Cnt; Cnt2 < (Cnt + 16); Cnt2++)
356 printf(
"0x%02X, ",((
UBYTE*)(&((*pComRpl).CmdSize)))[Cnt2]);
370 #if (HARDWARE != SIMULATION)
372 struct timeval Cmdtv;
378 FD_SET(ComInstance.
Cmdfd, &Cmdfds);
379 if (select(ComInstance.
Cmdfd + 1, &Cmdfds,
NULL,
NULL, &Cmdtv))
381 Length = read(ComInstance.
Cmdfd,pBuffer,(
size_t)Size);
386 printf(
"cComReadBuffer Length = %d\r\n", Length);
398 #if (HARDWARE != SIMULATION)
404 Length = write(ComInstance.
Cmdfd,pBuffer,64);
407 Length = write(ComInstance.
Cmdfd,pBuffer,1024);
412 printf(
"cComWriteBuffer %d\n\r", Length);
436 pComCmd = (
COMCMD*)pBuffer;
437 pDirCmd = (
DIRCMD*)(*pComCmd).PayLoad;
439 CmdSize = (*pComCmd).CmdSize;
440 HeadSize = ((*pDirCmd).Code - pBuffer) -
sizeof(
CMDSIZE);
441 Length = CmdSize - HeadSize;
443 pComRpl = (
COMRPL*)pReply;
445 (*pComRpl).MsgCnt = (*pComCmd).MsgCnt;
446 (*pComRpl).Cmd = DIRECT_REPLY_ERROR;
448 if ((CmdSize > HeadSize) && ((CmdSize - HeadSize) < (
sizeof(ComInstance.
Image) - (
sizeof(
IMGHEAD) +
sizeof(
OBJHEAD)))))
451 Tmp = (
UWORD)(*pDirCmd).Globals + ((
UWORD)(*pDirCmd).Locals << 8);
453 Globals = (Tmp & 0x3FF);
454 Locals = ((Tmp >> 10) & 0x3F);
456 if ((Locals <= MAX_COMMAND_LOCALS) && (Globals <= MAX_COMMAND_GLOBALS))
462 (*pImgHead).Sign[0] =
'l';
463 (*pImgHead).Sign[1] =
'e';
464 (*pImgHead).Sign[2] =
'g';
465 (*pImgHead).Sign[3] =
'o';
466 (*pImgHead).VersionInfo = (
UWORD)(VERS * 100.0);
467 (*pImgHead).NumberOfObjects = (
OBJID)1;
468 (*pImgHead).GlobalBytes = (
GBINDEX)Globals;
471 (*pObjHead).OwnerObjectId = 0;
472 (*pObjHead).TriggerCount = 0;
473 (*pObjHead).LocalBytes = (
OBJID)Locals;
478 ComInstance.
Image[Length] = opOBJECT_END;
479 (*pImgHead).ImageSize = Length;
485 for (Tmp = 0;Tmp <= Length;Tmp++)
487 printf(
"%02X ",ComInstance.
Image[Tmp]);
488 if ((Tmp & 0x0F) == 0x0F)
500 (*pComRpl).Cmd = DIRECT_REPLY_ERROR;
505 (*pComRpl).Cmd = DIRECT_REPLY_ERROR;
514 if (*pHandle >= MIN_HANDLE)
526 if (0 != ComInstance.
Files[Handle].
Name[0])
528 if ((Handle >= 0) && (Handle < MAX_FILE_HANDLES))
546 while ((ComInstance.
Files[Result].
Name[0]) && (Result < MAX_FILE_HANDLES))
551 if (Result < MAX_FILE_HANDLES)
555 sprintf(ComInstance.
Files[Result].
Name,
"%s", (
char*)pName);
573 struct dirent *pDirPtr;
575 pDirPtr = readdir(pDir);
576 while((
NULL != pDirPtr) && (DT_REG != pDirPtr->d_type))
578 pDirPtr = readdir(pDir);
583 snprintf((
char*)pName, FILENAME_SIZE,
"%s",pDirPtr->d_name);
601 char TmpFileName[vmFILENAMESIZE];
606 if ((strlen((
char *)pTxBuf->
Folder) + strlen((
char *)pName) + 1) <= vmFILENAMESIZE)
608 sprintf(TmpFileName,
"%s", (
char*)pTxBuf->
Folder);
609 strcat(TmpFileName, (
char*)pName);
614 if (-1 != FileHandle)
622 lseek(pTxBuf->
pFile->
File, 0L, SEEK_SET);
626 pDlMsg->
CmdType = SYSTEM_COMMAND_REPLY;
627 pDlMsg->
Cmd = BEGIN_DOWNLOAD;
634 Index = strlen((
char*)pTxBuf->
pFile->
Name) + 1;
698 pContinueDl->
CmdType = SYSTEM_COMMAND_REPLY;
699 pContinueDl->
Cmd = CONTINUE_DOWNLOAD;
708 pContinueDl->
CmdSize += ReadBytes;
734 pContinueDl->
CmdSize += ReadBytes;
749 UBYTE FileName[MAX_FILENAME_SIZE];
753 CmdSize = (*pComCmd).CmdSize;
755 switch ((*pSysCmdC).Sys)
767 if ((SUCCESS == pRplyBeginDl->
Status) || (END_OF_FILE == pRplyBeginDl->
Status))
810 case CONTINUE_DOWNLOAD:
816 if ((SUCCESS == pRplyContinueDl->
Status) || (END_OF_FILE == pRplyContinueDl->
Status))
865 char FileName[
MD5LEN + 1 + FILENAMESIZE];
866 struct stat FileInfo;
872 if ((DT_LNK == NameList->d_type) || (DT_DIR == NameList->d_type))
874 strncpy(pBuffer, NameList->d_name, FILENAMESIZE);
875 *pNameLen = strlen(NameList->d_name);
880 strcat(pBuffer,
"\n");
887 if (DT_REG == NameList->d_type)
890 strcpy(FileName, (
char*)pFolder);
891 strcat(FileName,
"/");
892 strcat(FileName,NameList->d_name);
895 md5_file(FileName, 0, (
unsigned char *)Md5Sum);
896 *pNameLen = sprintf(pBuffer,
"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X ",
903 stat(FileName,&FileInfo);
904 *pNameLen += sprintf(&(pBuffer[
MD5LEN + 1]),
"%08X ",(
ULONG)FileInfo.st_size);
907 strcat(pBuffer, NameList->d_name);
908 *pNameLen += strlen(NameList->d_name);
910 strcat(pBuffer,
"\n");
939 if (
CheckSdcard(&Changed, &TotalSize, &FreeSize, 1))
941 if (FreeSize >= Size)
953 if (FreeSize >= Size)
962 if (FreeSize >= Size + 300)
1049 CmdSize = (*pComCmd).CmdSize;
1051 switch ((*pSysCmdC).Sys)
1053 case BEGIN_DOWNLOAD :
1057 ULONG MsgHeaderSize;
1065 pRxBuf->
pFile = &(ComInstance.
Files[FileHandle]);
1070 pReplyDl->
CmdType = SYSTEM_REPLY;
1071 pReplyDl->
Cmd = BEGIN_DOWNLOAD;
1072 pReplyDl->
Status = SUCCESS;
1073 pReplyDl->
Handle = FileHandle;
1075 if (FileHandle >= 0)
1089 while ((ComInstance.
Files[FileHandle].
Name[Tmp]) && (Tmp < (MAX_FILENAME_SIZE - 1)))
1091 Folder[Tmp] = ComInstance.
Files[FileHandle].
Name[Tmp];
1092 if (Folder[Tmp] ==
'/')
1094 Folder[Tmp + 1] = 0;
1095 if (strcmp(
"~/",Folder) != 0)
1097 if (mkdir(Folder,S_IRWXU | S_IRWXG | S_IRWXO) == 0)
1099 chmod(Folder,S_IRWXU | S_IRWXG | S_IRWXO);
1101 printf(
"Folder %s created\r\n",Folder);
1107 printf(
"Folder %s not created (%s)\r\n",Folder,strerror(errno));
1115 pRxBuf->
pFile->
File = open(pRxBuf->
pFile->
Name, O_CREAT | O_WRONLY | O_TRUNC | O_SYNC, 0x666);
1125 BytesToWrite = pRxBuf->
MsgLen;
1131 BytesToWrite = pRxBuf->
BufSize - MsgHeaderSize;
1136 if (BytesToWrite > (ComInstance.
Files[FileHandle].
Size))
1139 pReplyDl->
Status = SIZE_ERROR;
1140 BytesToWrite = ComInstance.
Files[FileHandle].
Size;
1143 write(pRxBuf->
pFile->
File, &(pRxBuf->
Buf[MsgHeaderSize]), (
size_t)BytesToWrite);
1151 chmod(ComInstance.
Files[FileHandle].
Name,S_IRWXU | S_IRWXG | S_IRWXO);
1154 pReplyDl->
Status = END_OF_FILE;
1162 printf(
"File %s not created\r\n",ComInstance.
Files[FileHandle].
Name);
1165 pReplyDl->
CmdType = SYSTEM_REPLY_ERROR;
1166 pReplyDl->
Status = UNKNOWN_HANDLE;
1176 printf(
"File %s is too big\r\n",ComInstance.
Files[FileHandle].
Name);
1180 pReplyDl->
CmdType = SYSTEM_REPLY_ERROR;
1181 pReplyDl->
Status = SIZE_ERROR;
1189 pReplyDl->
CmdType = SYSTEM_REPLY_ERROR;
1190 pReplyDl->
Status = NO_HANDLES_AVAILABLE;
1195 printf(
"No more handles\r\n");
1201 case CONTINUE_DOWNLOAD :
1212 FileHandle = pContiDl->
Handle;
1217 pRplyContiDl->
CmdType = SYSTEM_REPLY;
1218 pRplyContiDl->
Cmd = CONTINUE_DOWNLOAD;
1219 pRplyContiDl->
Status = SUCCESS;
1220 pRplyContiDl->
Handle = FileHandle;
1222 if ((FileHandle >= 0) && (ComInstance.
Files[FileHandle].
Name[0]))
1226 pRxBuf->
pFile = &(ComInstance.
Files[FileHandle]);
1237 BytesToWrite = pRxBuf->
MsgLen;
1253 printf(
"File size limited\r\n");
1257 write(ComInstance.
Files[FileHandle].
File, (pContiDl->
PayLoad), (
size_t)BytesToWrite);
1259 pRxBuf->
RxBytes = BytesToWrite;
1262 printf(
"Size %8lu - Loaded %8lu\r\n",(
unsigned long)ComInstance.
Files[FileHandle].
Size,(
unsigned long)ComInstance.
Files[FileHandle].
Length);
1268 printf(
"%s %lu bytes downloaded\r\n",ComInstance.
Files[FileHandle].
Name,(
unsigned long)ComInstance.
Files[FileHandle].
Length);
1272 chmod(ComInstance.
Files[FileHandle].
Name,S_IRWXU | S_IRWXG | S_IRWXO);
1274 pRplyContiDl->
Status = END_OF_FILE;
1280 pRplyContiDl->
CmdType = SYSTEM_REPLY_ERROR;
1281 pRplyContiDl->
Status = UNKNOWN_ERROR;
1282 pRplyContiDl->
Handle = -1;
1287 printf(
"Data not appended\r\n");
1294 pRplyContiDl->
CmdType = SYSTEM_REPLY_ERROR;
1295 pRplyContiDl->
Status = UNKNOWN_HANDLE;
1296 pRplyContiDl->
Handle = -1;
1300 printf(
"Invalid handle\r\n");
1320 pTxBuf->
pFile = &ComInstance.
Files[FileHandle];
1325 pReplyBeginRead->
CmdType = SYSTEM_REPLY;
1326 pReplyBeginRead->
Cmd = BEGIN_UPLOAD;
1327 pReplyBeginRead->
Status = SUCCESS;
1328 pReplyBeginRead->
Handle = FileHandle;
1330 if (FileHandle >= 0)
1341 lseek(pTxBuf->
pFile->
File, 0L, SEEK_SET);
1343 pTxBuf->
MsgLen = BytesToRead;
1370 printf(
"Bytes to read %d bytes read %d\r\n",BytesToRead, ReadBytes);
1371 printf(
"FileSize: %d \r\n",pTxBuf->
pFile->
Size);
1386 pReplyBeginRead->
Status = END_OF_FILE;
1392 cComPrintTxMsg(pTxBuf);
1398 pReplyBeginRead->
CmdType = SYSTEM_REPLY_ERROR;
1399 pReplyBeginRead->
Status = UNKNOWN_HANDLE;
1400 pReplyBeginRead->
Handle = -1;
1405 printf(
"File %s is not present \r\n",ComInstance.
Files[FileHandle].
Name);
1411 pReplyBeginRead->
CmdType = SYSTEM_REPLY_ERROR;
1412 pReplyBeginRead->
Status = NO_HANDLES_AVAILABLE;
1413 pReplyBeginRead->
Handle = -1;
1417 printf(
"No more handles\r\n");
1424 case CONTINUE_UPLOAD:
1436 FileHandle = pContinueRead->
Handle;
1441 pReplyContinueRead->
CmdType = SYSTEM_REPLY;
1442 pReplyContinueRead->
Cmd = CONTINUE_UPLOAD;
1443 pReplyContinueRead->
Status = SUCCESS;
1444 pReplyContinueRead->
Handle = FileHandle;
1446 if ((FileHandle >= 0) && (pTxBuf->
pFile->
Name[0]))
1458 pTxBuf->
MsgLen = BytesToRead;
1463 BytesToRead = pTxBuf->
MsgLen;
1469 ReadBytes = read(pTxBuf->
pFile->
File,pReplyContinueRead->
PayLoad,(
size_t)BytesToRead);
1485 cComPrintTxMsg(pTxBuf);
1489 printf(
"Size %8lu - Loaded %8lu\r\n",(
unsigned long)pTxBuf->
pFile->
Size,(
unsigned long)pTxBuf->
pFile->
Length);
1495 printf(
"%s %lu bytes UpLoaded\r\n",ComInstance.
Files[FileHandle].
Name,(
unsigned long)pTxBuf->
pFile->
Length);
1498 pReplyContinueRead->
Status = END_OF_FILE;
1505 pReplyContinueRead->
CmdType = SYSTEM_REPLY_ERROR;
1506 pReplyContinueRead->
Status = HANDLE_NOT_READY;
1507 pReplyContinueRead->
Handle = -1;
1511 printf(
"Data not read\r\n");
1517 pReplyContinueRead->
CmdType = SYSTEM_REPLY_ERROR;
1518 pReplyContinueRead->
Status = UNKNOWN_HANDLE;
1519 pReplyContinueRead->
Handle = -1;
1522 printf(
"Invalid handle\r\n");
1541 pTxBuf->
pFile = &ComInstance.
Files[FileHandle];
1547 pReplyBeginGetFile->
CmdType = SYSTEM_REPLY;
1548 pReplyBeginGetFile->
Cmd = BEGIN_GETFILE;
1549 pReplyBeginGetFile->
Handle = FileHandle;
1550 pReplyBeginGetFile->
Status = SUCCESS;
1552 if (FileHandle >= 0)
1561 printf(
"File to get: %s \r\n",ComInstance.
Files[FileHandle].
Name);
1569 lseek(pTxBuf->
pFile->
File, 0L, SEEK_SET);
1571 pTxBuf->
MsgLen = BytesToRead;
1597 printf(
"Bytes to read %d vs. bytes read %d\r\n",BytesToRead, ReadBytes);
1598 printf(
"FileSize: %d \r\n",pTxBuf->
pFile->
Size);
1616 pReplyBeginGetFile->
Status = END_OF_FILE;
1623 cComPrintTxMsg(pTxBuf);
1628 pReplyBeginGetFile->
CmdType = SYSTEM_REPLY_ERROR;
1629 pReplyBeginGetFile->
Status = HANDLE_NOT_READY;
1630 pReplyBeginGetFile->
Handle = -1;
1635 printf(
"File %s is not present \r\n",ComInstance.
Files[FileHandle].
Name);
1641 pReplyBeginGetFile->
CmdType = SYSTEM_REPLY_ERROR;
1642 pReplyBeginGetFile->
Status = UNKNOWN_HANDLE;
1643 pReplyBeginGetFile->
Handle = -1;
1647 printf(
"No more handles\r\n");
1653 case CONTINUE_GETFILE:
1664 FileHandle = pContinueGetFile->
Handle;
1669 pReplyContinueGetFile->
CmdType = SYSTEM_REPLY;
1670 pReplyContinueGetFile->
Cmd = CONTINUE_GETFILE;
1671 pReplyContinueGetFile->
Status = SUCCESS;
1672 pReplyContinueGetFile->
Handle = FileHandle;
1674 if ((FileHandle >= 0) && (pTxBuf->
pFile->
Name[0]))
1684 lseek(pTxBuf->
pFile->
File, 0L, SEEK_SET);
1692 pTxBuf->
MsgLen = BytesToRead;
1697 BytesToRead = pTxBuf->
MsgLen;
1703 ReadBytes = read(pTxBuf->
pFile->
File,pReplyContinueGetFile->
PayLoad,(
size_t)BytesToRead);
1732 pReplyContinueGetFile->
Status = END_OF_FILE;
1739 printf(
"Size %8lu - Loaded %8lu\r\n",(
unsigned long)pTxBuf->
pFile->
Size,(
unsigned long)pTxBuf->
pFile->
Length);
1743 cComPrintTxMsg(pTxBuf);
1749 pReplyContinueGetFile->
CmdType = SYSTEM_REPLY_ERROR;
1750 pReplyContinueGetFile->
Status = HANDLE_NOT_READY;
1751 pReplyContinueGetFile->
Handle = -1;
1756 printf(
"Data not read\r\n");
1762 pReplyContinueGetFile->
CmdType = SYSTEM_REPLY_ERROR;
1763 pReplyContinueGetFile->
Status = UNKNOWN_HANDLE;
1764 pReplyContinueGetFile->
Handle = -1;
1768 printf(
"Invalid handle\r\n");
1787 pTxBuf->
pFile = &ComInstance.
Files[FileHandle];
1792 pReplyBeginList->
CmdType = SYSTEM_REPLY;
1793 pReplyBeginList->
Cmd = LIST_FILES;
1794 pReplyBeginList->
Status = SUCCESS;
1795 pReplyBeginList->
Handle = FileHandle;
1798 if (0 <= FileHandle)
1816 pReplyBeginList->
Handle = -1;
1824 pReplyBeginList->
CmdType = SYSTEM_REPLY_ERROR;
1825 pReplyBeginList->
Status = UNKNOWN_ERROR;
1830 pReplyBeginList->
Handle = -1;
1878 pTxBuf->
MsgLen = BytesToRead;
1883 if (BytesToRead > Len)
1887 pReplyBeginList->
Status = END_OF_FILE;
1895 BytesToSend = pTxBuf->
MsgLen;
1908 pDstAdr = pReplyBeginList->
PayLoad;
1917 if ((NameLen + Len) <= BytesToSend)
1920 pSrcAdr = (
UBYTE*)(TmpFileName);
1921 while (*pSrcAdr) *pDstAdr++ = *pSrcAdr++;
1926 if (BytesToSend == Len)
1938 memcpy((
char*)pDstAdr, TmpFileName, pTxBuf->
pFile->
Length);
1953 printf(
"Complete list of %lu Bytes uploaded \r\n",(
unsigned long)pTxBuf->
pFile->
Length);
1956 pReplyBeginList->
Status = END_OF_FILE;
1964 pReplyBeginList->
CmdType = SYSTEM_REPLY_ERROR;
1965 pReplyBeginList->
Status = UNKNOWN_ERROR;
1970 pReplyBeginList->
Handle = -1;
1977 cComPrintTxMsg(pTxBuf);
1983 case CONTINUE_LIST_FILES:
1992 char TmpFileName[FILENAMESIZE];
2003 pReplyContinueList->
CmdType = SYSTEM_REPLY;
2004 pReplyContinueList->
Cmd = CONTINUE_LIST_FILES;
2006 pReplyContinueList->
Status = SUCCESS;
2014 pReplyContinueList->
CmdType = SYSTEM_REPLY_ERROR;
2015 pReplyContinueList->
Status = UNKNOWN_ERROR;
2016 pReplyContinueList->
Handle = -1;
2026 pTxBuf->
MsgLen = BytesToRead;
2033 pReplyContinueList->
Status = END_OF_FILE;
2038 BytesToSend = pTxBuf->
MsgLen;
2062 if (RemCharCnt <= BytesToSend)
2065 memcpy((
char*)(&(pReplyContinueList->
PayLoad[Len])), &(TmpFileName[pTxBuf->
pFile->
Length]), RemCharCnt);
2070 if (RemCharCnt == BytesToSend)
2085 memcpy((
char*)(&(pReplyContinueList->
PayLoad[Len])), &(TmpFileName[pTxBuf->
pFile->
Length]), BytesToSend);
2102 if ((NameLen + Len) <= BytesToSend)
2104 memcpy((
char*)(&(pReplyContinueList->
PayLoad[Len])), TmpFileName, NameLen);
2109 if (BytesToSend == Len)
2121 memcpy((
char*)(&(pReplyContinueList->
PayLoad[Len])), TmpFileName, pTxBuf->
pFile->
Length);
2137 printf(
"Complete list of %lu Bytes uploaded \r\n",(
unsigned long)pTxBuf->
pFile->
Length);
2140 pReplyContinueList->
Status = END_OF_FILE;
2147 cComPrintTxMsg(pTxBuf);
2152 case CLOSE_FILEHANDLE:
2161 FileHandle = pCloseHandle->
Handle;
2164 printf(
"FileHandle to close = %d, Linux Handle = %d\r\n",FileHandle, ComInstance.
Files[FileHandle].
File);
2169 pReplyCloseHandle->
CmdType = SYSTEM_REPLY;
2170 pReplyCloseHandle->
Cmd = CLOSE_FILEHANDLE;
2172 pReplyCloseHandle->
Status = SUCCESS;
2180 pReplyCloseHandle->
CmdType = SYSTEM_REPLY_ERROR;
2181 pReplyCloseHandle->
Status = UNKNOWN_HANDLE;
2186 cComPrintTxMsg(pTxBuf);
2196 char Folder[
sizeof(ComInstance.
Files[FileHandle].
Name)];
2203 pReplyMakeDir->
MsgCount = pMakeDir->MsgCount;
2204 pReplyMakeDir->
CmdType = SYSTEM_REPLY;
2205 pReplyMakeDir->
Cmd = CREATE_DIR;
2206 pReplyMakeDir->
Status = SUCCESS;
2208 snprintf(Folder,
sizeof(Folder),
"%s",(
char*)(pMakeDir->Dir));
2210 if (0 == mkdir(Folder,S_IRWXU | S_IRWXG | S_IRWXO))
2212 chmod(Folder,S_IRWXU | S_IRWXG | S_IRWXO);
2214 printf(
"Folder %s created\r\n",Folder);
2220 pReplyMakeDir->
CmdType = SYSTEM_REPLY_ERROR;
2221 pReplyMakeDir->
Status = NO_PERMISSION;
2224 printf(
"Folder %s not created (%s)\r\n",Folder,strerror(errno));
2243 pReplyRemove->
CmdType = SYSTEM_REPLY;
2244 pReplyRemove->
Cmd = DELETE_FILE;
2245 pReplyRemove->
Status = SUCCESS;
2250 printf(
"File to delete %s\r\n", Name);
2253 if (0 ==
remove(Name))
2259 pReplyRemove->
CmdType = SYSTEM_REPLY_ERROR;
2260 pReplyRemove->
Status = NO_PERMISSION;
2263 printf(
"Folder %s not deleted (%s)\r\n",Folder,strerror(errno));
2270 case LIST_OPEN_HANDLES:
2283 pReplyListHandles->
CmdType = SYSTEM_REPLY;
2284 pReplyListHandles->
Cmd = LIST_OPEN_HANDLES;
2285 pReplyListHandles->
Status = SUCCESS;
2287 for (HCnt1 = 0; HCnt1 < ((MAX_FILE_HANDLES/8) + 1); HCnt1++)
2290 pReplyListHandles->
PayLoad[HCnt1 + 2] = 0;
2292 for(HCnt2 = 0; HCnt2 < 8; HCnt2++)
2295 if (0 != ComInstance.
Files[HCnt2 * HCnt1].
State)
2298 pReplyListHandles->
PayLoad[HCnt1 + 2] |= (0x01 << HCnt2) ;
2302 pReplyListHandles->
CmdSize += HCnt1;
2320 PayloadSize += ((
UWORD)(pWriteMailboxPayload->
SizeMsb)) << 8;
2331 UBYTE BtAddr[vmBTADRSIZE];
2332 UBYTE Pin[vmBTPASSKEYSIZE];
2342 snprintf((
char*)Pin, PinSize,
"%s", (
char*)pBtPin->
Pin);
2348 pReplyBtPin->
Status = SUCCESS;
2352 pReplyBtPin->
Status = ILLEGAL_CONNECTION;
2357 pReplyBtPin->
CmdType = SYSTEM_REPLY;
2358 pReplyBtPin->
Cmd = BLUETOOTHPIN;
2359 pReplyBtPin->
MacSize = vmBTADRSIZE;
2362 pReplyBtPin->
PinSize = PinSize;
2363 memcpy(pReplyBtPin->
Pin, pBtPin->
Pin, PinSize);
2377 UpdateFile = open(UPDATE_DEVICE_NAME,O_RDWR);
2379 if (UpdateFile >= 0)
2381 write(UpdateFile,&Dummy,1);
2383 system(
"reboot -d -f -i");
2397 pReplyBundleId->
CmdSize = 0x05;
2399 pReplyBundleId->
Cmd = SETBUNDLEID;
2404 pReplyBundleId->
CmdType = SYSTEM_REPLY;
2405 pReplyBundleId->
Status = SUCCESS;
2410 pReplyBundleId->
CmdType = SYSTEM_REPLY_ERROR;
2411 pReplyBundleId->
Status = SIZE_ERROR;
2417 case SETBUNDLESEEDID:
2425 pReplyBundleSeedId->
CmdSize = 0x05;
2427 pReplyBundleSeedId->
Cmd = SETBUNDLESEEDID;
2432 pReplyBundleSeedId->
CmdType = SYSTEM_REPLY;
2433 pReplyBundleSeedId->
Status = SUCCESS;
2438 pReplyBundleSeedId->
CmdType = SYSTEM_REPLY_ERROR;
2439 pReplyBundleSeedId->
Status = SIZE_ERROR;
2457 UBYTE ThisMagicCookie;
2460 UBYTE MotorBusySignal;
2461 UBYTE MotorBusySignalPointer;
2470 pTxBuf = &(ComInstance.
TxBuf[ChNo]);
2471 pRxBuf = &(ComInstance.
RxBuf[ChNo]);
2490 printf(
"Writing NOT set @ USBDEV - BytesRead = %d\r\n", BytesRead);
2508 memset(pTxBuf->
Buf,0,
sizeof(pTxBuf->
Buf));
2512 if ((*pComCmd).CmdSize)
2515 switch ((*pComCmd).Cmd)
2522 printf(
"Did we reach a *BUSY* DIRECT_COMMAND_NO_REPLY pComCmd.Size = %d\n\r", ((*pComCmd).CmdSize));
2525 Iterator = ((*pComCmd).CmdSize) - 7;
2529 for(Iterator = (((*pComCmd).CmdSize) - 7); Iterator < (((*pComCmd).CmdSize) - 3); Iterator++ )
2531 HelperByte |= ((*pComCmd).PayLoad[Iterator] & 0x03);
2541 MotorBusySignal = 0;
2542 MotorBusySignalPointer = 1;
2544 for(Iterator = (((*pComCmd).CmdSize) - 7); Iterator < (((*pComCmd).CmdSize) - 3); Iterator++ )
2549 printf(
"Iterator = %d\n\r", Iterator);
2552 ThisMagicCookie = (*pComCmd).PayLoad[Iterator];
2555 if(ThisMagicCookie & 0x80)
2557 MotorBusySignal = (
UBYTE)(MotorBusySignal | MotorBusySignalPointer);
2561 MotorBusySignalPointer <<= 1;
2566 printf(
"ThisMagicCookie = %d\n\r", ThisMagicCookie);
2578 printf(
"cMotorSetBusyFlags(%X)\n\r", MotorBusySignal);
2586 ((*pComCmd).CmdSize) -= 4;
2594 case DIRECT_COMMAND_REPLY :
2601 printf(
"Did we reach a DIRECT_COMMAND_REPLY\n\r");
2631 (*pComRpl).CmdSize = 3;
2632 (*pComRpl).MsgCnt = (*pComCmd).MsgCnt;
2633 (*pComRpl).Cmd = DIRECT_REPLY_ERROR;
2641 case DIRECT_COMMAND_NO_REPLY :
2648 printf(
"Did we reach a DIRECT_COMMAND_NO_REPLY\n\r");
2662 case SYSTEM_COMMAND_REPLY :
2678 case SYSTEM_COMMAND_NO_REPLY :
2699 case SYSTEM_REPLY_ERROR:
2702 printf(
"\r\nsystem reply error\r\n");
2714 printf(
"Did we reach c_COM @ DAISY_COMMAND_REPLY?\n\r");
2733 printf(
"Did we reach c_COM @ DAISY_COMMAND_NO_REPLY?\n\r");
2763 (*pComCmd).CmdSize = (
CMDSIZE)(*pImgHead).GlobalBytes + 1;
2764 (*pComCmd).Cmd = DIRECT_REPLY;
2765 memcpy((*pComCmd).PayLoad,ComInstance.
Globals,(*pImgHead).GlobalBytes);
2777 if (RemBytes <= pRxBuf->BufSize)
2780 BytesToWrite = RemBytes;
2794 BytesToWrite = pRxBuf->
BufSize;
2797 write(pRxBuf->
pFile->
File, pRxBuf->
Buf, (
size_t)BytesToWrite);
2804 chmod(pRxBuf->
pFile->
Name, S_IRWXU | S_IRWXG | S_IRWXO);
2819 printf(
"ready to check\n\r");
2842 pTxBuf = &(ComInstance.
TxBuf[ChNo]);
2852 printf(
"\n\r001\n\r");
2860 printf(
"Not unlocked 001\n\r");
2868 printf(
"Not unlocked 002\n\r");
2876 printf(
"Not unlocked 003\n\r");
2884 printf(
"Not (OR should be) unlocked 004\n\r");
2904 printf(
"Unlocked 001\n\r");
2912 printf(
"Unlocked 002\n\r");
2920 printf(
"Unlocked 003\n\r");
2928 printf(
"Unlocked 004\n\r");
2942 printf(
"Unlocked 005\n\r");
3010 printf(
"Tx Writing true in the bottom ChNo = %d - PushCounter = %d\n\r", ChNo,
GetDaisyPushCounter());
3031 switch(pTxBuf->
State)
3039 if( MsgLeft > pTxBuf->
BufSize)
3048 ReadBytes = read(pTxBuf->
pFile->
File ,pTxBuf->
Buf,(
size_t)MsgLeft);
3081 if( MsgLeft > pTxBuf->
BufSize)
3090 ReadBytes = read(pTxBuf->
pFile->
File ,pTxBuf->
Buf,(
size_t)MsgLeft);
3122 char TmpFileName[FILENAMESIZE];
3136 BytesToSend = pTxBuf->
BufSize;
3148 if (RemCharCnt <= BytesToSend)
3151 memcpy((
char*)(&(pTxBuf->
Buf[Len])), &(TmpFileName[pTxBuf->
pFile->
Length]), RemCharCnt);
3156 if (RemCharCnt == BytesToSend)
3170 memcpy((
char*)(&(pTxBuf->
Buf[Len])), &(TmpFileName[pTxBuf->
pFile->
Length]), BytesToSend);
3185 if ((NameLen + Len) <= BytesToSend)
3187 memcpy((
char*)(&(pTxBuf->
Buf[Len])), TmpFileName, NameLen);
3191 printf(
"List entry no = %d; File name = %s \r\n", TmpN, pTxBuf->
pFile->
namelist[TmpN]->d_name);
3196 if (BytesToSend == Len)
3209 RemCnt = BytesToSend - Len;
3210 memcpy((
char*)(&(pTxBuf->
Buf[Len])), TmpFileName, RemCnt);
3423 if (ComInstance.
Cmdfd >= 0)
3497 (*pComCmd).CmdSize += (
CMDSIZE)(*pImgHead).GlobalBytes;
3501 (*pComCmd).Cmd = DIRECT_REPLY;
3505 (*pComCmd).Cmd = DIRECT_REPLY_ERROR;
3508 memcpy((*pComCmd).PayLoad,(
UBYTE*)pGlobal,(*pImgHead).GlobalBytes);
3641 UWORD PayloadSize = 0;
3653 for(Cnt = 0; Cnt < Values; Cnt++)
3705 pDescr = (
DESCR*)pTmp;
3719 memcpy((
char*)&Payload[0],(
DATA8*)(pDescr->
pArray), Size);
3728 for(Cnt = 0; Cnt < ChNos; Cnt++)
3730 ComChNo = ChNoArr[Cnt] +
BTSLAVE;
3740 (*pComMbx).MsgCount = 1;
3741 (*pComMbx).CmdType = SYSTEM_COMMAND_NO_REPLY;
3742 (*pComMbx).Cmd = WRITEMAILBOX;
3743 (*pComMbx).NameSize = strlen((
char*)pBoxName) + 1;
3744 snprintf((
char*)(*pComMbx).Name,(*pComMbx).NameSize,
"%s",(
char*)pBoxName);
3746 (*pComMbx).CmdSize += (*pComMbx).NameSize;
3750 (*pComMbxPayload).
SizeLsb = (
UBYTE) (PayloadSize & 0x00FF);
3751 (*pComMbxPayload).SizeMsb = (
UBYTE)((PayloadSize >> 8) & 0x00FF);
3752 memcpy((*pComMbxPayload).Payload, Payload, PayloadSize);
3795 for(Cnt = 0; Cnt < Values; Cnt++)
3831 if (Data32 > MIN_ARRAY_ELEMENTS)
3852 if (Data32 > MIN_ARRAY_ELEMENTS)
3986 printf(
"%d [%s] ->> %d [%s]\r\n",FileType,(
char*)pFileName,Hardware,(
char*)pDeviceName);
3999 UBYTE pName[MAX_FILENAME_SIZE];
4005 pTxBuf = &(ComInstance.
TxBuf[ChNo[0]]);
4008 if (TYPE_FOLDER == FileType)
4014 snprintf((
char*)pTxBuf->
Folder, MAX_FILENAME_SIZE,
"%s",pFileName);
4015 strcat((
char*)pTxBuf->
Folder,
"/");
4017 pTxBuf->
pDir = (
DIR*)opendir((
char*)pFileName);
4302 if (Hardware < HWTYPES)
4362 snprintf((
char*)pPin,Length,
"%s",
"1234");
4408 Length = vmBRICKNAMESIZE;
4480 Length = vmBRICKNAMESIZE;
4495 Type = ICON_UNKNOWN;
4590 Length = vmBRICKNAMESIZE;
4605 Type = ICON_UNKNOWN;
4672 Length = vmBTADRSIZE;
4698 case GET_BRICKNAME :
4707 Length = vmBRICKNAMESIZE;
4731 if ((vmBRICKNAMESIZE >= vmMACSIZE) && (vmBRICKNAMESIZE >= vmIPSIZE))
4733 MaxStrLen = vmBRICKNAMESIZE;
4737 if (vmMACSIZE >= vmIPSIZE)
4739 MaxStrLen = vmMACSIZE;
4743 MaxStrLen = vmIPSIZE;
4789 if ((
NULL != pName) && (
NULL != pMac) && (
NULL != pIp))
4803 snprintf((
char*)pName, Length,
"%s",
"NONE");
4804 snprintf((
char*)pIp, 3,
"%s",
"??");
4809 snprintf((
char*)pMac, 3,
"%s",
"??");
4810 snprintf((
char*)pName, Length,
"%s",
"NONE");
4811 snprintf((
char*)pIp, 3,
"%s",
"??");
4891 Length = vmBRICKNAMESIZE;
5241 printf(
"\n\rSSID = %s\r\n", pName);
5246 printf(
"\r\nGot Index = %d\r\n", Item);
5247 printf(
"\r\nGot Index from name = %s\r\n", pName);
5251 printf(
"\r\nPSK made\r\n");
5287 case SET_CONNECTION :
5327 printf(
"cWiFiConnect => index: %d, Name: %s\n\r", Item, pName);
5335 printf(
"We have tried to connect....\n\r");
5365 Len = strlen((
char*)pName);
5367 if (OK ==
ValidateString(pName,vmCHARSET_NAME) && ((vmBRICKNAMESIZE - 1) > strlen((
char*)pName)))
5371 File = fopen(
"./settings/BrickName",
"w");
5374 fwrite(pName, 1, (
int)Len + 1, File);
5375 fwrite(nl, 1, (
int)1, File);
5378 snprintf((
char*)&(ComInstance.
BrickName[0]), vmBRICKNAMESIZE,
"%s",(
char*)pName);
5379 sethostname((
char*)pName, Len + 1);
5459 printf(
"\r\nWPA encrypt called\r\n");
5462 uint LocalIndex = 0;
5471 printf(
"\r\nNONE encrypt called\r\n");
5547 printf(
"Removing Index: %d\n\r", LocalIndex);
UWORD cBtSetBundleSeedId(UBYTE *pSeedId)
UWORD cBtReadCh2(UBYTE *pBuf, UWORD Length)
void SetDispatchStatus(DSPSTAT DspStat)
Set object (dispatch) status.
UBYTE cBtSetName(UBYTE *pName, UBYTE Length)
void cComRead(void)
opCOM_READ byte code
UWORD cWiFiWriteTcp(UBYTE *Buffer, UWORD Length)
#define SIZEOF_WRITEMAILBOX
UBYTE cComGetNxtFile(DIR *pDir, UBYTE *pName)
UBYTE cBtGetChNo(UBYTE *pName, UBYTE *pChNos)
void cComWriteMailBox(void)
opMAILBOX_WRITE byte code
void cComSetMusbHdrcMode(void)
MAILBOX MailBox[NO_OF_MAILBOXES]
UBYTE cBtConnect(UBYTE *pDevName)
DATA8 Changed[INPUTS][MAX_DEVICE_MODES]
RESULT cWiFiGetStatus(void)
UWORD cBtDevWriteBuf6(UBYTE *pBuf, UWORD Size)
UWORD(* WriteChannel[NO_OF_CHS])(UBYTE *, UWORD)
#define SIZEOF_RPLYBEGINLIST
UWORD(* ReadChannel[NO_OF_CHS])(UBYTE *, UWORD)
UBYTE cBtDisconnect(UBYTE *pName)
signed char SBYTE
Basic Type used to symbolise 8 bit signed values.
UBYTE cComUsbDeviceConnected
uint GetDaisyPushCounter(void)
void cDaisySetOwnLayer(UBYTE Layer)
RESULT cWiFiGetName(char *ApName, int Index, char Length)
void ResetDelayCounter(UBYTE Pattern)
#define SIZEOF_RPLYBEGINGETFILE
UWORD cBtDevWriteBuf2(UBYTE *pBuf, UWORD Size)
void cWiFiMoveDownInList(int Index)
DATA8 CheckUsbstick(DATA8 *pChanged, DATA32 *pTotal, DATA32 *pFree, DATA8 Force)
UBYTE BtSetOnOff(UBYTE On)
SWORD DATA16
VM Type for 2 byte signed value.
#define SIZEOF_RPLYCONTINUEDL
UWORD cBtReadCh3(UBYTE *pBuf, UWORD Length)
UBYTE BtGetVisibility(void)
SLONG DATA32
VM Type for 4 byte signed value.
UBYTE cBtGetConnListEntry(UBYTE Item, UBYTE *pName, SBYTE Length, UBYTE *pType)
void cMotorSetBusyFlags(UBYTE Flags)
UBYTE BtSetMode2(UBYTE Mode2)
UWORD OBJID
Object id type.
#define SIZEOF_RPLYCONTINUEREAD
UWORD cComReadBuffer(UBYTE *pBuffer, UWORD Size)
void SetObjectIp(IP Ip)
Set current instruction pointer.
UWORD cBtReadCh5(UBYTE *pBuf, UWORD Length)
ULONG Content[(MAILBOX_CONTENT_SIZE/4)+1]
UBYTE cComGetBtStatus(void)
UWORD cBtDevWriteBuf7(UBYTE *pBuf, UWORD Size)
void cComCloseFileHandle(SLONG *pHandle)
UBYTE cBtGetHciBusyFlag(void)
#define USB_CABLE_DETECT_RATE
IMGDATA Image[sizeof(IMGHEAD)+sizeof(OBJHEAD)+USB_CMD_IN_REP_SIZE-sizeof(DIRCMD)]
#define SIZEOF_RPLYBLUETOOTHPIN
UWORD cBtDevWriteBuf3(UBYTE *pBuf, UWORD Size)
void ResetDaisyPushCounter(void)
RESULT cComSetDeviceType(DATA8 Layer, DATA8 Port, DATA8 Type, DATA8 Mode)
DATA16 HANDLER
Memory list index.
RESULT cWiFiKnownDongleAttached(void)
UBYTE cComCheckForSpace(char *pFullName, ULONG Size)
void * PrimParPointer(void)
Get next encoded parameter from byte code stream.
RESULT cWiFiGetOnStatus(void)
#define DAISY_COMMAND_REPLY
UBYTE BtGetOnOff(UBYTE *On)
UBYTE cBtGetDevListEntry(UBYTE Item, SBYTE *pConnected, SBYTE *pType, UBYTE *pName, SBYTE Length)
UBYTE cBtSetPin(UBYTE *pPin)
IP GetObjectIp(void)
Get current instruction pointer.
RESULT cMemoryCheckFilename(char *pFilename, char *pPath, char *pName, char *pExt)
UBYTE cComFindMailbox(UBYTE *pName, UBYTE *pNo)
UWORD cComWriteBuffer(UBYTE *pBuffer, UWORD Size)
UBYTE Folder[vmFILENAMESIZE]
DATA8 cDaisyGetUsbUpStreamSpeed(void)
#define DAISY_COMMAND_NO_REPLY
UBYTE cBtGetNoOfDevListEntries(void)
RESULT cDaisyGetDeviceInfo(DATA8 Length, UBYTE *pInfo)
IMGDATA * IP
Instruction pointer type.
UBYTE cComDirectCommand(UBYTE *pBuffer, UBYTE *pReply)
void cDaisySetBusyFlags(UBYTE Layer, UBYTE Port, UBYTE MagicCookie)
unsigned int ULONG
Basic Type used to symbolise 32 bit unsigned values.
RESULT cComGetDeviceInfo(DATA8 Length, UBYTE *pInfo)
void cComSystemCommand(RXBUF *pRxBuf, TXBUF *pTxBuf)
cSystemCommand
void cDaisyPrepareNext(void)
RESULT cMemoryGetPointer(PRGID PrgId, HANDLER Handle, void **pMemory)
UWORD cBtReadCh0(UBYTE *pBuf, UWORD Length)
void cComOpenMailBox(void)
opMAILBOX_OPEN byte code
ULONG GBINDEX
GlobalBytes index type.
COM_GLOBALS * gComInstance
#define SIZEOF_RPLYBUNDLEID
void cComReady(void)
opCOM_READY byte code
UBYTE BrickName[vmBRICKNAMESIZE]
#define MAILBOX_CONTENT_SIZE
void cBtSetTrustedDev(UBYTE *pBtAddr, UBYTE *pPin, UBYTE PinSize)
#define SIZEOF_RPLYLISTHANDLES
void cWiFiDeleteAsKnown(int LocalIndex)
DATA8 cComGetUsbStatus(void)
UWORD cBtSetBundleId(UBYTE *pId)
UWORD cBtReadCh6(UBYTE *pBuf, UWORD Length)
UBYTE cDaisyGetOwnLayer(void)
void cComCloseMailBox(void)
opMAILBOX_CLOSE byte code
RESULT cWiFiGetIpAddr(char *IpAddress)
UWORD cBtDevWriteBuf(UBYTE *pBuf, UWORD Size)
UBYTE cBtDeleteFavourItem(UBYTE *pName)
RESULT cWiFiSetName(char *ApName, int Index)
#define SIZEOF_RPLYBUNDLESEEDID
void cComWrite(void)
opCOM_WRITE byte code
UWORD cBtReadCh4(UBYTE *pBuf, UWORD Length)
RESULT cWiFiConnectToAp(int Index)
RESULT cMemoryCheckOpenWrite(char *pFileName)
RESULT cWiFiTurnOff(void)
UBYTE cComCheckUsbCable(void)
void cMemoryGetUsage(DATA32 *pTotal, DATA32 *pFree, DATA8 Force)
#define DIR_CMD_NO_REPLY_WITH_BUSY
RESULT cComSetDeviceInfo(DATA8 Length, UBYTE *pInfo)
#define SIZEOF_CONTINUEDL
UBYTE cBtGetSearchListEntry(UBYTE Item, SBYTE *pConnected, SBYTE *pType, SBYTE *pParred, UBYTE *pName, SBYTE Length)
void cBtGetId(UBYTE *pId, UBYTE Length)
UBYTE cBtGetNoOfConnListEntries(void)
RESULT ValidateString(DATA8 *pString, DATA8 Set)
void cComTxUpdate(UBYTE ChNo)
unsigned char UBYTE
Basic Type used to symbolise 8 bit unsigned values.
RESULT cDaisyGetDownstreamData(DATA8 Layer, DATA8 Sensor, DATA8 Length, DATA8 *pType, DATA8 *pMode, DATA8 *pData)
RESULT cComGetDeviceData(DATA8 Layer, DATA8 Port, DATA8 Length, DATA8 *pType, DATA8 *pMode, DATA8 *pData)
struct dirent ** namelist
UWORD cBtReadCh1(UBYTE *pBuf, UWORD Length)
#define SIZEOF_WRITETOMAILBOXPAYLOAD
RESULT cDaisyChained(void)
void cComCreateContinueDl(RXBUF *pRxBuf, TXBUF *pTxBuf)
FIL Files[MAX_FILE_HANDLES]
FLOAT DATAF
VM Type for 4 byte floating point value.
UBYTE cComGetWifiStatus(void)
RESULT cWiFiGetIndexFromName(char *Name, UBYTE *Index)
UBYTE cBtGetNoOfSearchListEntries(void)
int md5_file(char *filename, int binary, unsigned char *md5_result)
unsigned short UWORD
Basic Type used to symbolise 16 bit unsigned values.
DATA8 cComGetHandle(char *pName)
UBYTE Globals[MAX_COMMAND_GLOBALS]
void cComTestMailBox(void)
opMAILBOX_TEST byte code
void cBtGetIncoming(UBYTE *pName, UBYTE *pCod, UBYTE Len)
void cComGetBrickName(DATA8 Length, DATA8 *pBrickName)
UBYTE cBtSetPasskey(UBYTE Accept)
void cComTest(void)
opCOM_TEST byte code
void cWiFiSetEncryptToNone(int Index)
RESULT cDaisySetDeviceType(DATA8 Layer, DATA8 Port, DATA8 Type, DATA8 Mode)
#define SIZEOF_RPLYMAKEDIR
void cComSystemReply(RXBUF *pRxBuf, TXBUF *pTxBuf)
void cDaisyCmd(RXBUF *pRxBuf, TXBUF *pTxBuf)
DATA8 CheckSdcard(DATA8 *pChanged, DATA32 *pTotal, DATA32 *pFree, DATA8 Force)
PRGID CurrentProgramId(void)
Get current program id.
int cWiFiGetApListSize(void)
ULONG Length
Total down load length.
RESULT cWiFiMakePsk(char *ApSsid, char *PassPhrase, int Index)
void setComInstance(COM_GLOBALS *_Instance)
COM_GLOBALS * getComInstance()
void * VmMemoryResize(HANDLER Handle, DATA32 Elements)
void cWiFiMoveUpInList(int Index)
unsigned char cWiFiGetFlags(int Index)
UWORD PRGID
Program id type.
#define DAISY_PUSH_NOT_UNLOCKED
void cDaisyPushUpStream(void)
#define SIZEOF_RPLYCLOSEHANDLE
void cWiFiSetEncryptToWpa2(int Index)
#define SIZEOF_RPLYREMOVEFILE
SBYTE DATA8
VM Type for 1 byte signed value.
void cComReadyMailBox(void)
opMAILBOX_READY byte code
RESULT cWiFiGetMyMacAddr(char *MacAddress)
UWORD cBtDevWriteBuf4(UBYTE *pBuf, UWORD Size)
UWORD cWiFiReadTcp(UBYTE *Buffer, UWORD Length)
char Name[vmFILENAMESIZE]
File name.
void cComReadMailBox(void)
opMAILBOX_READ byte code
UWORD cDaisyData(UBYTE **pData)
void cComGetNameFromScandirList(struct dirent *NameList, char *pBuffer, ULONG *pNameLen, UBYTE *pFolder)
void cComGet(void)
opCOM_GET byte code
void cComSet(void)
opCOM_SET byte code
UWORD cBtDevWriteBuf1(UBYTE *pBuf, UWORD Size)
#define SIZEOF_RPLYCONTINUELIST
RESULT cDaisySetDeviceInfo(DATA8 Length, UBYTE *pInfo)
void cComCreateBeginDl(TXBUF *pTxBuf, UBYTE *pName)
void DecrementDaisyPushCounter(void)
UBYTE BtGetMode2(UBYTE *pMode2)
UBYTE BtSetVisibility(UBYTE State)
#define SIZEOF_RPLYCONTINUEGETFILE
void cWiFiIncApListSize(void)
Break because of waiting for completion.
Dispatcher running (looping)
UBYTE cComFreeHandle(DATA8 Handle)
#define SIZEOF_RPLYBEGINREAD
IP OffsetToInstructions
Offset to instructions from image start.
signed int SLONG
Basic Type used to symbolise 32 bit signed values.
UWORD cBtDevWriteBuf5(UBYTE *pBuf, UWORD Size)
#define SIZEOF_RPLYBEGINDL
UWORD cBtReadCh7(UBYTE *pBuf, UWORD Length)