================================================================================ PAGE 51 ================================================================================ Prerequisites 1.PleasesetuptheGeViScope SDKonyourdevelopment machineifyouhavenotdone ityet. 2.Configure GscViewasdescribed inthechapterRemotecontrolGscView byactionin theGeViScope SDKdocumentation. CheckthatfromGSCPLCSimulator youcan switchbetweenthescenes. 3.Configure aconnection toGeViScope asdescribed inConnection toGeViScope (optional). 4.YoushouldnowhaveaGscViewsetupwithtwoscenes:MyStartScene andMyScene thatcanberemotecontrolled. Configuring theAlarm 1.Configure thealarmasdescribed inConfiguring anAlarm. 2.Afterthat,themonitorgroupmustbemappedtoaGscViewScene.GeViSoftusesthe CrossSwitchWithAlarm actiontoroutethevideotothemonitorgroupinternally. There- foretheseactionsmustbemappedtoGSCViewer Controlactions(e.g.VCChange SceneByName).ThisisdoneinGeViSetbyaddinganewActionmapping: c)Thischangesthesceneintheviewer.Afterthat,channel4mustberoutedto viewer1101inthescene.Forthat,addanotheroutputactiontothesetbypressing the+button: d)AddtheViewerconnectliveactionwiththeGeviScope alias=GEVISCOPE ,the viewer=1101,thechannel=4,andCaption=ViewerConnectLive (1101,4) ================================================================================ PAGE 52 ================================================================================ a)AsInputactionselectCrossSwitchWithAlarm withVideoInput =4,VideoOutput = 1,andCaption=CrossSwitchWithAlarm (4,1) b)Tochangethesceneintheviewertherearedifferentpossibilities. Youcaneither callVCChangeSceneByName ordirectlyconnectalivestreamtoaviewernumber. ThisisdonebysendingaViewerConnectLive action.Here,channel4mustbe routedtoviewer1101inthescene.Forthat,addanoutputactiontothesetbypress- ingthe+button: c)AddtheViewerconnectliveactionwiththeGeviScope alias=GEVISCOPE ,the viewer=1101,thechannel=4,andCaption=ViewerConnectLive (1101,4) d)TheActionmappingsettingswindowshouldlooklikethis: ================================================================================ PAGE 53 ================================================================================ Switching Video1 e)NowrepeattheprocessfortheCrossSwitchWithAlarm actionforvideoinput7 andviewer1102. ================================================================================ PAGE 54 ================================================================================ f)Ifexecuted, themappings abovewillswitchthescenetoMySceneinGscView androutethevideochannelstotherespective viewer.Execution oftheCross- SwitchWithAlarm actionstakesplaceatthemomentoftriggeringthealarminGeV- iSoft. 3.Afterquittingthealarmthe4-by-4sceneMyStartScene mustbereloadedinGscView, according tothescenario.ThiscanbedoneasanOnquitactionoftheGeViSetalarm: a)IntheGeViSet AlarmsettingsoftheParkingLot alarm,addaVCchangesceneby nameactiontotheOnquitlist. ================================================================================ PAGE 55 ================================================================================ b)ChosetheactionfromGSC:VieweractionandsetGeviScope aliastoGEV- ISCOPE,viewerto1000,scenetoMyStartScene ,andCaptiontoVCChan - geSceneByName (1000,MyStartScene ). c)Sendthesetuptotheserver. 4.OpenGeViAPITestClientandGscViewtotestyournewconfiguration. Onstarting thealarmbyleftclickinginput1inGeViSet,thesceneshouldswitchtoMyScenein GscViewwithchannel4beingdisplayedinviewer1101andchannel7inviewer1102. Onquittingthealarmbyleftclickinginput3inGeViAPITestClient,thesceneshould switchbacktoMyStartScene . ================================================================================ PAGE 56 ================================================================================ SDKUsage Introduction Itisrecommended tobefamiliarwiththeGeViSoftsystem,thepossibilities ofmodernvideo surveillance systemsandvideomanagement systemsingeneral.Beforestartingpro- gramming yourcustomGeViSoftapplication, youshouldunderstand thebasicsofaction, alarm,andeventhandlinginGeViSoft, aswellastheprinciplesofclient-servernetworkcom- munication. Thefollowingsectionssupportyouwithsomesuggestions andhintsaboutusingtheSDK interfaces. General Hints YoucanalwaysmonitortheactionssentbytheGeViServer oryourapplication insidethe GeViAPITestClient.Furthermore, thisapplication allowsyoutosendactionsanddatabase queries.Itislocatedinthe%GEVISOFTSDKPATH% .  NOTICE Onadevelopment system itisrecommended tostartGeViServer withthestartserver.bat script orfromacommand prompt inconsole mode(geviserver.exe console ).Thisallowsyouto monitor theserver’s outputduringyourdevelopment.  WARNING Makesuretodeleteallobjects thatarecreated insideofDLLs.TheSDKoffersaDeleteObject () method fortheseobjects.  NOTICE ================================================================================ PAGE 57 ================================================================================ Callback functions whicharecalledoutoftheSDKDLLsarecalledfromthreads. Thesewere created insidetheDLLs.Variables andpointers thatarepassed asarguments ofthecallback maynotbeusedoutside thecallback context. Theyareonlyvalidfortheduration ofthecallback call.  NOTICE Structures thatareusedasarguments forSDKfunctions shouldalwaysbeinitialized byuseof thefunction memset ().Ifthestructure contains asizeorstructsize element, thenithastobe initialized withthesizeof()function. ================================================================================ PAGE 58 ================================================================================ Overview oftheSDK’sInterfaces forC++andDelphiusers  NOTICE Thefollowing paragraphs describe theSDKusagefromC++andDelphi. Foradescription ofthe .NetInterfaces seechapter C#and.Netspecifics GeViProcAPI TheSDKisbasedontwoDLLsandthecorresponding headers.TheGeViProcAPI.dll incon- nectionwiththeGSCActions.dll implements alltheSDK’sfunctionality. GSCActions.dll is usedtoallowtheinteroperability betweenGeViSoftandGeViScope. ItmakestheGeV- iScopeactionsavailabletoyourGeViSoftapplication. Thecorresponding headersandPas- calfilesallowyoutoaccessthefunctionsprovidedbytheseDLLsdirectly. GeViSoftisaclient/server architecture andbasedonacentraldatabasemanagedbythe GeViServer. ThisisreflectedinthefunctioncallsprovidedbytheSDK.Therearefourmajor functiontypesdeclaredinGeViProcAPI. Theycanbedistinguished bytheirprefixes: GeViAPI_ Database_ ThesedatabasefunctionsallowyoutointeractwithGeViSoftserverdirectly.Theyare theonesyounormallyusefordeveloping yourapplication. Example:GeViAPI_Database_ Connect()isusedtoconnectyourapplication tothe server. GeViAPI_ DeviceClient_ TheDeviceClient functionsareusedbytheGeViIOclientinternally. Theyareusuallynot ofinterestforSDKdevelopers. GeViAPI_ SetupClient_ ================================================================================ PAGE 59 ================================================================================ TheSetupClient functionsareusedbyGeViSettochangetheserversetup.Theyare usuallynotofinterestforSDKdevelopers. GeViAPI_ Thesearegeneralhelperfunctionsneededforcarryingoutstandardtasksinyourappli- cation. Example:GeViAPI_FreePointer ()to releasememoryallocatedbyyourobjectsinside theDLLthreads. GeViProcAPI providesflatfunctioncallsforcommunicating withaGeViServer. Togiveyoua moreconvenient andobjectorientedoptiontodevelopyourapplication, anotherabstraction layerhasbeenaddedtotheSDK.ThislayerhidestheflatfunctioncallstotheGeViProcAPI fromyou.Itsfunctionality canbefoundintheGeViAPIClient headersandC++files. Foracomprehensive description ofthesefunctions, pleaseconsulttheGeViSoftAPIDoc- umentation whichisdeliveredwiththeGeViSoftAPISDK. GeViAPIClient GeViAPIClient asanabstraction layerusestheflatfunctionsprovidedbyGeViProcAPI and encapsulates themintoaCGeViAPIClient class.Youcaninstantiate anobjectofthisclass anduseitsprovidedmethodstohandlethecommunication withtheGeViServer. Foracomprehensive description ofthesefunctions, pleaseconsulttheGeViSoftAPIDoc- umentation whichisdeliveredwiththeGeViSoftAPISDK. ================================================================================ PAGE 60 ================================================================================ Configuring yourIDEforGeViSoft Projects VisualStudio2008,C++ 1.)AddGeViSoft’s headerandcppfilestoyourproject. (YoucandothisbydragginganddroppingtheGeViScopeSDK\Include folderandtheGeV- iSoftSDK\Include folderfrom%GEVISOFTSDKPATH%\Examples\VS2008CPP toyour project.) 2.)AddtheSDK’sincludefilestoyourprojectbyadding $(GEVISOFTSDKPATH) \Examples\VS2008CPP\GeViScopeSDK\Include and $(GEVISOFTSDKPATH) \Examples\VS2008CPP\GeViSoftSDK\Include toyourConfiguration Properties ->C/C++->General–>Additional IncludeDirectories 3.)IntheConfiguration Properties ->C/C++->Preprocessor tabaddthePreprocessor Def- initionGEVI_GSC_INCLUDE 4.)Intheproject’sproperties TABConfiguration Properties ->Linker->Generaladd $(GEVISOFTSDKPATH) \Examples\VS2008CPP\GeViScopeSDK\lib and $(GEVISOFTSDKPATH) \Examples\VS2008CPP\GeViSoftSDK\lib totheAdditional LibraryDirectories ofyourproject 5.)Intheproject’sproperties TABConfiguration Properties ->Linker->Input->Additional Dependencies addGeViProcAPI.lib andGscActions.lib 6.)MakesurethatyouroutputfilecanfindthepathtoGeViProcAPI andGscActions DLLs. Itisrecommended tosetConfiguration Properties ->Linker->General->OutputFileto $(GEVISOFTSDKPATH) \$(ProjectName).exe orcopytheDLLsintotheapplication’s folder. 7.)SettheConfiguration Properties ->Debugging ->Command toyourexecutables name: