Erick / Mbed 2 deprecated ICE-F412

Dependencies:   mbed-rtos mbed

Revision:
2:02cb20446785
Parent:
1:b2e90cda7a5a
--- a/ICE-Application/src/Utilities/v7_c_calls.cpp	Tue Jan 24 19:06:45 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-#include "global.h"
-#include <stdio.h>
-#include <string>
-#include <sstream>
-#include <iostream>
-#include "v7_c_calls.h"
-#include "utilities.h"
-#include "ModbusMasterApi.h"
-#include "cJSON.h"
-#include "ConfigurationHandler.h"
-
-#ifdef EXECUTE_SCRIPT
-
-char FileBuffer[MAX_FILE_SIZE];
-
-enum v7_err js_modifySetpoint(struct v7 *v7, v7_val_t *res)
-{
-    std::ostringstream filename;
-    
-    // id of control i.e. INH_TRA_01
-    v7_val_t arg0 = v7_arg(v7, 0);
-    const char *arg0_str = v7_get_cstring(v7, &arg0);
-    // setpoint
-    v7_val_t arg1 = v7_arg(v7, 0);
-    const char *arg1_str = v7_get_cstring(v7, &arg1);
-        
-    filename << CONTROL_SP_STR << arg0_str << ".json";
-    
-    printf("%s:%d: filename = %s\r\n",__func__, __LINE__, filename.str().c_str() );
-    
-    // read the file
-    bool rc = GLOBAL_mdot->readUserFile(filename.str().c_str(), (void*)FileBuffer, MAX_FILE_SIZE);
-    if ( rc != true ) {
-        printf("%s:%d: Failed to read %s\r\n",__func__, __LINE__, filename.str().c_str());
-        return V7_INTERNAL_ERROR;
-    }
-
-    cJSON * root = cJSON_Parse(FileBuffer);
-    strncpy( cJSON_GetObjectItem(root,"setpoint")->valuestring, arg1_str, (strlen(arg1_str)-1) );
-    std::string s = cJSON_PrintUnformatted(root);
-    cJSON_Delete(root);
-
-    printf("%s:%d: writing back: %s\r\n",__func__, __LINE__, s.c_str());
-
-    rc = GLOBAL_mdot->saveUserFile(filename.str().c_str(), (void*)s.c_str(), MAX_FILE_SIZE);
-    if ( rc != true ) {
-        printf("%s:%d: Failed to write %s\r\n",__func__, __LINE__, filename.str().c_str());
-        return V7_INTERNAL_ERROR;
-    }
-    return V7_OK;
-}
-
-enum v7_err js_getTime(struct v7 *v7, v7_val_t *res)
-{
-    time_t curr_sec = time(NULL);
-//    printf("%s:%d: time=%ld\r\n", __func__, __LINE__, curr_sec );
-    *res = v7_mk_number(v7, curr_sec);
-    return V7_OK;
-}
-
-enum v7_err js_setRegister(struct v7 *v7, v7_val_t *res)
-{
-    v7_val_t argv0 = v7_arg(v7, 0);
-    if( v7_is_string(argv0) ) {
-//        printf("first param is a string\r\n");
-    }
-    const char *arg_str = v7_get_cstring(v7, &argv0);
-    double arg1 = v7_get_double(v7, v7_arg(v7, 1));
-    (void)ScriptWriteRegister( arg_str, arg1 );
-//    printf("%s:%d: string=%s, value=%2.2f\r\n", __func__, __LINE__, arg_str, arg1 );
-
-    *res = v7_mk_number(v7, 1);
-    return V7_OK;
-}
-
-enum v7_err js_getRegister(struct v7 *v7, v7_val_t *res)
-{
-    v7_val_t argv0 = v7_arg(v7, 0);
-    if( v7_is_string(argv0) ) {
-//        printf("first param is a string\r\n");
-    }
-    const char *arg_str = v7_get_cstring(v7, &argv0);
-    double reg_value = ScriptReadRegister( arg_str );
-//    printf("%s:%d: string=%s, value=%2.2f\r\n", __func__, __LINE__, arg_str, reg_value );
-
-    *res = v7_mk_number(v7, reg_value);
-    return V7_OK;
-}
-
-bool v7_Register_C_Calls(struct v7 *v7)
-{
-    v7_set_method(v7, v7_get_global(v7), "getTime", &js_getTime);
-    v7_set_method(v7, v7_get_global(v7), "setRegister", &js_setRegister);
-    v7_set_method(v7, v7_get_global(v7), "getRegister", &js_getRegister);
-    v7_set_method(v7, v7_get_global(v7), "modifySetpoint", &js_modifySetpoint);
-    return true;
-}
-#endif
\ No newline at end of file