I am having an issue with TSInitServer reurning the error code TS_INVALID_STATE. since this code is part of the API, i cannot debug it. Here is my code from root.c. Anyone have any ideas why I could be getting this return code?
int lTelnetStatus = TS_SYSTEM_ERROR;
//Initialize the system services for the application.
//This will not include the Ethernet HTTP service, since
//we will start that up after initialization from the MicroHBD.
//Remove last startup error log so we can log a new one
//Open a new log file to store startup logs in
//Set the max number of telnet ports
TelnetInitConfig.max_entries = 1;
//Initialize the Telnet server
lTelnetStatus = TSInitServer (&TelnetInitConfig);
//Log any startup errors
Telnet Server Started");
Telnet Memory Fail");
Telnet Invalid Param Fail");
Telnet System Error");
Telnet Invalid State");
Telnet Unknown Error");
//Try to open the Telnet port
if (TELN_OpenPort() == FALSE)
Failed Telnet Port Open");
This is VERY interesting! I loaded the exmple Telnet server code from Net Os 7.4 and I got the same return code! what is going on here?
Are you developing within the ESP IDE? Have you created a project in which you include services (ftp, http…). Have you started the CLI Telnet (service)?
I am developing with the ME developer board using NET OS 7.4. My project does include the Telnet server. The CLI service is started and seems to work fine. I can view stack info and such through it.
An interesting tidbit of info. Upon looking at where I init the callback function pointers, I did not assign a function to getbuf_callback because the API states that a default routine will be used if not defined. but when I look at where getbuf_callback is pointing, it points to a random place in my code (A const array I set up) instead of to some default routine provided by Digi.
I wonder if this is the source of the problem?
Are you developing using the ESP IDE?
You stated the following:
“My project does include the Telnet server. The CLI service is started and seems to work fine.”
Assuming the answer to the first question is YES, then which CLI service did you check off, as there are three as follows:
Further I’ll assume that you are attempting to add telnet service to a project created via ESP.
If my assumptions above are incorrect them please let me know what and how yo are doing.
I am not sure that you need to call the TSInitServer after initAppServices().
If you have built your application including CLI Telnet then, I guess, all initialization will be done in the initAppServices() and the Telnet should work.
I am using telnet without any calls to TSInitServer and it works fine.