四、獲取板卡序列號
VC++ Code: 這段代碼並不在Net Server Demo項目裡面,而是在System Demo(Src\SysDemoSource)項目裡。
BoardList.cpp
char str[100];
char sn[12+1];
m_list.DeleteAllItems();
boardCount=GetBoardCount();
for(UINT board=0;board<boardCount;board++)
{
GetBoardDetail (board,&boardDetail);
for(UINT i=0;i<12;i++)
sn[i]=boardDetail.sn[i]+0x30;
sn[12]=0;
sprintf (str,"Board:%2u Type:%s,SN:%s",
board,boardType[boardDetail.type],sn);
C# Code:
/// <summary>
/// 獲取板卡序號
/// </summary>
/// <returns></returns>
public static string GetBoardSN()
{
uint boardCount = HikVisionSDK.GetBoardCount();
StringBuilder sn = new StringBuilder ();
for (uint i = 0; i < boardCount; )
{
DS_BOARD_DETAIL boardDetail = new DS_BOARD_DETAIL();
HikVisionSDK.GetBoardDetail(i, ref boardDetail);
for (int j = 0; j < 12; j++)
{
sn.Append((char) (boardDetail.sn[j] + 0x30));
}
break;
}
return sn.ToString();
}
代碼說明:
1.注意 結構體用ref;以及boardDetail.sn[j]的類型轉換。
結束
服務器端和客戶端一樣三篇文章,至此結束,接下來是播放器。感謝 大家繼續關注該系列文章!!
五、文章後期維護
5.1 2010-10-9 OSD顯示漢字辦法
來自博客園的另一朋友站在巨人的肩上,如下可顯示漢字:
漢字"保"的機器內碼是"B1A3H",將如下代碼替換:
替換前:new ushort[]{ 48, 16, 'H', 'I', 'K', 'V', 'I', 'S', 'I', 'O', 'N', '\0' };
替換後:new ushort[]{ 48, 16, 0xB1A3, 'I', 'K', 'V', 'I', 'S', 'I', 'O', 'N', '\0' };
這樣就能顯示漢字了,這裡再次感謝,也歡迎大家分享和交流!