Haiku HaikuHelper script to record IP camera based on PIR motion

cyerye

Member
I trying to use Bosch Gen2 PIR to trigger IP camera to record video. I use SecuritySpy, which is a multi-camera video surveillance application for the Macintosh. Here is the code I am using:
 
//My First attempt to activate camera in SecuritySpy with motion
function onZoneNotReady(zone) {
     if(zone.number == 6) {
          helper.executeAppleScript(controller, 'tell application "SecuritySpy" to active mode "Front Door"');
          helper.executeAppleScript(controller, 'tell application "SecuritySpy" to set motion "Front Door"');
     }
}
 
When I run this script, I get the following message "Unhandled exception in script on line: 7 in function "onZoneNotReady": executeAppleScript(): AppleScript error: SecuritySpy got an error: Application isn’t running."  Is this due to Apple sandboxing?  Is there anyway around this or another way to trigger SecuritySpy to start recording?
 
I know both the IP cameras and SecuritySpy can be controlled with Html commands. This is the html command for SecuritySpy "http://<servername>/++ssControlActiveMode?cameraNum=<camera>".  I'm not sure if HaikuHelper can send an html command. If anyone has any suggestions or could provide some help, I would greatly appreciate it.
 
Because of Apple's sandboxing, we have to whitelist the SecuritySpy app in the next update for it to work. Can you look at the Info.plist file in the app bundle and tell me what the bundle identifier is?

Update: Sorry, missed the part about the HTTP commands. Yes, HaikuHelper can do that and that would be the best way to do this. You can use XMLHTTPRequest to do it.
 
Try:
Code:
var req = new XMLHttpRequest();
req.open("GET","http://<servername>/++ssControlActiveMode?cameraNum=<camera>",true);
req.send();
Then you can just wrap it in a function and reuse it easily for all commands.
 
Here is the Bundle Identifier for SecuritySpy: com.bensoftware.SecuritySpy
 
Whitelisting this app would be great. In the mean time, I used the sample code for http commands and it works.  Thanks for your help.
 
Back
Top