You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.6 KiB
C

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//
//////////////////////////////////////////////////////////////////////
#if !defined(_BASEFUNC_H_200506101543__INCLUDED_)
#define _BASEFUNC_H_200506101543__INCLUDED_
#include "basetype.h"
DSLIB_API void DebugPrint(char *szDebug);
// 字符串操作
DSLIB_API int CmpString(const u_char *str1, const u_char *str2);
DSLIB_API int CmpString2(const char *str1, const char *str2);
BOOL IsRemarkLine(const char *str);
// 字节转换
/*! RTU字节顺序为低字节在前高字节在后
NET字节顺序为高字节在前低字节在后
*/
DSLIB_API BOOL IsNetSequence();
DSLIB_API BOOL SequenceHostToRtu(char *pData, int ilen);
DSLIB_API BOOL SequenceRtuToHost(char *pData, int ilen);
DSLIB_API BOOL SequenceHostToNet(char *pData, int ilen);
DSLIB_API BOOL SequenceNetToHost(char *pData, int ilen);
// 超时判断
BOOL JudgeTimeOut(DAY_TIME *pStartTime, int iTimeOutSeconds);
BOOL GetLocalTimeEx(DAY_TIME *ptrDateTime);
void SetLocalTimeEx(DAY_TIME *ptrDateTime);
float SequenceRtuToHostfloat(float fValue);
_int64 SystemTimeToMillseconds(DAY_TIME *lpTime, int i8HourOffset);
float SequenceHostToRtufloat(float fValue);
int StringCutSpace(char *str);
u_long atoul(char *buf);
void StringToUpper(char *buf);
void StringToLower(char *buf);
void PrintFormatMessage(int iMsgClass, char *ptrMsg);
void SwapByteSequence(char *pData, int ilen);
BOOL CheckTcpIpAddr(char *addr);
WORD SequenceHostToRtuWord(WORD wValue);
WORD SequenceRtuToHostWord(WORD wValue);
WORD CalCheckout(u_char *buf, int len);
long SequenceHostToRtulong(long lValue);
int SequenceHostToRtuint(int iValue);
DWORD SequenceHostToRtuDWord(DWORD dwValue);
DWORD SequenceRtuToHostDWord(DWORD dwValue);
#endif // !defined(_BASEFUNC_H_200506101543__INCLUDED_)