-
Notifications
You must be signed in to change notification settings - Fork 3
/
rwwattson.h
executable file
·83 lines (60 loc) · 1.49 KB
/
rwwattson.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* openwattson - rwwattson.h
* Include file for the openwattson read and write functions
* including the data conversion functions
* version 0.1
*/
#ifndef _INCLUDE_RW_WATTSON_H_
#define _INCLUDE_RW_WATTSON_H_
#ifdef WIN32
#include "winwattson.h"
#endif
#ifndef WIN32
#include "linuxwattson.h"
#endif
#include <string.h>
#include <fcntl.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#define MAXRETRIES 5
#define REPLY_BUF_SIZE 20
typedef struct {
char name[50];
int port;
} hostdata;
struct config_type
{
char serial_device_name[50];
};
struct timestamp
{
int minute;
int hour;
int day;
int month;
int year;
};
/* Wattson read functions */
int get_current_power_with_retry(WATTSON wattson);
int get_current_generated_power_with_retry(WATTSON wattson);
int get_current_power(WATTSON wattson);
int get_current_generated_power(WATTSON wattson);
/* Generic functions */
void read_error_exit(void);
void write_error_exit(void);
void print_usage(void);
int get_configuration(struct config_type *, char *path);
WATTSON open_wattson(char *device);
void close_wattson(WATTSON ws);
unsigned char data_checksum(unsigned char *data, int number);
int initialize(WATTSON wattson);
/* Platform dependent functions */
int writeport(WATTSON fd, char *chars);
int readport(WATTSON fd, char *result);
int getbaud(WATTSON fd);
void mySleep(int microseconds);
#endif /* _INCLUDE_RWWATTSON_H_ */