Commit e2acd1ad6de9180c76242b20f789405f1c0b9ba9
- Diff rendering mode:
- inline
- side by side
config.h
(24 / 0)
|   | |||
| 1 | #ifndef DIGITAL_STROM_SERVER_CONFIG_H | ||
| 2 | #define DIGITAL_STROM_SERVER_CONFIG_H | ||
| 3 | |||
| 4 | #define DSS_VERSION "0.8-dev" | ||
| 5 | |||
| 6 | /* SpiderMonkey API header */ | ||
| 7 | #define HAVE_STDINT | ||
| 8 | /* #undef HAVE_MOZJS_JSAPI_H */ | ||
| 9 | /* #undef HAVE_JS_JSAPI_H */ | ||
| 10 | #define HAVE_JSAPI_H | ||
| 11 | #define HAVE_LIBICAL_ICAL_H | ||
| 12 | /* #undef HAVE_ICAL_H */ | ||
| 13 | /* #undef HAVE_DNS_SD */ | ||
| 14 | #define HAVE_AVAHI | ||
| 15 | #define WITH_SIM | ||
| 16 | #define WITH_TESTS | ||
| 17 | #define WITH_DATADIR "/usr/local/share/dss/data" | ||
| 18 | #define WITH_CONFIGDIR "/usr/local/share/dss/data" | ||
| 19 | #define WITH_WEBROOTDIR "/usr/local/share/dss/data/webroot" | ||
| 20 | #define WITH_JSLOGDIR "/usr/local/share/dss/data/logs" | ||
| 21 | #define WITH_BONJOUR | ||
| 22 | /* #undef WITH_GCOV */ | ||
| 23 | |||
| 24 | #endif /* DIGITAL_STROM_SERVER_CONFIG_H */ |
core/ds485-socket/ds485c.h
(132 / 0)
|   | |||
| 1 | #ifndef DS485C_H_ | ||
| 2 | #define DS485C_H_ | ||
| 3 | |||
| 4 | #ifdef __cplusplus | ||
| 5 | extern "C" { | ||
| 6 | #endif | ||
| 7 | /** | ||
| 8 | * 96-Bit dSID | ||
| 9 | */ | ||
| 10 | typedef struct { | ||
| 11 | unsigned char value[12]; | ||
| 12 | } dsidType; | ||
| 13 | |||
| 14 | |||
| 15 | #define compareDSID(oDSID1,oDSID2) ((oDSID1.value[0]==oDSID2.value[0]) && \ | ||
| 16 | (oDSID1.value[1]==oDSID2.value[1]) && \ | ||
| 17 | (oDSID1.value[2]==oDSID2.value[2]) && \ | ||
| 18 | (oDSID1.value[3]==oDSID2.value[3]) && \ | ||
| 19 | (oDSID1.value[4]==oDSID2.value[4]) && \ | ||
| 20 | (oDSID1.value[5]==oDSID2.value[5]) && \ | ||
| 21 | (oDSID1.value[6]==oDSID2.value[6]) && \ | ||
| 22 | (oDSID1.value[7]==oDSID2.value[7]) && \ | ||
| 23 | (oDSID1.value[8]==oDSID2.value[8]) && \ | ||
| 24 | (oDSID1.value[9]==oDSID2.value[9]) && \ | ||
| 25 | (oDSID1.value[10]==oDSID2.value[10]) && \ | ||
| 26 | (oDSID1.value[11]==oDSID2.value[11])) | ||
| 27 | |||
| 28 | /** | ||
| 29 | * Status des dS485 Bus | ||
| 30 | */ | ||
| 31 | typedef enum { | ||
| 32 | DSBUS_ISOLATED, | ||
| 33 | DSBUS_INACTIVE, | ||
| 34 | DSBUS_ACTIVE | ||
| 35 | } BusState_t; | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Typ des dS485Packets | ||
| 39 | */ | ||
| 40 | typedef enum { | ||
| 41 | DSTELEGRAM_REQUEST, | ||
| 42 | DSTELEGRAM_RESPONSE, | ||
| 43 | DSTELEGRAM_EVENT | ||
| 44 | } ContainerType_t; | ||
| 45 | |||
| 46 | /** | ||
| 47 | * dS485 API Daten Container | ||
| 48 | */ | ||
| 49 | typedef struct _dS485Container { | ||
| 50 | |||
| 51 | dsidType destination; | ||
| 52 | ContainerType_t containerType; | ||
| 53 | unsigned int length; | ||
| 54 | unsigned char data[128]; | ||
| 55 | } dS485Container; | ||
| 56 | |||
| 57 | /** | ||
| 58 | * Callback Methoden | ||
| 59 | */ | ||
| 60 | typedef int (*client_callback_state_t)(int clientIndex, const BusState_t state); | ||
| 61 | typedef int (*client_callback_container_t)(int clientIndex, const dS485Container pFrame); | ||
| 62 | |||
| 63 | |||
| 64 | /** | ||
| 65 | * Opens a connection using the specified connection type | ||
| 66 | * | ||
| 67 | * @CONNSPEC: | ||
| 68 | * | ||
| 69 | * serial:/dev/ttyUSB0 | ||
| 70 | * tcp:localhost:8442 | ||
| 71 | * udp:10.0.230.87:8442 | ||
| 72 | * unix:/tmp/ds485.socket | ||
| 73 | * | ||
| 74 | * @RETURN: | ||
| 75 | * negative value on failure | ||
| 76 | * positive value is the client index | ||
| 77 | */ | ||
| 78 | extern int ds485_client_open(const char *connspec); | ||
| 79 | |||
| 80 | /** | ||
| 81 | * Closes the session, frees all connection related resources | ||
| 82 | */ | ||
| 83 | extern int ds485_client_close(int clientIndex); | ||
| 84 | |||
| 85 | /** | ||
| 86 | * | ||
| 87 | */ | ||
| 88 | extern int ds485_client_num_connections(); | ||
| 89 | |||
| 90 | /** | ||
| 91 | * Query the list of devices on the dS485 bus | ||
| 92 | */ | ||
| 93 | extern int ds485_client_query_devices(int clientIndex, int maxListItems, int *pNumDevices, dsidType *pList); | ||
| 94 | |||
| 95 | /** | ||
| 96 | * Query the current bus state | ||
| 97 | */ | ||
| 98 | extern int ds485_client_query_state(int clientIndex, int maxConnSpecSize, char** connspec, BusState_t *state); | ||
| 99 | |||
| 100 | /** | ||
| 101 | * Send dM-API command | ||
| 102 | */ | ||
| 103 | extern int ds485_client_send_command(dS485Container *pCommand); | ||
| 104 | |||
| 105 | /** | ||
| 106 | * Send dM-API command, receive a single response packet | ||
| 107 | */ | ||
| 108 | extern int ds485_client_send_sync_command(dS485Container *pCommand, dS485Container *pResponse); | ||
| 109 | |||
| 110 | /** | ||
| 111 | * Set and remove a reception handler for dS485 Packet's, optional a filter for a message id can be given | ||
| 112 | */ | ||
| 113 | extern int ds485_client_set_receive_callback(client_callback_container_t cb); | ||
| 114 | extern int ds485_client_clear_receive_callback(client_callback_container_t cb); | ||
| 115 | |||
| 116 | /** | ||
| 117 | * Set and remove a callback handler to register for bus state changes | ||
| 118 | */ | ||
| 119 | extern int ds485_client_set_state_callback(client_callback_state_t cb); | ||
| 120 | extern int ds485_client_clear_state_callback(client_callback_state_t cb); | ||
| 121 | |||
| 122 | /** | ||
| 123 | * Send dM-API command | ||
| 124 | */ | ||
| 125 | extern int ds485_get_dsid_state(dsidType dSID); | ||
| 126 | |||
| 127 | #ifdef __cplusplus | ||
| 128 | } | ||
| 129 | #endif | ||
| 130 | |||
| 131 | |||
| 132 | #endif /* DS485C_H_ */ |

