Thread: Dynamically calling implemented functions

  1. #1
    Registered User
    Join Date
    Aug 2019
    Posts
    8

    Dynamically calling implemented functions

    Code:
    typedef struct {
      char *at_cmdName;
      int8_t at_cmdLen;
      void (*at_testCmd) (uint8_t id);
      void (*at_queryCmd) (uint8_t id);
      void (*at_setupCmd) (uint8_t id, char *pPara);
      void (*at_exeCmd) (uint8_t id);
    } at_funcationType;
    
    at_funcationType at_custom_cmd[] = {
      {"+TEST", 5, NULL, NULL, NULL, myTest_init}, //​​connect to the server, and register the corresponding callback.
      {"+TESA", 5, NULL, NULL, NULL, myTest1}, // print ok
      {"+TESB", 5, NULL, NULL, NULL, myTest2},  // print your own ip address
      {"+TESC", 5, NULL, NULL, NULL, myTest3},
          //​​Get the connected WiFi name password.has a problem 
      {"+TESD", 5, NULL, NULL, NULL, myTest4},
          //​​send data test, need to call myTest_init before use 
      {"+TESE", 5, NULL, NULL, NULL, myTest5},
    };
    Hi Everyone!
    I am reviewing a few ideas on how to dynamically call functions if they exist (I add and remove headers in my projects) and am currently leveraging ifdef directives. However, depending on how the includes are arraigned
    some defines can be skipped by mistake. After review, it seems AT Firmware deploys a similar schema to dynamically add additional calls during runtime. Does anyone have a simple snippet of code in this context? I would like to implement this idea but there are some core parts I feel I would like some assistant/ideas on like a sample function to dynamically add to the growing structure. Has anyone implemented a function Schema like this?
    Last edited by Salem; 05-07-2020 at 09:06 PM. Reason: Removed crayola

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. based on user input scroll dynamically using Win32 functions
    By kiranbhatter in forum Windows Programming
    Replies: 1
    Last Post: 08-07-2011, 06:49 AM
  2. calling functions
    By njasmine1 in forum C Programming
    Replies: 2
    Last Post: 12-29-2010, 10:28 AM
  3. finding where the functions are defined and implemented
    By dayalsoap in forum C Programming
    Replies: 4
    Last Post: 09-12-2010, 06:33 PM
  4. Calling C function from dynamically loaded library
    By polas in forum Linux Programming
    Replies: 17
    Last Post: 09-02-2009, 01:04 PM
  5. reallocating structures dynamically in functions
    By cezaryn in forum C Programming
    Replies: 3
    Last Post: 05-29-2003, 09:54 PM

Tags for this Thread