// Using the C API directly to configure the event reporter
let configRef = ARKEventReporterConfigurationCreate()!
let envRef = ARKEnvironmentCopyNamed("com.real.PROD")
ARKEventReporterConfigurationSetObject(configRef, ARKEventReporterConfigurationKey(kARKEventReporterConfigurationKey_Environment.rawValue), envRef)
let userRef = ARKUserCreate("<Username>", "<Password>")
ARKUserSetDirectory(userRef, "main")
ARKEventReporterConfigurationSetObject(configRef, ARKEventReporterConfigurationKey(kARKEventReporterConfigurationKey_User.rawValue), userRef)
ARKObjectRelease(userRef);
ARKObjectRelease(envRef)
// Configure all the desired properties here
ARKEventReporterConfigurationSetString(configRef, ARKEventReporterConfigurationKey(kARKEventReporterConfigurationKey_SiteID.rawValue), "Building 1")
ARKEventReporterConfigurationSetString(configRef, ARKEventReporterConfigurationKey(kARKEventReporterConfigurationKey_SourceID.rawValue), "Camera 1!")
var eventReporterRef = ARKEventReporterCreate(configRef, true)
ARKObjectRelease(configRef)
ARKEventReporterBeginReporting(eventReporterRef)
The steps below highlight the integration points with the application view controller and the ArgusKit Swift classes.
Create an EventReporter and configure it for reporting. In the function configureArgusKitController(), locate the following code, which demonstrates how to create and configure the Event Reporter.
// Begin: Event Reporting - This code is only needed if the application wants to report events in the video
//
// Load the event reporter configuration from the preferences.
let eventReporterConfiguration = EventReporterConfiguration.eventReporterConfigurationFromAppPreferences()
// Create the event reporter with the specified configuration
argusKitController.createEventReporter(withConfiguration: eventReporterConfiguration)
updateReportEvents()
//
// End: Event reporting
Update the reporting state of the event reporter. The function beginReporting enables event reporting and the endReporting function disables event reporting. The sample app demonstrates the ability to enable and disable event reporting on the fly.
private func updateReportEvents() {
if !argusKitController.isReportingEvents {
if AppPreferences.sharedAppPreferences.eventReporterReportEvents {
argusKitController.beginReporting()
}
}
else {
if !AppPreferences.sharedAppPreferences.eventReporterReportEvents {
argusKitController.endReporting()
}
}
}
For more information, look in the class CameraViewController for comments that begin with // ArgusKit: Integration Point
.