FuJuntang
2022-07-06 e5cff5a3ef373a5090f45cd1dfb0b85d9c851d5d
service/capabilities/capa.c
@@ -87,6 +87,49 @@
    return rep.__sizeProfiles;
}
int proto_GetVideoSource(const char *DeviceXAddr, char *buf, int len, const char *username, const char *passwd) {
    int result = 0;
    struct soap *soap = NULL;
    struct _trt__GetVideoSources *getVideoSources;
    struct _trt__GetVideoSourcesResponse *getVideoSourcesRes;
    SOAP_ASSERT(NULL != DeviceXAddr);
    SOAP_ASSERT(NULL != buf);
    SOAP_ASSERT(NULL != (soap = proto_soap_new(SOAP_SOCK_TIMEOUT)));
    getVideoSources = soap_new__trt__GetVideoSources(soap, 1);
    getVideoSourcesRes = soap_new__trt__GetVideoSourcesResponse(soap, 1);
    proto_SetAuthInfo(soap, username, passwd);
    result = soap_call___trt__GetVideoSources(soap, DeviceXAddr, NULL, getVideoSources, getVideoSourcesRes);
    SOAP_CHECK_ERROR(result, soap, "GetVideoSourc");
    if (getVideoSourcesRes->__sizeVideoSources <= 0) {
      result = SOAP_NO_DATA;
      SOAP_CHECK_ERROR(result, soap, "GetVideoSourc");
    } else {
      for (int i = 0; i < getVideoSourcesRes->__sizeVideoSources; i++) {
        log_level_val(0, "get video source token: ", log_str, getVideoSourcesRes->VideoSources[i].token);
        if (i == 0) {
          strncpy(buf, getVideoSourcesRes->VideoSources[i].token, len);
        }
      }
    }
EXIT:
    if (NULL != soap) {
        proto_soap_delete(soap);
    }
    return result;
}
int proto_GetCapabilities(const char *DeviceXAddr, struct tagCapabilities *capa, const char *username, const char *passwd)
{
    int result = 0;