Port of TI's CC3100 Websock camera demo. Using FreeRTOS, mbedTLS, also parts of Arducam for cams ov5642 and 0v2640. Can also use MT9D111. Work in progress. Be warned some parts maybe a bit flacky. This is for Seeed Arch max only, for an M3, see the demo for CM3 using the 0v5642 aducam mini.
base64.cpp
00001 //***************************************************************************** 00002 // Copyright (C) 2014 Texas Instruments Incorporated 00003 // 00004 // All rights reserved. Property of Texas Instruments Incorporated. 00005 // Restricted rights to use, duplicate or disclose this code are 00006 // granted through contract. 00007 // The program may not be used without the written permission of 00008 // Texas Instruments Incorporated or against the terms and conditions 00009 // stipulated in the agreement under which this program has been supplied, 00010 // and under no circumstances can it be used with non-TI connectivity device. 00011 // 00012 //***************************************************************************** 00013 00014 /** 00015 * @defgroup base64_api 00016 * 00017 * @{ 00018 */ 00019 #include "base64.h" 00020 00021 static const char g_ccB64Tbl[65] = 00022 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 00023 00024 00025 void ConvertToBase64(char *pcOutStr, const char *pccInStr, int iLen) 00026 { 00027 const char* pccIn = (const char *)pccInStr; 00028 char* pcOut; 00029 int iCount; 00030 pcOut = pcOutStr; 00031 00032 //Loop in for Multiple of 24Bits and Convert to Base 64 00033 for (iCount = 0; iLen - iCount >=3 ; iCount += 3,pccIn += 3) 00034 { 00035 *pcOut++ = g_ccB64Tbl[pccIn[0] >> 2]; 00036 *pcOut++ = g_ccB64Tbl[((pccIn[0] & 0x03)<<4) | (pccIn[1] >> 4)]; 00037 *pcOut++ = g_ccB64Tbl[((pccIn[1] & 0x0F)<<2) | (pccIn[2] >> 6)]; 00038 *pcOut++ = g_ccB64Tbl[pccIn[2] & 0x3f]; 00039 00040 } 00041 00042 //Check if String is not multiple of 3 Bytes 00043 if (iCount != iLen) 00044 { 00045 00046 unsigned char ucLastByte; 00047 00048 *pcOut++ = g_ccB64Tbl[pccIn[0] >> 2]; 00049 ucLastByte = ((pccIn[0] & 0x03)<<4); 00050 00051 00052 if (iLen - iCount > 1) 00053 { 00054 //If there are 2 Extra Bytes 00055 ucLastByte |= (pccIn[1] >> 4); 00056 *pcOut++ = g_ccB64Tbl[ucLastByte]; 00057 *pcOut++ = g_ccB64Tbl[((pccIn[1] & 0x0F)<<2)]; 00058 } 00059 else 00060 { 00061 //If there is only 1 Extra Byte 00062 *pcOut++ = g_ccB64Tbl[ucLastByte]; 00063 *pcOut++ = '='; 00064 } 00065 00066 *pcOut++ = '='; 00067 } 00068 00069 *pcOut = '\0'; 00070 00071 } 00072 00073 /// @} 00074 00075
Generated on Tue Jul 12 2022 22:22:37 by 1.7.2