Commit Graph
18 Commits
Author SHA1 Message Date
Isaac Connor a6bb811e97 feat: add audio playback control capability and an ONVIF IP speaker module
An IP speaker is controllable but has none of the capabilities the Controls
table models: nothing moves, focuses or lights up. It plays a sound file it
already holds, selected by a numeric id, and carries an output volume.

Add CanAudioPlay, MinAudioFile, MaxAudioFile and CanAudioVolume to Controls,
with migration zm_update-1.39.21.sql. CanAudioPlay renders one button per
sound id plus a stop button; MinAudioFile/MaxAudioFile bound that range;
CanAudioVolume renders the volume pair. The sound id travels in the command
name (audioPlay12), the way presets already do, because a control button has
no way to attach a separate parameter.

Add ZoneMinder::Control::IPSpeaker driving the device's own HTTP interface,
and a Controls entry for it. Playback goes over the vendor interface rather
than ONVIF because the ONVIF audio output service on this firmware only
describes the output and offers no way to start a stored file.

Measured against a device reporting ONVIF Manufacturer "IPSpeaker" and
firmware CS20-V3.3.45N:

- File ids fall in two windows, 10-14 built-in and 20-30 operator uploads.
  Anything else is refused with result -2, and an id in a window with no file
  uploaded with result -3, so valid_fileid refuses only the former: an empty
  slot is a legitimate id the operator may fill later.
- config=audio.set replaces the whole audio section, so a partial write
  reverts the microphone, codec list and echo-cancellation settings. Every
  volume change reads the section and echoes it back with the new level.
  audio.get also returns outmute, which audio.set rejects, so it is excluded
  from the field list.
- The volume reads back and round-trips, but the device's RTSP audio is a
  pre-volume tap of the playback signal: it is unchanged with outvolume at 0,
  so it cannot confirm the loudspeaker's acoustic output. CanAudioVolume is
  set on the strength of the setting persisting, and both the POD and the
  seed row say the acoustic effect is unconfirmed.

The seed row covers the built-in window only, because a fresh device has
nothing uploaded and the firmware refuses an empty slot.

Adding columns to Controls extends the 43 positional INSERTs in
db/controls.sql, which carry no column list and so must match the column
count exactly.

Tests: scripts/ZoneMinder/t/ip_speaker.t, 32 assertions covering file id
windows, volume clamping and stepping, request building and the whole-section
write. All pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UvTCzCbvGt8xKQRNCSA7o8
(cherry picked from commit d07e552a3c58373f7f0ccebf9aa28adb4d51baa3)
2026-09-11 20:13:02 -05:00
Isaac Connor 0cb15d3418 Remove extra { breaking ptz 2022-04-23 19:29:04 -04:00
Isaac Connor d0ee8dc6fd remove duplicated factor code, define speed so that it doesn't generate an error if not HasSpeed in Control. 2022-03-29 17:19:31 -04:00
r01k 79e041d0f0 Fixed bug that caused 'Call to undefined function Error()' in control_functions.php. Exception was being raised due to logger.php not being included in control_functions.php. 2021-08-20 22:42:57 -04:00
Isaac Connor a9d8e73f68 Change Orientation Enum to use strings instead of numbers as values. Sync them up with what we use in C code 2019-11-29 13:53:46 -05:00
Isaac Connor 1a417952c3 AutoStopTimeOut is part of Monitor, not Control 2019-10-18 14:19:25 -04:00
Isaac Connor 4126554092 Move sendControlCommand out of includes/control_functions.php into Monitor.php. Make it smarted about talking to zmcontrol.pl. Fix sending the quit command 2019-10-08 18:07:33 -04:00
Isaac Connor 7328eb1979 be more robust when sending commands to zmcontrol. Of no commands given don't bother. 2019-10-03 17:30:10 -04:00
Isaac Connor 308236b4ad Fix sending ptz controls 2019-09-20 10:35:39 -04:00
Isaac Connor 3bae7a5432 spaces and parenthesis 2019-06-20 13:28:12 -04:00
Isaac Connor 381f526d66 spacing 2019-04-05 15:18:20 -04:00
Isaac Connor b013da6b95 Fix ptz controls. Something has changed in the way the Event object works, but we don't actually need it. 2018-01-11 13:14:11 -05:00
Isaac Connor 55403219d8 fix regexp for direction in control command. Also log if the regexp doesn't match 2017-01-10 12:35:38 -05:00
Isaac Connor c5d57b5b64 convert monitor hash accesses to function calls 2015-12-01 15:16:43 -05:00
Isaac Connor 2e48c2ba3d add sendControlCommand function to do the heavy work of sending zmcontrol a command 2015-01-07 16:24:07 -05:00
Isaac Connor 4c348cf159 more updates 2013-12-17 11:16:20 -05:00
stan 93b955813f Further PTZ preset tweaks
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2958 e3e1d417-86f3-4887-817a-d78f3d33393f
2009-09-28 14:16:17 +00:00
stan c5a0f98309 Factored out action and request control functionality. Added presets to mobile view for PTZ cams.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2956 e3e1d417-86f3-4887-817a-d78f3d33393f
2009-09-28 13:34:10 +00:00