Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1.  
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include "mms_client_connection.h"
  5.  
  6. int main(int argc, char** argv) {
  7.  
  8.     char* hostname;
  9.     int tcpPort = 102;
  10.  
  11.     if (argc > 1)
  12.         hostname = argv[1];
  13.     else
  14.         hostname = "localhost";
  15.  
  16.     if (argc > 2)
  17.         tcpPort = atoi(argv[2]);
  18.  
  19.     MmsConnection con = MmsConnection_create();
  20.  
  21.     MmsError error;
  22.  
  23.     if (!MmsConnection_connect(con, &error, hostname, tcpPort)) {
  24.         printf("MMS connect failed!\n");
  25.         goto exit;
  26.     }
  27.     else
  28.         printf("MMS connected.\n\n");
  29.  
  30.     MmsValue* value = MmsConnection_readVariable(con, &error, "simpleIOGenericIO", "LLN0$GO");
  31.  
  32.     if (value == NULL)
  33.         printf("reading value failed!\n");
  34.     else
  35.         MmsValue_delete(value);
  36.  
  37. exit:
  38.     MmsConnection_destroy(con);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement