委托类进入核心目录
This commit is contained in:
parent
3d0f6a75bb
commit
74bb6e7bfb
|
@ -21,8 +21,6 @@ A* pa=&a;
|
|||
要调用一个成员函数,仅仅有成员函数指针是不够的,还需要一个对象指针,所以要用一个类将两者绑到一起。
|
||||
*/
|
||||
|
||||
#include "Sys.h"
|
||||
|
||||
// 没有参数和返回值的委托
|
||||
typedef void (*Func)(void);
|
||||
// 一个参数没有返回值的委托,一般param参数用作目标对象,调用者用静态函数包装成员函数
|
|
@ -61,7 +61,7 @@ UInt64 Version::ToValue() const
|
|||
{
|
||||
uint v1 = (Major << 16) || Minor;
|
||||
uint v2 = (Build << 16) || Revision;
|
||||
|
||||
|
||||
return ((UInt64)v1 << 32) || (UInt64)v2;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
friend bool operator< (const Version& left, const Version& right);
|
||||
friend bool operator>= (const Version& left, const Version& right);
|
||||
friend bool operator<= (const Version& left, const Version& right);
|
||||
|
||||
|
||||
// 根据版本号反推编译时间
|
||||
DateTime Compile() const;
|
||||
|
||||
|
|
11
Sys.cpp
11
Sys.cpp
|
@ -181,11 +181,11 @@ TSys::TSys()
|
|||
#endif
|
||||
|
||||
Code = 0x0000;
|
||||
Version = 0x0300;
|
||||
Ver = 0x0300;
|
||||
#ifndef TINY
|
||||
Name = "SmartOS";
|
||||
Company = "NewLife_Embedded_Team";
|
||||
BuildTime = "yyyy-MM-dd HH:mm:ss";
|
||||
//BuildTime = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
Interrupt.Init();
|
||||
#endif
|
||||
|
@ -278,9 +278,10 @@ typedef struct
|
|||
void TSys::ShowInfo() const
|
||||
{
|
||||
#if DEBUG
|
||||
byte* ver = (byte*)&Version;
|
||||
debug_printf("%s::%s Code:%04X ", Company, Name, Code);
|
||||
debug_printf("Ver:%x.%x Build:%s\r\n", *ver++, *ver++, BuildTime);
|
||||
//byte* ver = (byte*)&Version;
|
||||
debug_printf("%s::%s Code:%04X ", Company.GetBuffer(), Name.GetBuffer(), Code);
|
||||
//debug_printf("Ver:%x.%x Build:%s\r\n", *ver++, *ver++, BuildTime);
|
||||
debug_printf("Ver:%s Build:%s\r\n", Ver.ToString().GetBuffer(), Ver.Compile().ToString().GetBuffer());
|
||||
debug_printf("SmartOS::");
|
||||
bool IsGD = Get_JTAG_ID() == 0x7A3;
|
||||
if(IsGD)
|
||||
|
|
9
Sys.h
9
Sys.h
|
@ -48,6 +48,8 @@ void assert_failed2(const char* msg, const char* file, unsigned int line);
|
|||
#include "Core\SString.h"
|
||||
#include "Core\Stream.h"
|
||||
#include "Core\DateTime.h"
|
||||
#include "Core\Version.h"
|
||||
#include "Core\Delegate.h"
|
||||
|
||||
/* 引脚定义 */
|
||||
#include "Platform\Pin.h"
|
||||
|
@ -78,11 +80,10 @@ public:
|
|||
uint Clock; // 系统时钟
|
||||
uint CystalClock;// 晶振时钟
|
||||
|
||||
const char* Name; // 系统名称
|
||||
const char* Company; // 系统厂商
|
||||
const char* BuildTime; // 编译时间
|
||||
String Name; // 系统名称
|
||||
String Company; // 系统厂商
|
||||
ushort Code; // 产品代码
|
||||
ushort Version; // 系统版本
|
||||
Version Ver; // 系统版本
|
||||
byte ID[12]; // 芯片ID。
|
||||
ushort DevID; // MCU编码。低字设备版本,高字子版本
|
||||
ushort RevID; // MCU编码。低字设备版本,高字子版本
|
||||
|
|
|
@ -59,7 +59,7 @@ void TinyClient::Open()
|
|||
}
|
||||
|
||||
HardCrc = Crc::Hash16(Buffer(Sys.ID, 16));
|
||||
if(Sys.Version > 1) Encryption = true;
|
||||
if(Sys.Ver.Major > 1) Encryption = true;
|
||||
|
||||
Control->Mode = 0; // 客户端只接收自己的消息
|
||||
Control->Open();
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
// 初始化消息,各字段为0
|
||||
HelloMessage::HelloMessage() : Cipher(1), Key(0)
|
||||
{
|
||||
Version = Sys.Version;
|
||||
Version = Sys.Ver.Major;
|
||||
|
||||
ushort code = _REV16(Sys.Code);
|
||||
Type = Buffer(&code, 2).ToHex();
|
||||
|
|
|
@ -24,7 +24,7 @@ void TokenConfig::Init()
|
|||
Length = Size();
|
||||
ServerIP = 0;
|
||||
|
||||
SoftVer = Sys.Version;
|
||||
SoftVer = Sys.Ver.Major;
|
||||
PingTime = 10;
|
||||
//User[16] = '\0';
|
||||
//Key[15] = '\0';
|
||||
|
|
Loading…
Reference in New Issue