本文整理汇总了C++中PLT_ActionReference::GetErrorCode方法的典型用法代码示例。如果您正苦于以下问题:C++ PLT_ActionReference::GetErrorCode方法的具体用法?C++ PLT_ActionReference::GetErrorCode怎么用?C++ PLT_ActionReference::GetErrorCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PLT_ActionReference
的用法示例。
在下文中一共展示了PLT_ActionReference::GetErrorCode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseCSV
/*----------------------------------------------------------------------
| PLT_MediaController::OnGetProtocolInfoResponse
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaController::OnGetProtocolInfoResponse(NPT_Result res,
PLT_DeviceDataReference& device,
PLT_ActionReference& action,
void* userdata)
{
NPT_String source_info, sink_info;
PLT_StringList sources, sinks;
if (NPT_FAILED(res) || action->GetErrorCode() != 0) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("Source", source_info))) {
goto bad_action;
}
ParseCSV(source_info, sources);
if (NPT_FAILED(action->GetArgumentValue("Sink", sink_info))) {
goto bad_action;
}
ParseCSV(sink_info, sinks);
m_Delegate->OnGetProtocolInfoResult(NPT_SUCCESS, device, &sources, &sinks, userdata);
return NPT_SUCCESS;
bad_action:
m_Delegate->OnGetProtocolInfoResult(NPT_FAILURE, device, NULL, NULL, userdata);
return NPT_FAILURE;
}
示例2:
/*----------------------------------------------------------------------
| PLT_MediaController::OnGetTransportSettingsResponse
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaController::OnGetTransportSettingsResponse(NPT_Result res,
PLT_DeviceDataReference& device,
PLT_ActionReference& action,
void* userdata)
{
PLT_TransportSettings settings;
if (NPT_FAILED(res) || action->GetErrorCode() != 0) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("PlayMode", settings.play_mode))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("RecQualityMode", settings.rec_quality_mode))) {
goto bad_action;
}
m_Delegate->OnGetTransportSettingsResult(NPT_SUCCESS, device, &settings, userdata);
return NPT_SUCCESS;
bad_action:
m_Delegate->OnGetTransportSettingsResult(NPT_FAILURE, device, NULL, userdata);
return NPT_FAILURE;
}
示例3:
/*----------------------------------------------------------------------
| CMediaCrawler::OnBrowseResponse
+---------------------------------------------------------------------*/
NPT_Result
CMediaCrawler::OnBrowseResponse(NPT_Result res,
PLT_DeviceDataReference& device,
PLT_ActionReference& action,
void* userdata)
{
NPT_COMPILER_UNUSED(device);
if (!userdata) return NPT_FAILURE;
CMediaCrawlerBrowseInfoReference* info = (CMediaCrawlerBrowseInfoReference*) userdata;
(*info)->res = res;
(*info)->code = action->GetErrorCode();
if (NPT_FAILED(res) || action->GetErrorCode() != 0) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("ObjectID", (*info)->object_id))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("UpdateID", (*info)->uid))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("NumberReturned", (*info)->nr))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("TotalMatches", (*info)->tm))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("Result", (*info)->didl))) {
goto bad_action;
}
goto done;
bad_action:
if (NPT_SUCCEEDED((*info)->res)) (*info)->res = NPT_FAILURE;
done:
(*info)->shared_var.SetValue(1);
delete info;
return NPT_SUCCESS;
}
示例4:
/*----------------------------------------------------------------------
| PLT_MediaBrowser::OnSearchResponse
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaBrowser::OnSearchResponse(NPT_Result res,
PLT_DeviceDataReference& device,
PLT_ActionReference& action,
void* userdata)
{
NPT_String value;
PLT_BrowseInfo info;
NPT_String unescaped;
if (NPT_FAILED(res) || action->GetErrorCode() != 0) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("ContainerId", info.object_id))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("UpdateID", value)) ||
value.GetLength() == 0 ||
NPT_FAILED(value.ToInteger(info.uid))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("NumberReturned", value)) ||
value.GetLength() == 0 ||
NPT_FAILED(value.ToInteger(info.nr))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("TotalMatches", value)) ||
value.GetLength() == 0 ||
NPT_FAILED(value.ToInteger(info.tm))) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("Result", value)) ||
value.GetLength() == 0) {
goto bad_action;
}
if (NPT_FAILED(PLT_Didl::FromDidl(value, info.items))) {
goto bad_action;
}
if (m_Delegate) m_Delegate->OnSearchResult(NPT_SUCCESS, device, &info, userdata);
return NPT_SUCCESS;
bad_action:
if (m_Delegate) m_Delegate->OnSearchResult(NPT_FAILURE, device, NULL, userdata);
return NPT_FAILURE;
}
示例5: OnBrowseRoot
/*----------------------------------------------------------------------
| PLT_MediaServer::OnBrowse
+---------------------------------------------------------------------*/
NPT_Result
CMediaCrawler::OnBrowse(PLT_ActionReference& action,
const NPT_HttpRequestContext& context)
{
NPT_Result res;
NPT_String object_id;
if (NPT_FAILED(action->GetArgumentValue("ObjectId", object_id))) {
NPT_LOG_WARNING("PLT_FileMediaServer::OnBrowse - invalid arguments.");
return NPT_FAILURE;
}
NPT_LOG_FINE_1("PLT_FileMediaServer::OnOnBrowse - id = %s\r\n", (const char*)object_id);
// extract server uuid and server object id from our object id
NPT_String server_uuid;
NPT_String server_object_id;
if (NPT_FAILED(SplitObjectId(object_id, server_uuid, server_object_id))) {
/* error */
NPT_LOG_WARNING("CMediaCrawler::OnBrowse - ObjectID not found.");
action->SetError(701, "No Such Object.");
return NPT_FAILURE;
}
// root ?
if (server_uuid.GetLength() == 0) {
res = OnBrowseRoot(action);
} else {
// we have a device to browse
// is it device root?
if (server_object_id.GetLength() == 0) {
server_object_id = "0";
}
res = OnBrowseDevice(action, server_uuid, server_object_id, context);
}
if (NPT_FAILED(res) && (action->GetErrorCode() == 0)) {
action->SetError(800, "Internal error");
}
return res;
}
示例6: arguments
/*----------------------------------------------------------------------
| PLT_MediaServer::OnSearch
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaServer::OnSearch(PLT_ActionReference& action,
const PLT_HttpRequestContext& context)
{
NPT_COMPILER_UNUSED(context);
NPT_Result res;
NPT_String container_id;
NPT_String search;
NPT_String filter;
NPT_String start;
NPT_String count;
NPT_String sort;
NPT_List<NPT_String> sort_list;
if (NPT_FAILED(action->GetArgumentValue("ContainerId", container_id)) ||
NPT_FAILED(action->GetArgumentValue("SearchCriteria", search)) ||
NPT_FAILED(action->GetArgumentValue("Filter", filter)) ||
NPT_FAILED(action->GetArgumentValue("StartingIndex", start)) ||
NPT_FAILED(action->GetArgumentValue("RequestedCount", count)) ||
NPT_FAILED(action->GetArgumentValue("SortCriteria", sort))) {
NPT_LOG_WARNING("Missing arguments");
action->SetError(402, "Invalid args");
return NPT_SUCCESS;
}
/* convert index and counts to int */
NPT_UInt32 starting_index, requested_count;
if (NPT_FAILED(start.ToInteger(starting_index)) ||
NPT_FAILED(count.ToInteger(requested_count))) {
NPT_LOG_WARNING_2("Invalid arguments (%s, %s)",
start.GetChars(), count.GetChars());
action->SetError(402, "Invalid args");
return NPT_FAILURE;
}
/* parse sort criteria */
if (NPT_FAILED(ParseSort(sort, sort_list))) {
NPT_LOG_WARNING_1("Unsupported or invalid sort criteria error (%s)",
sort.GetChars());
action->SetError(709, "Unsupported or invalid sort criteria error");
return NPT_FAILURE;
}
NPT_LOG_INFO_5("Processing Search from %s with id=\"%s\", search=\"%s\", start=%d, count=%d",
(const char*)context.GetRemoteAddress().GetIpAddress().ToString(),
(const char*)container_id,
(const char*)search,
starting_index,
requested_count);
if (search.IsEmpty() || search == "*") {
res = OnBrowseDirectChildren(
action,
container_id,
filter,
starting_index,
requested_count,
sort,
context);
} else {
res = OnSearchContainer(
action,
container_id,
search,
filter,
starting_index,
requested_count,
sort,
context);
}
if (NPT_FAILED(res) && (action->GetErrorCode() == 0)) {
action->SetError(800, "Internal error");
}
return res;
}
示例7: allowed
/*----------------------------------------------------------------------
| PLT_MediaServer::OnBrowse
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaServer::OnBrowse(PLT_ActionReference& action,
const PLT_HttpRequestContext& context)
{
NPT_Result res;
NPT_String object_id;
NPT_String browse_flag_val;
NPT_String filter;
NPT_String start;
NPT_String count;
NPT_String sort;
NPT_List<NPT_String> sort_list;
if (NPT_FAILED(action->GetArgumentValue("ObjectId", object_id)) ||
NPT_FAILED(action->GetArgumentValue("BrowseFlag", browse_flag_val)) ||
NPT_FAILED(action->GetArgumentValue("Filter", filter)) ||
NPT_FAILED(action->GetArgumentValue("StartingIndex", start)) ||
NPT_FAILED(action->GetArgumentValue("RequestedCount", count)) ||
NPT_FAILED(action->GetArgumentValue("SortCriteria", sort))) {
NPT_LOG_WARNING("Missing arguments");
action->SetError(402, "Invalid args");
return NPT_SUCCESS;
}
/* extract flag */
BrowseFlags flag;
if (NPT_FAILED(ParseBrowseFlag(browse_flag_val, flag))) {
/* error */
NPT_LOG_WARNING_1("BrowseFlag value not allowed (%s)", (const char*)browse_flag_val);
action->SetError(402, "Invalid args");
return NPT_SUCCESS;
}
/* convert index and counts to int */
NPT_UInt32 starting_index, requested_count;
if (NPT_FAILED(start.ToInteger(starting_index)) ||
NPT_FAILED(count.ToInteger(requested_count)) ||
PLT_Didl::ConvertFilterToMask(filter) == 0) {
NPT_LOG_WARNING_3("Invalid arguments (%s, %s, %s)",
start.GetChars(), count.GetChars(), filter.GetChars());
action->SetError(402, "Invalid args");
return NPT_FAILURE;
}
/* parse sort criteria for validation */
if (NPT_FAILED(ParseSort(sort, sort_list))) {
NPT_LOG_WARNING_1("Unsupported or invalid sort criteria error (%s)",
sort.GetChars());
action->SetError(709, "Unsupported or invalid sort criteria error");
return NPT_FAILURE;
}
NPT_LOG_FINE_6("Processing %s from %s with id=\"%s\", filter=\"%s\", start=%d, count=%d",
(const char*)browse_flag_val,
(const char*)context.GetRemoteAddress().GetIpAddress().ToString(),
(const char*)object_id,
(const char*)filter,
starting_index,
requested_count);
/* Invoke the browse function */
if (flag == BROWSEMETADATA) {
res = OnBrowseMetadata(
action,
object_id,
filter,
starting_index,
requested_count,
sort,
context);
} else {
res = OnBrowseDirectChildren(
action,
object_id,
filter,
starting_index,
requested_count,
sort,
context);
}
if (NPT_FAILED(res) && (action->GetErrorCode() == 0)) {
action->SetError(800, "Internal error");
}
return res;
}