#ifndef _HOST_APP_H_
#define _HOST_APP_H_


#define HOST_SOCKET_DEFAULT_TIMEOUT   1000


extern int host_conn_ctr_all;
extern int host_conn_ctr_ok;

#define RELAY_OFF       0
#define RELAY_ON        1

extern void InitHostApp();
extern int HostCheckIpDevice(CPU_INT32U ip_addr, CPU_INT16U port, CPU_INT32U timeout);
extern NET_SOCK_ID HostConnectSocket(CPU_INT32U ip_addr, CPU_INT16U port, CPU_INT32U timeout, NET_ERR* err);
extern int HostWriteParam(CPU_INT32U ip_addr, CPU_INT16U port, char* param_str, char* param_val, CPU_INT32U timeout);
extern int HostWritePulses(CPU_INT32U ip_addr, CPU_INT32U count, CPU_INT32U len_ms, CPU_INT32U len_pause_ms, CPU_INT32U pause, CPU_INT32U timer);
extern int HostWriteData(NET_SOCK_ID sock, char* str, int len);
extern int HostReadParam(CPU_INT32U ip_addr, CPU_INT16U port, char* param_str, char* param_val, CPU_INT08U maxlen, CPU_INT32U timeout);
extern int HostWriteStr(NET_SOCK_ID sock, char* str);
extern int HostReadLine(NET_SOCK_ID sock, char *str, CPU_INT32U maxlen, CPU_INT32U timeout, NET_ERR *err);
extern int HostRodosSwitch(CPU_INT32U ip_addr, CPU_INT16U port, CPU_INT08U channel, CPU_INT08U state, CPU_INT32U timeout);
extern int HostReadData(NET_SOCK_ID sock, char *str, CPU_INT32U maxlen, CPU_INT32U timeout, NET_ERR *err);
extern int HostWriteDataTimeout(NET_SOCK_ID sock, char* str, int len, CPU_INT32U timeout);
extern int HostMusicPlay(CPU_INT32U sound_ip, int file_index);
extern int HostIsMusicPlaying(CPU_INT32U sound_ip);
extern int HostMusicStop(CPU_INT32U sound_ip);
extern int HostSetVolume(CPU_INT32U sound_ip, int volume);

#endif //_HOST_APP_H_
