/// <summary> /// Browse /// </summary> /// <param name="endpoint"></param> /// <param name="request"></param> /// <returns></returns> public async Task <BrowseResponseApiModel> BrowseAsync( EndpointApiModel endpoint, BrowseRequestInternalApiModel request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } if (endpoint == null) { throw new ArgumentNullException(nameof(endpoint)); } var result = await _browse.NodeBrowseFirstAsync( endpoint.ToServiceModel(), request.ToServiceModel()); return(result.ToApiModel()); }
/// <summary> /// Browse /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <BrowseResponseApiModel> BrowseAsync( BrowseRequestInternalApiModel request) { kBrowseAsync.Inc(); BrowseResponseApiModel model; using (kBrowseHistAsync.NewTimer()) { if (request == null) { throw new ArgumentNullException(nameof(request)); } var result = await _browse.NodeBrowseFirstAsync( await _twin.GetEndpointAsync(), request.ToServiceModel()); model = result.ToApiModel(); } return(model); }
/// <summary> /// Convert back to service model /// </summary> /// <returns></returns> public static BrowseRequestModel ToServiceModel( this BrowseRequestInternalApiModel model) { if (model == null) { return(null); } return(new BrowseRequestModel { NodeIdsOnly = model.NodeIdsOnly, NodeId = model.NodeId, MaxReferencesToReturn = model.MaxReferencesToReturn, Direction = (BrowseDirection?)model.Direction, View = model.View.ToServiceModel(), ReferenceTypeId = model.ReferenceTypeId, TargetNodesOnly = model.TargetNodesOnly, ReadVariableValues = model.ReadVariableValues, NodeClassFilter = model.NodeClassFilter? .Select(f => (NodeClass)f) .ToList(), NoSubtypes = model.NoSubtypes, Header = model.Header.ToServiceModel() }); }