Hello there,
I am facing issues while reading or writing or even getting the information related to the file status in the sample for the mqtt server in CC3200, is there anything extra which needs to be done to make it working of sl_FsGetInfo or sl_FsOpen or sl_FsWrite or sl_FsClose.
I have attached my code snipped,
long ReadConfiguration() { SlFsFileInfo_t pFsFileInfo; unsigned long ulToken; long lFileHandle; long lRetVal = -1; unsigned char *pData = "Testing to write something to file"; UART_PRINT("Writing some file : \"%s\"\r\n", WIFI_CONFIG); lRetVal = sl_FsGetInfo((unsigned char *)WIFI_CONFIG, NULL, &pFsFileInfo); // // create a user file // lRetVal = sl_FsOpen(WIFI_CONFIG, FS_MODE_OPEN_CREATE(65536, \ _FS_FILE_OPEN_FLAG_COMMIT|_FS_FILE_PUBLIC_WRITE), &ulToken, &lFileHandle); if(lRetVal < 0) { // // File may already be created // lRetVal = sl_FsClose(lFileHandle, 0, 0, 0); return lRetVal; } else { lRetVal = sl_FsClose(lFileHandle, 0, 0, 0); if (SL_RET_CODE_OK != lRetVal) { return FILE_CLOSE_ERROR; } } // // open a user file for writing // lRetVal = sl_FsOpen(WIFI_CONFIG, FS_MODE_OPEN_WRITE, &ulToken, &lFileHandle); if(lRetVal < 0) { lRetVal = sl_FsClose(lFileHandle, 0, 0, 0); return FILE_OPEN_WRITE_FAILED; } // // write the test buffer to another file. // lRetVal = sl_FsWrite(lFileHandle, 0, pData, sizeof(pData)); if (lRetVal < 0) { lRetVal = sl_FsClose(lFileHandle, 0, 0, 0); return FILE_WRITE_FAILED; } // // close the user file // lRetVal = sl_FsClose(lFileHandle, 0, 0, 0); if (SL_RET_CODE_OK != lRetVal) { return FILE_CLOSE_ERROR; } UART_PRINT("Written [%s] to file [%s]\r\n", WIFI_CONFIG, g_writingBuffer); return SUCCESS; } void main() { long lRetVal = -1; // Initialize the board configurations BoardInit(); // Pinmux for UART PinMuxConfig(); // Configuring UART InitTerm(); // Init all required variables InitVariables(); // Start the SimpleLink Host lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY); if(lRetVal < 0) { ERR_PRINT(lRetVal); } // Reading configuration ReadConfiguration(); // Init i2c lRetVal = I2C_IF_Open(I2C_MASTER_MODE_FST); if(lRetVal < 0) { ERR_PRINT(lRetVal); } // Configure timer A and interrupt for that Timer_IF_Init(PRCM_TIMERA0, TIMERA0_BASE, TIMER_CFG_PERIODIC, TIMER_A, 0); Timer_IF_IntSetup(TIMERA0_BASE, TIMER_A, TimerBaseIntHandler); // Start the MQTT Server and Client task depending upon the jumper settings osi_MsgQCreate(&g_PBQueue,"PBQueue",sizeof(struct msg_queue),10); lRetVal = osi_TaskCreate(MqttClientServer, (const signed char *)"Mqtt Server", 2048, NULL, 2, NULL ); if(lRetVal < 0) { ERR_PRINT(lRetVal); } // Start the task scheduler osi_start(); }
let me know in case I am missing any details