![]() |
UserLibSimulator
1
Librería para E/S de simuladores genéricos
|
#include "UserLibSimulator.h"
#include "AlMar_mongoose-7-6.h"
#include <pthread.h>
#include "cJSON.h"
#include <psapi.h>
Data Structures | |
struct | ComputerOutputs |
struct | ComputerInputs |
struct | ComputerState |
Macros | |
#define | MAX_AD_INPUTS 8 |
#define | MAX_COUNTER_INPUTS 8 |
#define | MAX_AD_OUTPUTS 8 |
#define | MAX_PWM_OUTPUTS 8 |
Functions | |
void * | WssCheckSimulatorThread (void *param) |
void | WssEventHandler (struct mg_connection *conn, int ev, void *ev_data, void *fn_data) |
bool | ProcessIsPresent (const char *procName) |
int | Simulator_ConnectWss (const char *appName, const char *userName, const char *passwd, const char *ip_address, int port) |
int | Simulator_ReadAD (int ad_channel) |
int | Simulator_ReadDI () |
int | Simulator_ReadDO () |
void | Simulator_WriteDO (int value) |
void | Simulator_Delay (int value_ms) |
VOID CALLBACK | TimerCallback (PVOID lParam1, BOOLEAN timerOrWaitFired) |
int | Simulator_SetTimerInterrupt (int timer_number, int tm_ms, void(*Fn)()) |
Variables | |
HANDLE | hTimers [N_MAX_TIMERS] ={NULL,NULL,NULL,NULL} |
#define MAX_AD_INPUTS 8 |
#define MAX_AD_OUTPUTS 8 |
#define MAX_COUNTER_INPUTS 8 |
#define MAX_PWM_OUTPUTS 8 |
bool ProcessIsPresent | ( | const char * | procName | ) |
int Simulator_ConnectWss | ( | const char * | appName, |
const char * | userName, | ||
const char * | passwd, | ||
const char * | ip_address, | ||
int | port | ||
) |
Conectar con el simulador: ejecutar una sola vez en main con los datos siguientes:
appName | = nombre de la aplicación ("Piston", "Feedback", etc.) |
userName | = usuario autorizado para la apicación ("alumno") |
passwd | = clave para el usuario ("ISAUNIOVI") |
ip_address | = dirección ip del servidor ("127.0.0.1" para servidor local) |
port | = puerto del servidor (8080 para servidor local) Ejemplo: int err=Simulator_ConnectWss("Piston","alumno","ISAUNIOVI","127.0.0.1",8080); if (err==CONNECT_IS_OK) { ... } |
void Simulator_Delay | ( | int | value_ms | ) |
int Simulator_ReadAD | ( | int | ad_channel | ) |
int Simulator_ReadDI | ( | ) |
int Simulator_ReadDO | ( | ) |
int Simulator_SetTimerInterrupt | ( | int | timer_number, |
int | tm_ms, | ||
void(*)() | Fn | ||
) |
void Simulator_WriteDO | ( | int | value | ) |
VOID CALLBACK TimerCallback | ( | PVOID | lParam1, |
BOOLEAN | timerOrWaitFired | ||
) |
void * WssCheckSimulatorThread | ( | void * | param | ) |
void WssEventHandler | ( | struct mg_connection * | conn, |
int | ev, | ||
void * | ev_data, | ||
void * | fn_data | ||
) |
HANDLE hTimers[N_MAX_TIMERS] ={NULL,NULL,NULL,NULL} |