Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/toolchain
compile_flags.txt
divinus
/test/*_test
2 changes: 1 addition & 1 deletion res/onvif/capabilities.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<tt:Events>
<tt:XAddr>http://%s:%d/onvif/event_service</tt:XAddr>
<tt:WSSubscriptionPolicySupport>false</tt:WSSubscriptionPolicySupport>
<tt:WSPullPointSupport>false</tt:WSPullPointSupport>
<tt:WSPullPointSupport>true</tt:WSPullPointSupport>
<tt:WSPausableSubscriptionManagerInterfaceSupport>false</tt:WSPausableSubscriptionManagerInterfaceSupport>
</tt:Events>
<tt:Imaging>
Expand Down
9 changes: 9 additions & 0 deletions res/onvif/event.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Header>
<wsa:Action>%s</wsa:Action>%s
</SOAP-ENV:Header>
<SOAP-ENV:Body>
%s
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
3 changes: 3 additions & 0 deletions res/onvif/eventcaps.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<tev:GetServiceCapabilitiesResponse>
<tev:Capabilities WSSubscriptionPolicySupport="false" WSPullPointSupport="true" WSPausableSubscriptionManagerInterfaceSupport="false" MaxNotificationProducers="0" MaxPullPoints="4" PersistentNotificationStorage="false"/>
</tev:GetServiceCapabilitiesResponse>
22 changes: 22 additions & 0 deletions res/onvif/eventprops.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<tev:GetEventPropertiesResponse>
<tev:TopicNamespaceLocation>http://www.onvif.org/onvif/ver10/topics/topicns.xml</tev:TopicNamespaceLocation>
<wsnt:FixedTopicSet>true</wsnt:FixedTopicSet>
<wstop:TopicSet>
<tns1:VideoSource>
<MotionAlarm wstop:topic="true">
<tt:MessageDescription IsProperty="true">
<tt:Source>
<tt:SimpleItemDescription Name="Source" Type="tt:ReferenceToken"/>
</tt:Source>
<tt:Data>
<tt:SimpleItemDescription Name="State" Type="xs:boolean"/>
</tt:Data>
</tt:MessageDescription>
</MotionAlarm>
</tns1:VideoSource>
</wstop:TopicSet>
<wsnt:TopicExpressionDialect>http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet</wsnt:TopicExpressionDialect>
<wsnt:TopicExpressionDialect>http://docs.oasis-open.org/wsn/t-1/TopicExpression/Concrete</wsnt:TopicExpressionDialect>
<tev:MessageContentFilterDialect>http://www.onvif.org/ver10/tev/messageContentFilter/ItemFilter</tev:MessageContentFilterDialect>
<tev:MessageContentSchemaLocation>http://www.onvif.org/onvif/ver10/schema/onvif.xsd</tev:MessageContentSchemaLocation>
</tev:GetEventPropertiesResponse>
16 changes: 16 additions & 0 deletions res/onvif/fault.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<SOAP-ENV:Code>
<SOAP-ENV:Value>SOAP-ENV:%s</SOAP-ENV:Value>
<SOAP-ENV:Subcode>
<SOAP-ENV:Value>%s</SOAP-ENV:Value>
</SOAP-ENV:Subcode>
</SOAP-ENV:Code>
<SOAP-ENV:Reason>
<SOAP-ENV:Text xml:lang="en">%s</SOAP-ENV:Text>
</SOAP-ENV:Reason>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
13 changes: 13 additions & 0 deletions res/onvif/notification.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<wsnt:NotificationMessage>
<wsnt:Topic Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:VideoSource/MotionAlarm</wsnt:Topic>
<wsnt:Message>
<tt:Message UtcTime="%s" PropertyOperation="%s">
<tt:Source>
<tt:SimpleItem Name="Source" Value="%s"/>
</tt:Source>
<tt:Data>
<tt:SimpleItem Name="State" Value="%s"/>
</tt:Data>
</tt:Message>
</wsnt:Message>
</wsnt:NotificationMessage>
4 changes: 4 additions & 0 deletions res/onvif/pullmessages.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<tev:PullMessagesResponse>
<tev:CurrentTime>%s</tev:CurrentTime>
<tev:TerminationTime>%s</tev:TerminationTime>%s
</tev:PullMessagesResponse>
7 changes: 7 additions & 0 deletions res/onvif/pullpoint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<tev:CreatePullPointSubscriptionResponse>
<tev:SubscriptionReference>
<wsa:Address>http://%s:%d/onvif/subscription?id=%d</wsa:Address>
</tev:SubscriptionReference>
<wsnt:CurrentTime>%s</wsnt:CurrentTime>
<wsnt:TerminationTime>%s</wsnt:TerminationTime>
</tev:CreatePullPointSubscriptionResponse>
4 changes: 4 additions & 0 deletions res/onvif/renew.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<wsnt:RenewResponse>
<wsnt:TerminationTime>%s</wsnt:TerminationTime>
<wsnt:CurrentTime>%s</wsnt:CurrentTime>
</wsnt:RenewResponse>
22 changes: 22 additions & 0 deletions res/onvif/services.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tt="http://www.onvif.org/ver10/schema">
<SOAP-ENV:Body>
<tds:GetServicesResponse>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver10/device/wsdl</tds:Namespace>
<tds:XAddr>http://%s:%d/onvif/device_service</tds:XAddr>
<tds:Version><tt:Major>2</tt:Major><tt:Minor>40</tt:Minor></tds:Version>
</tds:Service>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver10/media/wsdl</tds:Namespace>
<tds:XAddr>http://%s:%d/onvif/media_service</tds:XAddr>
<tds:Version><tt:Major>2</tt:Major><tt:Minor>40</tt:Minor></tds:Version>
</tds:Service>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver10/events/wsdl</tds:Namespace>
<tds:XAddr>http://%s:%d/onvif/event_service</tds:XAddr>
<tds:Version><tt:Major>2</tt:Major><tt:Minor>40</tt:Minor></tds:Version>
</tds:Service>
</tds:GetServicesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
1 change: 1 addition & 0 deletions res/onvif/syncpoint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<tev:SetSynchronizationPointResponse/>
1 change: 1 addition & 0 deletions res/onvif/unsubscribe.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<wsnt:UnsubscribeResponse/>
6 changes: 3 additions & 3 deletions src/hal/tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ int base64_decode(char *decoded, const char *string, int maxLen) {
}
}

if (buflen > 0 && i + buflen <= maxLen) {
memcpy(decoded + i, buf, buflen);
i += buflen;
if (buflen > 1 && i + buflen - 1 <= maxLen) {
memcpy(decoded + i, buf, buflen - 1);
i += buflen - 1;
}

return i;
Expand Down
2 changes: 2 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "media.h"
#include "network.h"
#include "night.h"
#include "onvif_event.h"
#include "rtsp/rtsp_server.h"
#include "server.h"
#include "watchdog.h"
Expand Down Expand Up @@ -105,6 +106,7 @@ int main(int argc, char *argv[]) {

while (keepRunning) {
if (app_config.rtsp_enable) rtsp_tick(rtspHandle);
if (app_config.onvif_enable) onvif_event_expire(onvif_event_clock());
watchdog_reset();
sleep(1);
}
Expand Down
Loading