feat: GeViScope SDK integration with C# Bridge and Flutter app
- Add GeViScope Bridge (C# .NET 8.0) on port 7720 - Full SDK wrapper for camera control, PTZ, actions/events - 17 REST API endpoints for GeViScope server interaction - Support for MCS (Media Channel Simulator) with 16 test channels - Real-time action/event streaming via PLC callbacks - Add GeViServer Bridge (C# .NET 8.0) on port 7710 - Integration with GeViSoft orchestration layer - Input/output control and event management - Update Python API with new routers - /api/geviscope/* - Proxy to GeViScope Bridge - /api/geviserver/* - Proxy to GeViServer Bridge - /api/excel/* - Excel import functionality - Add Flutter app GeViScope integration - GeViScopeRemoteDataSource with 17 API methods - GeViScopeBloc for state management - GeViScopeScreen with PTZ controls - App drawer navigation to GeViScope - Add SDK documentation (extracted from PDFs) - GeViScope SDK docs (7 parts + action reference) - GeViSoft SDK docs (12 chunks) - Add .mcp.json for Claude Code MCP server config Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
289
GeViSoft_SDK_Docs/chunk_008_pages_71-80.txt
Normal file
289
GeViSoft_SDK_Docs/chunk_008_pages_71-80.txt
Normal file
@@ -0,0 +1,289 @@
|
||||
|
||||
================================================================================
|
||||
PAGE 71
|
||||
================================================================================
|
||||
|
||||
char*buffer;
|
||||
constintbufferlength =GEVI_MAXACTIONLENGTH;
|
||||
intnumBytesReceived;
|
||||
buffer=newchar[bufferlength];
|
||||
gevimessage- >WriteASCIIMessage (buffer,
|
||||
bufferlength,
|
||||
numBytesReceived);
|
||||
std::cout <<buffer<<std::endl;
|
||||
4.Example ofcreating aGeViScope Action Message
|
||||
GeViScope messages canalsobecreatedinsideGeViSoftdirectly.Thisisneededtoallow
|
||||
theinteroperability ofGeViSoftandGeViScope.
|
||||
TheGeViScope messageconstructors canbefoundintheGscActions header.Theyare
|
||||
implemented insidetheGscActions DLL.GscActions canbecreatedbycallingtheCActG-
|
||||
scActionconstructor:
|
||||
CGeViMessage* gevimessage =newCActGscAction (
|
||||
"YourGscServerName" ,
|
||||
GscAct_CreateCustomAction (1,L"HelloGeViScope!" ));
|
||||
NOTICE
|
||||
Pleasenotethat“GscServerNameAlias” isthealiasnameyouconfigured fortheconnection in
|
||||
GeViSet.
|
||||
Sending ActionMessages
|
||||
ThenextexampleshowsyouhowtosendamessagetotheGeViSoftserver.Asapre-
|
||||
requisite,aGeViAPIClient objectmustalreadybecreatedandconnected totheserver.
|
||||
C++Example:
|
||||
GeViAPIClient* m_APIClient
|
||||
|
||||
================================================================================
|
||||
PAGE 72
|
||||
================================================================================
|
||||
|
||||
//mustalready becreated andconnected
|
||||
/*
|
||||
…
|
||||
*/
|
||||
CGeViMessage* gevimessage =newCActCustomAction (
|
||||
123,"HelloGeViSoft!" );
|
||||
if(gevimessage)
|
||||
{
|
||||
m_APIClient- >SendMessage (gevimessage);
|
||||
//Don’tforgettodeleteobjects youcreateinsidetheDLL
|
||||
gevimessage- >DeleteObject ();
|
||||
}
|
||||
Receiving ActionMessages
|
||||
ThisexampleshowsyouhowtoreceiveamessagefromGeViSoft. Asaprerequisite, aGeVi-
|
||||
APIClient objectmustalreadybecreatedandconnected totheserver.Furthermore, adata-
|
||||
basenotification callbackfunctionmustbedefined.Thiscallbackfunctionwillbecalledfrom
|
||||
insidetheGeViProcAPI DLLwhenever anotification fromtheserverisreceived.
|
||||
Pseudo code
|
||||
1.Definethecallback
|
||||
2.Definethecallback’s handlermethod
|
||||
3.RegisteryourcallbackwiththeGeViAPIClient connection’s object.
|
||||
4.Handlethereceivednotifications inyouhandlermethod.
|
||||
C++Example:
|
||||
1.Define thecallback
|
||||
|
||||
================================================================================
|
||||
PAGE 73
|
||||
================================================================================
|
||||
|
||||
void__stdcall GeViDatabaseNotificationCB (void*Instance,
|
||||
TServerNotification Notification,
|
||||
void*Params)
|
||||
{
|
||||
if(Instance ==NULL)
|
||||
return;
|
||||
//calling thecallback methodofyourClass object's instance.
|
||||
//Asanexample, CYourClass mightbeCMainWin foranMFCApplication
|
||||
CYourClass* yourClass =(CYourClass*) Instance;
|
||||
yourClass- >DatabaseNotification (Notification, Params);
|
||||
}
|
||||
2.Define thecallback’s method
|
||||
voidDatabaseNotification (TServerNotification Notification,
|
||||
void*Params)
|
||||
{
|
||||
//Checkifwereceived amessage. Itmightalsobeanother
|
||||
//notification likeachangeofsetuporshutdown oftheserver
|
||||
if(Notification ==NFServer_ NewMessage)
|
||||
{
|
||||
//createthemessage ifpossible
|
||||
//(themessage isfreedagaininthemainthreadcontext)
|
||||
CGeViMessage* gevimessage;
|
||||
TMessageEntry* messageEntry =
|
||||
reinterpret_ cast<TMessageEntry*> (Params);
|
||||
intnoOfBytesRead =0;
|
||||
gevimessage =CGeViMessage::ReadBinMessage (
|
||||
messageEntry- >Buffer,
|
||||
messageEntry- >Length,
|
||||
noOfBytesRead);
|
||||
if(gevimessage)
|
||||
{
|
||||
//Youreceived amessage! Nowyouneedtohandleit.
|
||||
//Thiscanbedonehere.
|
||||
}
|
||||
else
|
||||
|
||||
================================================================================
|
||||
PAGE 74
|
||||
================================================================================
|
||||
|
||||
{
|
||||
//Message couldnotbecreated. Handletheerrorhere.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Ifwearehere,wereceived another typeofnotification
|
||||
}
|
||||
}
|
||||
3.Register yourcallback withtheconnection object.
|
||||
m_APIClient =newGeViAPIClient ( ...);
|
||||
if(m_APIClient)
|
||||
{
|
||||
//connect totheserver
|
||||
TConnectResult ConnectResult =
|
||||
m_APIClient- >Connect (ConnectProgressCB, this);
|
||||
if(ConnectResult ==connectOk)
|
||||
{
|
||||
//Connection established! Nowregister yourcallback!
|
||||
m_APIClient- >SetCBNotification (
|
||||
GeViDatabaseNotificationCB, this);
|
||||
}
|
||||
}
|
||||
Disconnecting fromaGeViServer
|
||||
Whendisconnecting fromtheserver,youshouldunregister yournotification callbackand
|
||||
deletetheGeViAPIClient object.
|
||||
C++Example:
|
||||
voidDisconnectFromServer ()
|
||||
{
|
||||
|
||||
================================================================================
|
||||
PAGE 75
|
||||
================================================================================
|
||||
|
||||
if(m_APIClient !=NULL)
|
||||
{
|
||||
//Unregister thenotification callback
|
||||
m_APIClient- >SetCBNotification (NULL,NULL);
|
||||
m_APIClient- >Disconnect ();
|
||||
deletem_APIClient;
|
||||
m_APIClient =NULL;
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
PAGE 76
|
||||
================================================================================
|
||||
|
||||
StateQueries
|
||||
StateQueriesaremessages sentfromtheclienttotheservertogetinformation aboutthe
|
||||
stateoflogicalandphysicalcomponents oftheGeViSoftsystemwellasvirtualressources.
|
||||
Anexampleofsuchinformation wouldbeanenumeration ofallthevideoinputsavailableata
|
||||
GeViServer.
|
||||
Creating StateQueries
|
||||
Youcancreateastatequerybycallingitspredefined constructor. Allthestatequeries’con-
|
||||
structorsarelocatedintheStateQueries header,C++,andPascalfiles.
|
||||
StatequeriescanthenbesentwiththeSendStateQuery ()methodoftheGeViAPIClient
|
||||
class.ThismethodreturnsaCStateAnswer objectwiththeGeViServer’s response.
|
||||
CStateAnswer* StateAnswer =m_APIClient- >SendStateQuery (
|
||||
GetFirstVideoInputQuery, INFINITE);
|
||||
Thesecondparameter ofthemethodisthetimeoutforaserveranswerinmilliseconds. By
|
||||
sendingINFINITE,youcanpreventthecallfromtimingout.
|
||||
Creating, sending, andreceiving statequeries isimplemented intheSDK’sexam-
|
||||
pleDelphi/CPP_ SimpleClient.
|
||||
Enumeration ofallvideoinputs
|
||||
Pseudo code
|
||||
1.Createastatequerytogetthefirstvideoinput(classCSQGetFirstVideoInput)
|
||||
2.Sendthequerytotheserver
|
||||
|
||||
================================================================================
|
||||
PAGE 77
|
||||
================================================================================
|
||||
|
||||
3.If theanswerisavalidinputchannelthen
|
||||
4.REPEAT
|
||||
a)Gettheactualchannel’s information fromtheanswerandprocessitasneeded(e.g.
|
||||
printitout,storeittoalist)
|
||||
b)CreateastatequerytogetthenextvideoInput(classCSQGetNextVideoInput)
|
||||
c)Sendthequery
|
||||
5.UNTILthereisnomorevideoinputleft
|
||||
C++Example:
|
||||
voidCMainWin::FillVideoInputsList ()
|
||||
{
|
||||
if(m_APIClient ==NULL)
|
||||
return;
|
||||
//Enumerate allavailable videoinputswiththehelpofstatequeries.
|
||||
//Createanewstatequerythatwillreturnthefirstvideoinputchan-
|
||||
nel:
|
||||
CStateQuery* getFirstVideoInputQuery =newCSQGetFirstVideoInput (
|
||||
true,//showonlyactivechannels
|
||||
true);//showonlyenabled channels
|
||||
if(getFirstVideoInputQuery)
|
||||
{
|
||||
//Sendthequerytotheserver
|
||||
CStateAnswer* stateAnswer =m_APIClient- >SendStateQuery (
|
||||
getFirstVideoInputQuery,
|
||||
INFINITE); //Timeout
|
||||
//Don'tforgettofreethememoryinsidetheDLL...
|
||||
getFirstVideoInputQuery- >DeleteObject ();
|
||||
if(stateAnswer)
|
||||
{
|
||||
//Iterate through allavailable videoinputchannels
|
||||
|
||||
================================================================================
|
||||
PAGE 78
|
||||
================================================================================
|
||||
|
||||
while(stateAnswer- >m_AnswerKind !=sak_Nothing)
|
||||
{
|
||||
//Getthechannels info
|
||||
CSAVideoInputInfo* videoInputInfo =
|
||||
reinterpret_ cast<CSAVideoInputInfo*> (stateAnswer);
|
||||
//createavideoinputdescriptor
|
||||
TVideoInputDescriptor* newVideoInput =new
|
||||
TVideoInputDescriptor (videoInputInfo- >m_GlobalID,
|
||||
videoInputInfo- >m_Name,
|
||||
videoInputInfo- >m_Description,
|
||||
videoInputInfo- >m_HasPTZHead,
|
||||
videoInputInfo- >m_HasVideoSensor,
|
||||
videoInputInfo- >m_HasContrastDetection,
|
||||
videoInputInfo- >m_HasSyncDetection);
|
||||
//Dosomething withthechannel information. Here:
|
||||
//Addthechannel information toa
|
||||
//CListBox lbVideoInputs
|
||||
intnewIndex =lbVideoInputs.AddString (
|
||||
newVideoInput- >m_Name.c_str());
|
||||
lbVideoInputs.SetItemDataPtr (newIndex, newVideoInput);
|
||||
//Createaquerytogetthenextinputchannel
|
||||
CStateQuery* getNextVideoInputQuery =new
|
||||
CSQGetNextVideoInput (true,true,
|
||||
videoInputInfo- >m_GlobalID);
|
||||
stateAnswer- >DeleteObject ();
|
||||
stateAnswer =NULL;
|
||||
if(getNextVideoInputQuery)
|
||||
{
|
||||
stateAnswer =
|
||||
m_APIClient- >SendStateQuery (
|
||||
getNextVideoInputQuery, INFINITE);
|
||||
getNextVideoInputQuery- >DeleteObject ();
|
||||
if(!stateAnswer)
|
||||
break;
|
||||
}
|
||||
else//Nomorevideoinputchannel detected!
|
||||
break;
|
||||
}
|
||||
if(stateAnswer)
|
||||
|
||||
================================================================================
|
||||
PAGE 79
|
||||
================================================================================
|
||||
|
||||
{
|
||||
stateAnswer- >DeleteObject ();
|
||||
stateAnswer =NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
================================================================================
|
||||
PAGE 80
|
||||
================================================================================
|
||||
|
||||
Database Queries (optional)
|
||||
Database queriesallowyoutofetchdatasetsfromtheactionoralarmtableoftheGeViSoft
|
||||
activitydatabase. Alltheactionsthathavebeenreceivedandallthealarmeventsthat
|
||||
occurredarestoredinsidethedatabase. Tospecifyandnarrowdownyourqueryresults,sev-
|
||||
eralfilteroperations areavailableaswell.
|
||||
Togetfamiliar withthepossibilities ofGeViSoft’s database queries, andespe-
|
||||
ciallyitsfiltering options, please havealookattheGeViAPI TestClient’s “Data-
|
||||
baseViewer” and“Database Filter” tabs.
|
||||
Creating Database Queries
|
||||
Youcancreateadatabasequerybycallingitspredefined constructor. Allthedatabaseque-
|
||||
ries’constructors arelocatedintheDatabaseQueries header,C++,andPascalfiles.
|
||||
Database queriescanthenbesentwiththeSendDatabaseQuery ()methodoftheGeVi-
|
||||
APIClient class.ThismethodreturnsaCDataBaseAnswer objectwiththeGeViServer’s
|
||||
response.
|
||||
CDataBaseQuery* geviquery =newCDBQCreateActionQuery (0);
|
||||
CDataBaseAnswer* dbAnswer =m_APIClient- >SendDatabaseQuery (geviquery, INFI-
|
||||
NITE);
|
||||
Thesecondparameter ofthemethodisthetimeoutforaserveranswerinmilliseconds. By
|
||||
sendingINFINITE,youcanpreventthecallfromtimingout.
|
||||
Database QuerySession Handling
|
||||
Actionsendingandstatequeryingdidnotneedanyformofsessionhandling.Thisisdifferent
|
||||
fordatabasequerying.Usuallyyouwanttocollectseveralrecordsthatareconnected in
|
||||
Reference in New Issue
Block a user