# Offline sample of SSCP periodic communication (diagnostic export, digest fields masked per export policy)
# Purpose: write parsing code offline, and verify field extraction and your understanding of digest construction.
# Note: the digests in this sample cannot be used directly.

--- Request 1/2 ---
POST /sscp/device_service HTTP/1.1
Host: <TARGET_HOST>:2020
Content-Type: application/soap+xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken>
        <wsse:Username>camera_acc</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">MASKED_IN_DIAGNOSTIC_EXPORT</wsse:Password>
        <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">MDEyMzQ1Njc4OWFiY2RlZg==</wsse:Nonce>
        <wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2026-08-15T00:00:00Z</wsu:Created>
      </wsse:UsernameToken>
    </wsse:Security>
  </soap:Header>
  <soap:Body>
    <tds:GetDeviceInformation xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
  </soap:Body>
</soap:Envelope>

--- Response 1/2 ---
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Body>
    <tds:GetDeviceInformationResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
      <tds:Manufacturer>Tapo</tds:Manufacturer>
      <tds:Model>SSCP-CAM V1</tds:Model>
      <tds:FirmwareVersion>1.0.3</tds:FirmwareVersion>
      <tds:SerialNumber>SSCP-0001</tds:SerialNumber>
      <tds:HardwareId>V1.6</tds:HardwareId>
    </tds:GetDeviceInformationResponse>
  </soap:Body>
</soap:Envelope>

--- Request 2/2 ---
POST /sscp/device_service HTTP/1.1
Host: <TARGET_HOST>:2020
Content-Type: application/soap+xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken>
        <wsse:Username>camera_acc</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">MASKED_IN_DIAGNOSTIC_EXPORT</wsse:Password>
        <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">YWJjZGVmZ2hpamtsbW5vcA==</wsse:Nonce>
        <wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2026-08-15T00:00:30Z</wsu:Created>
      </wsse:UsernameToken>
    </wsse:Security>
  </soap:Header>
  <soap:Body>
    <tds:GetStatus xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
  </soap:Body>
</soap:Envelope>

--- Response 2/2 ---
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Body>
    <tds:GetStatusResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
      <tds:PanPosition>-150.0</tds:PanPosition>
      <tds:TiltPosition>10.0</tds:TiltPosition>
      <tds:PanRange>172.5</tds:PanRange>
    </tds:GetStatusResponse>
  </soap:Body>
</soap:Envelope>

# Export notes:
# 1) The PasswordDigest field is masked by the export policy and cannot be replayed directly;
# 2) The four identity fields are Username / Password / Nonce / Created;
# 3) Two requests from the same account use different Nonce and Created.
