Skip to content

Commit

Permalink
#10471 Update set_time opetion | WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
paoloo committed Jul 9, 2024
1 parent 352e9b3 commit 62052bf
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/devices/set_system_date_and_time.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ defmodule Onvif.Devices.SetSystemDateAndTime do
end

def request_body(%SystemDateAndTime{} = system_date_time) do
request_body([config: system_date_time, set_time?: false])
end

#def request_body(%SystemDateAndTime{} = system_date_time, opts) do
def request_body([config: %SystemDateAndTime{} = system_date_time] = opts) do
IO.inspect(opts)
set_time? = Keyword.get(opts, :set_time?, false)
element(:"s:Body", [
element(:"tds:SetSystemDateAndTime", [
element(:"tds:DateAndTime", system_date_time.date_time_type ),
Expand All @@ -23,7 +30,13 @@ defmodule Onvif.Devices.SetSystemDateAndTime do
element(:"tt:TZ", system_date_time.time_zone.tz )
]
),
List.flatten([utc_date_time_element(system_date_time, set_time?)])
])
])
end

def utc_date_time_element(system_date_time, false) do [] end

Check warning on line 38 in lib/devices/set_system_date_and_time.ex

View workflow job for this annotation

GitHub Actions / Build and test

variable "system_date_time" is unused (if the variable is not meant to be used, prefix it with an underscore)
def utc_date_time_element(system_date_time, true) do
element(
:"tds:UTCDateTime",
[
Expand All @@ -39,9 +52,6 @@ defmodule Onvif.Devices.SetSystemDateAndTime do
])
]
)

])
])
end

def response(xml_response_body) do
Expand Down

0 comments on commit 62052bf

Please sign in to comment.