Freematics Hub for Linux is released
Posted: Tue Oct 03, 2017 1:58 pm
				
				Binary for Ubuntu Linux x64 can be downloaded from https://freematics.com/hub
			 )
 )Code: Select all
g++ -o teleserver -I httpd -l httpd teleserver.cCode: Select all
teleserver.c: In function ‘void initChannel(CHANNEL_DATA*, int)’:
teleserver.c:188:21: error: invalid conversion from ‘void*’ to ‘CACHE_DATA*’ [-fpermissive]
  188 |  pld->cache = calloc(cacheSize, sizeof(CACHE_DATA));
      |               ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                     |
      |                     void*
teleserver.c: In function ‘int uhChannels(UrlHandlerParam*)’:
teleserver.c:665:106: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 8 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  665 | "id\":\"%u\",\"devid\":\"%s\",\"recv\":%u,\"rate\":%u,\"tick\":%llu,\"devtick\":%u,\"elapsed\":%u,\"age\":{\"data\":%u,\"ping\":%u},\"rssi\":%d,\"flags\":%u,\"parked\":%u",
      |                                                                ~~~^
      |                                                                   |
      |                                                                   long long unsigned int
      |                                                                %lu
  666 | ved, (unsigned int)pld->sampleRate, pld->serverDataTick, pld->deviceTick, pld->elapsedTime,
      |                                     ~~~~~~~~~~~~~~~~~~~            
      |                                          |
      |                                          uint64_t {aka long unsigned int}
teleserver.c: In function ‘int uhGet(UrlHandlerParam*)’:
teleserver.c:808:58: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  808 |  l += snprintf(buf + l, bs - l, "{\"stats\":{\"tick\":%llu,\"devtick\":%u,\"elapsed\":%u,\"age\":{\"data\":%u,\"ping\":%u},\"rssi\":%d,\"flags\":%u,\"parked\":%u}",
      |                                                       ~~~^
      |                                                          |
      |                                                          long long unsigned int
      |                                                       %lu
  809 |   pld->serverDataTick, pld->deviceTick, pld->elapsedTime,
      |   ~~~~~~~~~~~~~~~~~~~                                     
      |        |
      |        uint64_t {aka long unsigned int}
teleserver.c: In function ‘int uhPull(UrlHandlerParam*)’:
teleserver.c:854:98: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 6 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  854 |  bufsize - bytes, "\"stats\":{\"recv\":%u,\"rate\":%u,\"tick\":%llu,\"devtick\":%u,\"elapsed\":%u,\"age\":{\"data\":%u,\"ping\":%u},\"parked\":%u}",
      |                                                                ~~~^
      |                                                                   |
      |                                                                   long long unsigned int
      |                                                                %lu
  855 | int)pld->sampleRate, pld->serverDataTick, pld->deviceTick, pld->elapsedTime, age, pingage, (pld->flags & FLAG_RUNNING) ? 0 : 1);
      |                      ~~~~~~~~~~~~~~~~~~~                           
      |                           |
      |                           uint64_t {aka long unsigned int}
teleserver.c: In function ‘int uhCommand(UrlHandlerParam*)’:
teleserver.c:946:31: error: invalid conversion from ‘void*’ to ‘HttpParam*’ {aka ‘_httpParam*’} [-fpermissive]
  946 |   token = issueCommand(param->hp, pld, cmd, token);
      |                        ~~~~~~~^~
      |                               |
      |                               void*
In file included from teleserver.c:25:
teleserver.h:129:34: note:   initializing argument 1 of ‘uint32_t issueCommand(HttpParam*, CHANNEL_DATA*, const char*, uint32_t)’
  129 | uint32_t issueCommand(HttpParam* hp, CHANNEL_DATA *pld, const char* cmd, uint32_t token);
      |                       ~~~~~~~~~~~^~
teleserver.c: In function ‘char* GetLocalAddrString()’:
teleserver.c:1104:22: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
 1104 |  if (!lpHost) return "127.0.0.1";
      |                      ^~~~~~~~~~~
teleserver.c: In function ‘int main(int, char**)’:
teleserver.c:1141:17: error: invalid conversion from ‘void*’ to ‘__sighandler_t’ {aka ‘void (*)(int)’} [-fpermissive]
 1141 |  signal(SIGINT, (void *) ServerQuit);
      |                 ^~~~~~~~~~~~~~~~~~~
      |                 |
      |                 void*
In file included from httpd/httppil.h:50,
                 from httpd/httpd.h:13,
                 from teleserver.c:24:
/usr/include/signal.h:88:57: note:   initializing argument 2 of ‘void (* signal(int, __sighandler_t))(int)’
   88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~
teleserver.c:1142:18: error: invalid conversion from ‘void*’ to ‘__sighandler_t’ {aka ‘void (*)(int)’} [-fpermissive]
 1142 |  signal(SIGTERM, (void *) ServerQuit);
      |                  ^~~~~~~~~~~~~~~~~~~
      |                  |
      |                  void*
In file included from httpd/httppil.h:50,
                 from httpd/httpd.h:13,
                 from teleserver.c:24:
/usr/include/signal.h:88:57: note:   initializing argument 2 of ‘void (* signal(int, __sighandler_t))(int)’
   88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~
teleserver.c:1148:29: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
 1148 |  GetFullPath(path, argv[0], "htdocs");
      |                             ^~~~~~~~
teleserver.c: In function ‘FILE* getLogFile()’:
teleserver.c:240:33: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 128 [-Wformat-truncation=]
  240 |   snprintf(path, sizeof(path), "%s/%u.txt", logDir, date);
      |                                 ^~          ~~~~~~
teleserver.c:240:11: note: ‘snprintf’ output between 7 and 271 bytes into a destination of size 128
  240 |   snprintf(path, sizeof(path), "%s/%u.txt", logDir, date);
      |   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
teleserver.c: In function ‘void SaveChannels()’:
teleserver.c:440:34: warning: ‘/channels.dat’ directive output may be truncated writing 13 bytes into a region of size between 1 and 256 [-Wformat-truncation=]
  440 |  snprintf(path, sizeof(path), "%s/channels.dat", dataDir);
      |                                  ^~~~~~~~~~~~~
teleserver.c:440:10: note: ‘snprintf’ output between 14 and 269 bytes into a destination of size 256
  440 |  snprintf(path, sizeof(path), "%s/channels.dat", dataDir);
      |  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
teleserver.c: In function ‘int LoadChannels()’:
teleserver.c:456:34: warning: ‘/channels.dat’ directive output may be truncated writing 13 bytes into a region of size between 1 and 256 [-Wformat-truncation=]
  456 |  snprintf(path, sizeof(path), "%s/channels.dat", dataDir);
      |                                  ^~~~~~~~~~~~~
teleserver.c:456:10: note: ‘snprintf’ output between 14 and 269 bytes into a destination of size 256
  456 |  snprintf(path, sizeof(path), "%s/channels.dat", dataDir);
      |  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code: Select all
cd teleserverCode: Select all
makeCode: Select all
sudo make installCode: Select all
./teleserver