} END_TEST START_TEST(test_call_get_ReceiveFolder) { uint64_t fid; const char *ExplicitMessageClass; CHECK_SUCCESS(openchangedb_get_ReceiveFolder(mem_ctx, oc_ctx, "recipient", "MessageClass", &fid, &ExplicitMessageClass)); ck_assert_int_eq(functions_called.get_ReceiveFolder, 1); } END_TEST
} END_TEST START_TEST(test_call_replica_mapping_guid_to_replid) { struct GUID guid = GUID_random(); uint16_t replid = 0; CHECK_SUCCESS(openchangedb_replica_mapping_guid_to_replid(oc_ctx, "recipient", &guid, &replid)); ck_assert_int_eq(functions_called.guid_to_replid, 1); ck_assert_int_eq(replid, 0x03); } END_TEST
} END_TEST START_TEST(test_call_get_ReceiveFolder) { uint64_t fid; const char *ExplicitMessageClass; CHECK_SUCCESS(openchangedb_get_ReceiveFolder(mem_ctx, oc_ctx, "recipient", "MessageClass", &fid, &ExplicitMessageClass)); ck_assert_int_eq(functions_called.get_ReceiveFolder, 1); ck_assert_int_eq(fid, FOLDER_ID_EXPECTED); ck_assert(!strcmp(ExplicitMessageClass, DFT_MESSAGE_CLASS)); } END_TEST
} END_TEST START_TEST(test_call_replica_mapping_replid_to_guid) { struct GUID *guid; struct GUID local_guid = GUID_zero(); guid = talloc_zero(mem_ctx, struct GUID); CHECK_SUCCESS(openchangedb_replica_mapping_replid_to_guid(oc_ctx, "recipient", 0x03, guid)); talloc_free(guid); ck_assert_int_eq(functions_called.replid_to_guid, 1); ck_assert(GUID_equal(guid, &local_guid)); } END_TEST
} END_TEST START_TEST(test_call_get_MailboxReplica) { uint16_t ReplID; struct GUID local_guid = GUID_zero(); struct GUID ReplGUID; CHECK_SUCCESS(openchangedb_get_MailboxReplica(oc_ctx, "recipient", &ReplID, &ReplGUID)); ck_assert_int_eq(functions_called.get_MailboxReplica, 1); ck_assert_int_eq(ReplID, 0x03); ck_assert(GUID_equal(&ReplGUID, &local_guid)); } END_TEST
int main(int argc, char *argv[]) { printf("\t--------------------------------\n"); printf("\t- v*v de7ec7ed v*v -\n"); printf("\t- *^* android insmod *^* -\n"); printf("\t--------------------------------\n"); if(argc < 2) { usage(argc, argv); return FAILURE; } CHECK_SUCCESS(add_module(argv[1], (argc - 1), (u8_t **)&(argv[1])), "[-] unable to add the module\n"); printf("[+] module successfully added\n"); return SUCCESS; }
HRESULT DXwindow::InitSDIForDevice() { IAmdDxExt* pExt = NULL; IAmdDxExtSDI* pLocalSDI = NULL; HRESULT hr = S_OK; m_pSDI = NULL; HMODULE hDrvDll = GetModuleHandleW(L"atidxx32.dll"); if ( hDrvDll == NULL ) { hDrvDll = GetModuleHandleW(L"atidxx64.dll"); } if (hDrvDll != NULL) { PFNAmdDxExtCreate11 pAmdDxExtCreate = reinterpret_cast<PFNAmdDxExtCreate11>(GetProcAddress(hDrvDll, "AmdDxExtCreate11")); if (pAmdDxExtCreate != NULL) { hr = pAmdDxExtCreate(m_pd3dDevice, &pExt); CHECK_SUCCESS(hr,"pAmdDxExtCreate"); if (pExt != NULL) { pLocalSDI = static_cast<IAmdDxExtSDI*>((pExt)->GetExtInterface(AmdDxExtSDIID)); if ( pLocalSDI == NULL ) { MessageBoxA(NULL,"Error, you must activate DirectGMA with AMD Control Center -> AMD Firepro -> SDI/DirectGMA","DirectGMA",NULL); return E_FAIL; } } } } m_pSDI = pLocalSDI; return S_OK; }
cellular_result_t cellular_pdp_deactivate(void* reserved) { CHECK_SUCCESS(electronMDM.disconnect()); return 0; }
// 解析设置图形的XML IVS_INT32 COCXDrawXMLProcess::SetGraphicsPraseXML(IA_GRAPHICS *pGraphicsArr, ULONG &ulNum, LPCTSTR pGraphicsXml, const SIZE &szGraphic, BOOL bPersent) { CHECK_POINTER(pGraphicsArr, IVS_FAIL); CHECK_POINTER(pGraphicsXml, IVS_OPERATE_MEMORY_ERROR); IVS_DEBUG_TRACE("GraphicsXml: %s, GraphicWidth: %d, GraphicHeight: %d",pGraphicsXml, szGraphic.cx, szGraphic.cy); CXml xml; if (!xml.Parse(pGraphicsXml)) { return IVS_FAIL; } CHECK_SUCCESS(xml.FindElem("Content")); CHECK_SUCCESS(xml.IntoElem()); CHECK_SUCCESS(xml.FindElem("Graphics")); CHECK_SUCCESS(xml.IntoElem()); const char *value = NULL; CHECK_SUCCESS(xml.FindElem("GraphicNum") && (NULL != (value = xml.GetElemValue()))); ulNum = (ULONG)atoi(value); // 若设置的图形数大于图形数组长度,截断到最大画图个数 if (ulNum > GRAPHICS_NUM_MAX) { BP_RUN_LOG_INF("COCXDrawXMLProcess::SetGraphicsPraseXML", "GraphicNum Truncated to GRAPHICS_NUM_MAX"); ulNum = GRAPHICS_NUM_MAX; } CHECK_SUCCESS(xml.FindElem("GraphicList")); CHECK_SUCCESS(xml.IntoElem()); for (ULONG i = 0; i < ulNum; i++) { // 给图形可选字段赋默认值 memset(&pGraphicsArr[i], 0, sizeof(IA_GRAPHICS)); pGraphicsArr[i].ulLineWidth = 3; // 默认基本线宽为3 pGraphicsArr[i].bAllowDelete = TRUE; // 允许删除 pGraphicsArr[i].bAllowModifySize = TRUE; // 允许修改矩形大小 if (0 == i) { CHECK_SUCCESS(xml.FindElem("GraphicInfo")); } else { CHECK_SUCCESS(xml.NextElem()); } CHECK_SUCCESS(xml.IntoElem()); CHECK_SUCCESS(xml.FindElem("GraphicType") && (NULL != (value = xml.GetElemValue()))); pGraphicsArr[i].ulGraphicType = (ULONG)atoi(value); GET_ELEMENT_ULONG(pGraphicsArr[i].ulGraphicGroup, GraphicGroup, xml); GET_ELEMENT_STRING(pGraphicsArr[i].GraphicGroupName, CHARACTER_NUM_MAX, GraphicGroupName, xml); if (xml.FindElem("GraphicBackgroundColor")) { CHECK_SUCCESS(xml.IntoElem()); GET_ELEMENT_UCHAR(pGraphicsArr[i].BgColor.Alpha, Opacity, xml); GET_ELEMENT_UCHAR(pGraphicsArr[i].BgColor.Red, Red, xml); GET_ELEMENT_UCHAR(pGraphicsArr[i].BgColor.Green, Green, xml); GET_ELEMENT_UCHAR(pGraphicsArr[i].BgColor.Blue, Blue, xml); xml.OutOfElem(); } if (xml.FindElem("GraphicLineColor")) { CHECK_SUCCESS(xml.IntoElem()); GET_ELEMENT_UCHAR(pGraphicsArr[i].LineColor.Alpha, Opacity, xml); GET_ELEMENT_UCHAR(pGraphicsArr[i].LineColor.Red, Red, xml); GET_ELEMENT_UCHAR(pGraphicsArr[i].LineColor.Green, Green, xml); GET_ELEMENT_UCHAR(pGraphicsArr[i].LineColor.Blue, Blue, xml); xml.OutOfElem(); } GET_ELEMENT_ULONG(pGraphicsArr[i].ulLineWidth, GraphicLineWidth, xml); CHECK_SUCCESS(xml.FindElem("PointNum") && (NULL != (value = xml.GetElemValue()))); pGraphicsArr[i].ulPointsNum = (ULONG)atoi(value); CHECK_SUCCESS(xml.FindElem("PointList")); CHECK_SUCCESS(xml.IntoElem()); for (ULONG j = 0; j < pGraphicsArr[i].ulPointsNum; j++) { if (0 == j) { CHECK_SUCCESS(xml.FindElem("Point")); } else { CHECK_SUCCESS(xml.NextElem()); } CHECK_SUCCESS(xml.IntoElem()); if ((0 == szGraphic.cx) || (0 == szGraphic.cy)) { if (bPersent) { CHECK_SUCCESS(xml.FindElem("X") && (NULL != (value = xml.GetElemValue()))); pGraphicsArr[i].IAPoints[j].x = (LONG)(atof(value) * FLOAT_TO_LONG_COEFF); CHECK_SUCCESS(xml.FindElem("Y") && (NULL != (value = xml.GetElemValue()))); pGraphicsArr[i].IAPoints[j].y = (LONG)(atof(value) * FLOAT_TO_LONG_COEFF); } else { CHECK_SUCCESS(xml.FindElem("X") && (NULL != (value = xml.GetElemValue()))); pGraphicsArr[i].IAPoints[j].x = (LONG)atoi(value); CHECK_SUCCESS(xml.FindElem("Y") && (NULL != (value = xml.GetElemValue()))); pGraphicsArr[i].IAPoints[j].y = (LONG)atoi(value); } } else { CHECK_SUCCESS(xml.FindElem("X") && (NULL != (value = xml.GetElemValue()))); pGraphicsArr[i].IAPoints[j].x = (LONG)(atof(value) * szGraphic.cx + 0.5); CHECK_SUCCESS(xml.FindElem("Y") && (NULL != (value = xml.GetElemValue()))); pGraphicsArr[i].IAPoints[j].y = (LONG)(atof(value) * szGraphic.cy + 0.5); } xml.OutOfElem(); } xml.OutOfElem(); GET_ELEMENT_ULONG(pGraphicsArr[i].NamePosition, NamePosition, xml); GET_ELEMENT_BOOL(pGraphicsArr[i].bAllowDelete, DeleteByMouse, xml); GET_ELEMENT_BOOL(pGraphicsArr[i].bAllowAddNewPoint, AddNewPoint, xml); GET_ELEMENT_BOOL(pGraphicsArr[i].bAllowModifySize, AllowModifySize, xml); GET_ELEMENT_ULONG(pGraphicsArr[i].ulArrowType, ArrowType, xml); GET_ELEMENT_BOOL(pGraphicsArr[i].bKeepHorizon, KeepHorizon, xml); xml.OutOfElem(); } xml.OutOfElem(); xml.OutOfElem(); return IVS_SUCCEED; }
HRESULT DXwindow::InitDevice(IDXGIAdapter* adapter,D3D_DRIVER_TYPE driverType) { HRESULT hr = S_OK; RECT rc; GetClientRect( m_hWnd, &rc ); UINT width = rc.right - rc.left; UINT height = rc.bottom - rc.top; DXGI_SWAP_CHAIN_DESC sd; ZeroMemory( &sd, sizeof( sd ) ); sd.BufferCount = 2;//1 sd.BufferDesc.Width = width; sd.BufferDesc.Height = height; sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; sd.BufferDesc.RefreshRate.Numerator = 60; sd.BufferDesc.RefreshRate.Denominator = 1; sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; sd.OutputWindow = m_hWnd; sd.SampleDesc.Count = 1; sd.SampleDesc.Quality = 0; sd.Windowed = TRUE; D3D_FEATURE_LEVEL featureLevel = D3D_FEATURE_LEVEL_11_0; hr = D3D11CreateDeviceAndSwapChain( adapter, driverType, NULL, D3D11_CREATE_DEVICE_SINGLETHREADED, NULL, 0, D3D11_SDK_VERSION, &sd, &m_pSwapChain, &m_pd3dDevice, &featureLevel, &m_pImmediateContext ); if( FAILED( hr ) ) { return hr; } // Create a render target view m_pBackBuffer = NULL; hr = m_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&m_pBackBuffer ); if( FAILED( hr ) ) return hr; hr = m_pd3dDevice->CreateRenderTargetView( m_pBackBuffer, NULL, &m_pBackBuffer_RTV ); if( FAILED( hr ) ) return hr; // Create depth stencil texture ID3D11Texture2D* pDepthStencil = NULL; D3D11_TEXTURE2D_DESC descDepth; descDepth.Width = width; descDepth.Height = height; descDepth.MipLevels = 1; descDepth.ArraySize = 1; descDepth.Format = DXGI_FORMAT_D16_UNORM; descDepth.SampleDesc.Count = 1; descDepth.SampleDesc.Quality = 0; descDepth.Usage = D3D11_USAGE_DEFAULT; descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; descDepth.CPUAccessFlags = 0; descDepth.MiscFlags = 0; hr = m_pd3dDevice->CreateTexture2D( &descDepth, NULL, &pDepthStencil ); CHECK_SUCCESS(hr,"pd3dDevice->CreateTexture2D"); // Create the depth stencil view D3D11_DEPTH_STENCIL_VIEW_DESC descDSV; descDSV.Format = descDepth.Format; descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; descDSV.Texture2D.MipSlice = 0; descDSV.Flags = 0; hr = m_pd3dDevice->CreateDepthStencilView( pDepthStencil, &descDSV,&m_pDSV ); CHECK_SUCCESS(hr,"pd3dDevice->CreateDepthStencilView"); if(pDepthStencil) pDepthStencil->Release(); PASS_TEST( hr ); m_pImmediateContext->OMSetRenderTargets( 1, &m_pBackBuffer_RTV, m_pDSV); // Set up the viewport D3D11_VIEWPORT vp; vp.Width = (FLOAT)width; vp.Height = (FLOAT)height; vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; vp.TopLeftX = 0; vp.TopLeftY = 0; m_pImmediateContext->RSSetViewports( 1, &vp ); D3D11_QUERY_DESC pQueryDesc; pQueryDesc.Query = D3D11_QUERY_EVENT; pQueryDesc.MiscFlags = 0; PASS_TEST(m_pd3dDevice->CreateQuery(&pQueryDesc, &m_pEventQuery_)); return S_OK; }
// 构建获取图形的XML IVS_INT32 COCXDrawXMLProcess::GetGraphicsGetXML(const IA_GRAPHICS *pGraphicsArr, IVS_INT32 iResultCode, ULONG ulNum, CXml& xmlGraphics, const SIZE &szGraphic) { CHECK_POINTER(pGraphicsArr, IVS_FAIL); IVS_DEBUG_TRACE("iResultCode: %d, ulNum:%d, GraphicWidth: %d, GraphicHeight: %d", iResultCode, ulNum, szGraphic.cx, szGraphic.cy); char val[64] = {0}; CHECK_SUCCESS(xmlGraphics.AddDeclaration("1.0","UTF-8","")); CHECK_SUCCESS(xmlGraphics.AddElem("Content")); CHECK_SUCCESS(xmlGraphics.AddChildElem("ResultCode")); CHECK_SUCCESS(xmlGraphics.IntoElem()); SET_ELEMENT_LONG(iResultCode, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Graphics")); CHECK_SUCCESS(xmlGraphics.AddChildElem("GraphicNum")); CHECK_SUCCESS(xmlGraphics.IntoElem()); SET_ELEMENT_LONG(ulNum, val, xmlGraphics); if (0 == ulNum) { xmlGraphics.OutOfElem(); xmlGraphics.OutOfElem(); return IVS_SUCCEED; } CHECK_SUCCESS(xmlGraphics.AddElem("GraphicList")); for (ULONG i = 0; i < ulNum; i++) { if (i == 0) { CHECK_SUCCESS(xmlGraphics.AddChildElem("GraphicInfo")); CHECK_SUCCESS(xmlGraphics.IntoElem()); } else { CHECK_SUCCESS(xmlGraphics.AddElem("GraphicInfo")); } CHECK_SUCCESS(xmlGraphics.AddChildElem("GraphicType")); CHECK_SUCCESS(xmlGraphics.IntoElem()); SET_ELEMENT_LONG(pGraphicsArr[i].ulGraphicType, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("GraphicGroup")); SET_ELEMENT_LONG(pGraphicsArr[i].ulGraphicGroup, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("GraphicGroupName")); SET_ELEMENT_STRING(pGraphicsArr[i].GraphicGroupName, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("GraphicBackgroundColor")); CHECK_SUCCESS(xmlGraphics.AddChildElem("Opacity")); CHECK_SUCCESS(xmlGraphics.IntoElem()); SET_ELEMENT_LONG(pGraphicsArr[i].BgColor.Alpha, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Red")); SET_ELEMENT_LONG(pGraphicsArr[i].BgColor.Red, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Green")); SET_ELEMENT_LONG(pGraphicsArr[i].BgColor.Green, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Blue")); SET_ELEMENT_LONG(pGraphicsArr[i].BgColor.Blue, val, xmlGraphics); xmlGraphics.OutOfElem(); CHECK_SUCCESS(xmlGraphics.AddElem("GraphicLineColor")); CHECK_SUCCESS(xmlGraphics.AddChildElem("Opacity")); CHECK_SUCCESS(xmlGraphics.IntoElem()); SET_ELEMENT_LONG(pGraphicsArr[i].LineColor.Alpha, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Red")); SET_ELEMENT_LONG(pGraphicsArr[i].LineColor.Red, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Green")); SET_ELEMENT_LONG(pGraphicsArr[i].LineColor.Green, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Blue")); SET_ELEMENT_LONG(pGraphicsArr[i].LineColor.Blue, val, xmlGraphics); xmlGraphics.OutOfElem(); CHECK_SUCCESS(xmlGraphics.AddElem("GraphicLineWidth")); SET_ELEMENT_LONG(pGraphicsArr[i].ulLineWidth, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("PointNum")); SET_ELEMENT_LONG(pGraphicsArr[i].ulPointsNum, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("PointList")); for (ULONG j = 0; j < pGraphicsArr[i].ulPointsNum; j++) { if (0 == j) { CHECK_SUCCESS(xmlGraphics.AddChildElem("Point")); CHECK_SUCCESS(xmlGraphics.IntoElem()); } else { CHECK_SUCCESS(xmlGraphics.AddElem("Point")); } CHECK_SUCCESS(xmlGraphics.AddChildElem("X")); CHECK_SUCCESS(xmlGraphics.IntoElem()); if ((0 == szGraphic.cx) || (0 == szGraphic.cy)) { SET_ELEMENT_LONG(pGraphicsArr[i].IAPoints[j].x, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("Y")); SET_ELEMENT_LONG(pGraphicsArr[i].IAPoints[j].y, val, xmlGraphics); } else { char cPointValue[10]; memset(cPointValue, 0, sizeof(cPointValue)); double dPointValue = (double)pGraphicsArr[i].IAPoints[j].x / szGraphic.cx; (void)_snprintf_s(cPointValue, sizeof(cPointValue) - 1, "%f", dPointValue); cPointValue[8] = '\0'; CHECK_SUCCESS(xmlGraphics.SetElemValue(cPointValue)); CHECK_SUCCESS(xmlGraphics.AddElem("Y")); memset(cPointValue, 0, sizeof(cPointValue)); dPointValue = (double)pGraphicsArr[i].IAPoints[j].y / szGraphic.cy; (void)_snprintf_s(cPointValue, sizeof(cPointValue) - 1, "%f", dPointValue); cPointValue[8] = '\0'; CHECK_SUCCESS(xmlGraphics.SetElemValue(cPointValue)); } xmlGraphics.OutOfElem(); } xmlGraphics.OutOfElem(); CHECK_SUCCESS(xmlGraphics.AddElem("NamePosition")); SET_ELEMENT_LONG(pGraphicsArr[i].NamePosition, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("DeleteByMouse")); SET_ELEMENT_LONG(pGraphicsArr[i].bAllowDelete, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("AddNewPoint")); SET_ELEMENT_LONG(pGraphicsArr[i].bAllowAddNewPoint, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("AllowModifySize")); SET_ELEMENT_LONG(pGraphicsArr[i].bAllowModifySize, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("ArrowType")); SET_ELEMENT_LONG(pGraphicsArr[i].ulArrowType, val, xmlGraphics); CHECK_SUCCESS(xmlGraphics.AddElem("KeepHorizon")); SET_ELEMENT_LONG(pGraphicsArr[i].bKeepHorizon, val, xmlGraphics); xmlGraphics.OutOfElem(); } xmlGraphics.OutOfElem(); xmlGraphics.OutOfElem(); return IVS_SUCCEED; }
// 解析画图前图形属性设置XML IVS_INT32 COCXDrawXMLProcess::DrawGraphicsPraseXML(IA_GRAPHICS &GraphicAttribute, ULONG &ulGroupDrawMaxNum, LPCTSTR pGraphicsXml) { CHECK_POINTER(pGraphicsXml, IVS_OPERATE_MEMORY_ERROR); IVS_DEBUG_TRACE("GroupDrawMaxNum: %lu, GraphicsXml: %s", ulGroupDrawMaxNum, pGraphicsXml); CXml xml; if (!xml.Parse(pGraphicsXml)) { return IVS_FAIL; } CHECK_SUCCESS(xml.FindElem("Content")); CHECK_SUCCESS(xml.IntoElem()); CHECK_SUCCESS(xml.FindElem("Graphics")); CHECK_SUCCESS(xml.IntoElem()); const char *value = NULL; CHECK_SUCCESS(xml.FindElem("GraphicNum") && (NULL != (value = xml.GetElemValue()))); ulGroupDrawMaxNum = (ULONG)atoi(value); // 若设置的图形数大于图形数组长度,截断到最大画图个数 if (ulGroupDrawMaxNum > GRAPHICS_NUM_MAX) { BP_RUN_LOG_INF("COCXDrawXMLProcess::DrawGraphicsPraseXML", "GroupDrawMaxNum Truncated to GRAPHICS_NUM_MAX"); ulGroupDrawMaxNum = GRAPHICS_NUM_MAX; } CHECK_SUCCESS(xml.FindElem("GraphicList")); CHECK_SUCCESS(xml.IntoElem()); // 给图形可选字段赋默认值 memset(&GraphicAttribute, 0, sizeof(IA_GRAPHICS)); GraphicAttribute.ulLineWidth = 3; // 默认基本线宽为3 GraphicAttribute.bAllowDelete = TRUE; // 允许删除 GraphicAttribute.bAllowModifySize = TRUE; // 允许修改矩形大小 CHECK_SUCCESS(xml.FindElem("GraphicInfo")); CHECK_SUCCESS(xml.IntoElem()); CHECK_SUCCESS(xml.FindElem("GraphicType") && (NULL != (value = xml.GetElemValue()))); GraphicAttribute.ulGraphicType = (ULONG)atoi(value); GET_ELEMENT_ULONG(GraphicAttribute.ulGraphicGroup, GraphicGroup, xml); GET_ELEMENT_STRING(GraphicAttribute.GraphicGroupName, CHARACTER_NUM_MAX, GraphicGroupName, xml); if (xml.FindElem("GraphicBackgroundColor")) { CHECK_SUCCESS(xml.IntoElem()); GET_ELEMENT_UCHAR(GraphicAttribute.BgColor.Alpha, Opacity, xml); GET_ELEMENT_UCHAR(GraphicAttribute.BgColor.Red, Red, xml); GET_ELEMENT_UCHAR(GraphicAttribute.BgColor.Green, Green, xml); GET_ELEMENT_UCHAR(GraphicAttribute.BgColor.Blue, Blue, xml); xml.OutOfElem(); } if (xml.FindElem("GraphicLineColor")) { CHECK_SUCCESS(xml.IntoElem()); GET_ELEMENT_UCHAR(GraphicAttribute.LineColor.Alpha, Opacity, xml); GET_ELEMENT_UCHAR(GraphicAttribute.LineColor.Red, Red, xml); GET_ELEMENT_UCHAR(GraphicAttribute.LineColor.Green, Green, xml); GET_ELEMENT_UCHAR(GraphicAttribute.LineColor.Blue, Blue, xml); xml.OutOfElem(); } GET_ELEMENT_ULONG(GraphicAttribute.ulLineWidth, GraphicLineWidth, xml); GET_ELEMENT_ULONG(GraphicAttribute.NamePosition, NamePosition, xml); GET_ELEMENT_BOOL(GraphicAttribute.bAllowDelete, DeleteByMouse, xml); GET_ELEMENT_BOOL(GraphicAttribute.bAllowAddNewPoint, AddNewPoint, xml); GET_ELEMENT_BOOL(GraphicAttribute.bAllowModifySize, AllowModifySize, xml); GET_ELEMENT_ULONG(GraphicAttribute.ulArrowType, ArrowType, xml); GET_ELEMENT_BOOL(GraphicAttribute.bKeepHorizon, KeepHorizon, xml); xml.OutOfElem(); xml.OutOfElem(); xml.OutOfElem(); return IVS_SUCCEED; }
static phStatus_t LoadProfile(void) { phStatus_t status = PH_ERR_SUCCESS; sDiscLoop.pPal1443p3aDataParams = &spalI14443p3a; sDiscLoop.pPal1443p3bDataParams = &spalI14443p3b; sDiscLoop.pPal1443p4aDataParams = &spalI14443p4a; sDiscLoop.pPal14443p4DataParams = &spalI14443p4; sDiscLoop.pHalDataParams = &sHal_Nfc_Ic.sHal; /* * These lines are added just to SIGSEG fault when non 14443-3 card is detected */ /* * Assign the GI for Type A */ sDiscLoop.sTypeATargetInfo.sTypeA_P2P.pGi = (uint8_t *) GI; sDiscLoop.sTypeATargetInfo.sTypeA_P2P.bGiLength = sizeof(GI); /* * Assign the GI for Type F */ sDiscLoop.sTypeFTargetInfo.sTypeF_P2P.pGi = (uint8_t *) GI; sDiscLoop.sTypeFTargetInfo.sTypeF_P2P.bGiLength = sizeof(GI); /* * Assign ATR response for Type A */ sDiscLoop.sTypeATargetInfo.sTypeA_P2P.pAtrRes = aData; /* * Assign ATR response for Type F */ sDiscLoop.sTypeFTargetInfo.sTypeF_P2P.pAtrRes = aData; /* * Assign ATS buffer for Type A */ sDiscLoop.sTypeATargetInfo.sTypeA_I3P4.pAts = aData; /* ******************************************************************************************** */ /* * Passive Bailout bitmap configuration */ status = phacDiscLoop_SetConfig(&sDiscLoop, PHAC_DISCLOOP_CONFIG_BAIL_OUT, PH_OFF); CHECK_STATUS(status); /* * Passive poll bitmap configuration. Poll for only Type A Tags. */ status = phacDiscLoop_SetConfig(&sDiscLoop, PHAC_DISCLOOP_CONFIG_PAS_POLL_TECH_CFG, PHAC_DISCLOOP_POS_BIT_MASK_A); CHECK_STATUS(status); /* * Turn OFF Passive Listen. */ status = phacDiscLoop_SetConfig(&sDiscLoop, PHAC_DISCLOOP_CONFIG_PAS_LIS_TECH_CFG, PH_OFF); CHECK_STATUS(status); /* * Turn OFF active listen. */ status = phacDiscLoop_SetConfig(&sDiscLoop, PHAC_DISCLOOP_CONFIG_ACT_LIS_TECH_CFG, PH_OFF); CHECK_STATUS(status); /* * Turn OFF Active Poll */ status = phacDiscLoop_SetConfig(&sDiscLoop, PHAC_DISCLOOP_CONFIG_ACT_POLL_TECH_CFG, PH_OFF); CHECK_STATUS(status); /* * Disable LPCD feature. */ status = phacDiscLoop_SetConfig(&sDiscLoop, PHAC_DISCLOOP_CONFIG_ENABLE_LPCD, PH_OFF); CHECK_STATUS(status); /* * reset collision Pending */ status = phacDiscLoop_SetConfig(&sDiscLoop, PHAC_DISCLOOP_CONFIG_COLLISION_PENDING, PH_OFF); CHECK_STATUS(status); /* * whether anti-collision is supported or not. */ status = phacDiscLoop_SetConfig(&sDiscLoop, PHAC_DISCLOOP_CONFIG_ANTI_COLL, PH_ON); CHECK_STATUS(status); /* * Device limit for Type A */ status = phacDiscLoop_SetConfig(&sDiscLoop, PHAC_DISCLOOP_CONFIG_TYPEA_DEVICE_LIMIT, PH_ON); CHECK_STATUS(status); /* * Discovery loop Operation mode */ status = phacDiscLoop_SetConfig(&sDiscLoop, PHAC_DISCLOOP_CONFIG_OPE_MODE, RD_LIB_MODE_NFC); /* * Bailout on Type A detect */ status = phacDiscLoop_SetConfig(&sDiscLoop, PHAC_DISCLOOP_CONFIG_BAIL_OUT, PHAC_DISCLOOP_POS_BIT_MASK_A); CHECK_SUCCESS(status); /* * Return Status */ return status; }
phStatus_t NfcRdLibInit(void) { phStatus_t status; /* * Initialize the Reader BAL (Bus Abstraction Layer) component */ status = phbalReg_Stub_Init(&sBalReader, sizeof(phbalReg_Stub_DataParams_t)); CHECK_SUCCESS(status); /* * Initialize the OSAL Events. */ status = phOsal_Event_Init(); CHECK_STATUS(status); // Start interrupt thread Set_Interrupt(); /* * Set HAL type in BAL */ #ifdef NXPBUILD__PHHAL_HW_PN5180 status = phbalReg_SetConfig(&sBalReader, PHBAL_REG_CONFIG_HAL_HW_TYPE, PHBAL_REG_HAL_HW_PN5180); #endif #ifdef NXPBUILD__PHHAL_HW_RC523 status = phbalReg_SetConfig(&sBalReader, PHBAL_REG_CONFIG_HAL_HW_TYPE, PHBAL_REG_HAL_HW_RC523); #endif #ifdef NXPBUILD__PHHAL_HW_RC663 status = phbalReg_SetConfig(&sBalReader, PHBAL_REG_CONFIG_HAL_HW_TYPE, PHBAL_REG_HAL_HW_RC663); #endif CHECK_STATUS(status); status = phbalReg_SetPort(&sBalReader, (uint8_t *) SPI_CONFIG); CHECK_STATUS(status); /* * Open BAL */ status = phbalReg_OpenPort(&sBalReader); CHECK_STATUS(status); /* * Initialize the Reader HAL (Hardware Abstraction Layer) component */ status = phhalHw_Nfc_IC_Init(&sHal_Nfc_Ic, sizeof(phhalHw_Nfc_Ic_DataParams_t), &sBalReader, 0, bHalBufferTx, sizeof(bHalBufferTx), bHalBufferRx, sizeof(bHalBufferRx)); CHECK_SUCCESS(status); /* * Set the parameter to use the SPI interface */ sHal_Nfc_Ic.sHal.bBalConnectionType = PHHAL_HW_BAL_CONNECTION_SPI; Configure_Device(&sHal_Nfc_Ic); /* * Set the generic pointer */ pHal = &sHal_Nfc_Ic.sHal; /* * Initializing specific objects for the communication with MIFARE (R) Classic cards. The MIFARE (R) Classic card * is compliant of ISO 14443-3 and ISO 14443-4 */ /* * Initialize the I14443-A PAL layer */ status = phpalI14443p3a_Sw_Init(&spalI14443p3a, sizeof(phpalI14443p3a_Sw_DataParams_t), &sHal_Nfc_Ic.sHal); CHECK_STATUS(status); /* * Initialize the I14443-A PAL component */ status = phpalI14443p4a_Sw_Init(&spalI14443p4a, sizeof(phpalI14443p4a_Sw_DataParams_t), &sHal_Nfc_Ic.sHal); CHECK_STATUS(status); /* * Initialize the I14443-4 PAL component */ status = phpalI14443p4_Sw_Init(&spalI14443p4, sizeof(phpalI14443p4_Sw_DataParams_t), &sHal_Nfc_Ic.sHal); CHECK_STATUS(status); /* * Initialize the I14443-B PAL component */ status = phpalI14443p3b_Sw_Init(&spalI14443p3b, sizeof(phpalI14443p3b_Sw_DataParams_t), &sHal_Nfc_Ic.sHal); CHECK_STATUS(status); /* * Initialize the MIFARE PAL component */ status = phpalMifare_Sw_Init(&spalMifare, sizeof(phpalMifare_Sw_DataParams_t), &sHal_Nfc_Ic.sHal, NULL); CHECK_STATUS(status); /* * Initialize the discover component */ status = phacDiscLoop_Sw_Init(&sDiscLoop, sizeof(phacDiscLoop_Sw_DataParams_t), &sHal_Nfc_Ic.sHal); CHECK_SUCCESS(status); /* * Load profile for Discovery loop */ LoadProfile(); status = phalMfc_Sw_Init(&salMfc, sizeof(phalMfc_Sw_DataParams_t), &spalMifare, NULL); CHECK_STATUS(status); /* * Read the version of the reader IC */ #if defined NXPBUILD__PHHAL_HW_RC523 status = phhalHw_Rc523_ReadRegister(&sHal_Nfc_Ic.sHal, PHHAL_HW_RC523_REG_VERSION, &bDataBuffer[0]); CHECK_SUCCESS(status); #endif #if defined NXPBUILD__PHHAL_HW_RC663 status = phhalHw_Rc663_ReadRegister(&sHal_Nfc_Ic.sHal, PHHAL_HW_RC663_REG_VERSION, &bDataBuffer[0]); CHECK_SUCCESS(status); #endif /* * Return Success */ return PH_ERR_SUCCESS; }
cellular_result_t cellular_register(void* reserved) { CHECK_SUCCESS(electronMDM.registerNet()); return 0; }
cellular_result_t cellular_off(void* reserved) { CHECK_SUCCESS(electronMDM.powerOff()); return 0; }
cellular_result_t cellular_init(void* reserved) { CHECK_SUCCESS(electronMDM.init()); return 0; }
cellular_result_t cellular_band_available_get(MDM_BandSelect* bands, void* reserved) { CHECK_SUCCESS(electronMDM.getBandAvailable(*bands)); return 0; }
cellular_result_t cellular_band_select_set(MDM_BandSelect* bands, void* reserved) { CHECK_SUCCESS(electronMDM.setBandSelect(*bands)); return 0; }
cellular_result_t cellular_gprs_detach(void* reserved) { CHECK_SUCCESS(electronMDM.detach()); HAL_NET_notify_disconnected(); return 0; }
IVS_INT32 CMediaXMLProcess::GetURLResponseData(CXml &xmlRsp, ST_MEDIA_RSP& stMediaRsp, bool& bAssociatedAudio) { IVS_DEBUG_TRACE(""); memset(&stMediaRsp, 0, sizeof(ST_MEDIA_RSP)); const char*AttriValue = NULL; //临时存储单个节点值 bool bRet = false; CHECK_SUCCESS(xmlRsp.FindElem("Content")); CHECK_SUCCESS(xmlRsp.IntoElem()); CHECK_SUCCESS(xmlRsp.FindElem("URL")); CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue())); bRet = CToolsHelp::Memcpy(stMediaRsp.szURL, URL_LEN, AttriValue, strlen(AttriValue)); if(!bRet) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error."); return IVS_ALLOC_MEMORY_ERROR; } if (xmlRsp.FindElem("AssociatedAudio")) { CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue())); bAssociatedAudio = (bool)atoi(AttriValue); } CHECK_SUCCESS(xmlRsp.FindElem("RtspIP")); CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue())); bRet = CToolsHelp::Memcpy(stMediaRsp.szRTSPIP, IVS_IP_LEN, AttriValue, strlen(AttriValue)); if(!bRet) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error."); return IVS_ALLOC_MEMORY_ERROR; } CHECK_SUCCESS(xmlRsp.FindElem("RtspPort")); CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue())); bRet = CToolsHelp::Memcpy(stMediaRsp.szRTSPPORT, PORT_LEN, AttriValue, strlen(AttriValue)); if(!bRet) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error."); return IVS_ALLOC_MEMORY_ERROR; } //add by zwx211831, Date:20140625, 在URL中添加UserID和DomainID,以实现查询点播业务。 //如果是旧的版本,则不变。 if (xmlRsp.FindElem("UserId") && xmlRsp.FindElem("DomainId")) { (void)xmlRsp.FindElem("DomainId"); CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue())); std::string strDomainCode("DomainCode="); strDomainCode += AttriValue; strDomainCode += "&"; if(!CToolsHelp::Strncat(stMediaRsp.szURL, URL_LEN, strDomainCode.c_str())) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Strncat error."); return IVS_ALLOC_MEMORY_ERROR; } (void)xmlRsp.FindElem("UserId"); CHECK_SUCCESS(NULL != (AttriValue = xmlRsp.GetElemValue())); IVS_UINT32 uiUserID = 0; std::string strUserID("UserId="); GET_ELEM_VALUE_NUM_FOR_UINT("UserId", AttriValue, uiUserID, xmlRsp); strUserID += CToolsHelp::Int2Str(uiUserID); strUserID += "&"; if(!CToolsHelp::Strncat(stMediaRsp.szURL, URL_LEN, strUserID.c_str())) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Strncat error."); return IVS_ALLOC_MEMORY_ERROR; } } xmlRsp.OutOfElem(); return IVS_SUCCEED; #if 0 //XML增加AssociatedAudio字段 (void)xmlRsp.GetElem(); // Content (void)xmlRsp.IntoElem(); (void)xmlRsp.GetElem(); // URL AttriValue=xmlRsp.GetElemValue(); if(AttriValue == NULL) { BP_RUN_LOG_INF("Get URL Response Data", "URL is null"); return IVS_SDK_RET_SMU_SDK_XML_INVALD; } bool bRet = CToolsHelp::Memcpy(stMediaRsp.szURL,URL_LEN, AttriValue, strlen(AttriValue)); if(false == bRet) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error."); return IVS_ALLOC_MEMORY_ERROR; } (void)xmlRsp.NextElem(); // RtspIP (void)xmlRsp.GetElem(); AttriValue = xmlRsp.GetElemValue(); if(AttriValue == NULL) { BP_RUN_LOG_INF("Get URL Response Data", "RtspIP is null"); return IVS_SDK_RET_SMU_SDK_XML_INVALD; } bRet = CToolsHelp::Memcpy(stMediaRsp.szRTSPIP,IVS_IP_LEN, AttriValue, strlen(AttriValue)); if(false == bRet) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error."); return IVS_ALLOC_MEMORY_ERROR; } (void)xmlRsp.NextElem(); // RtspPort (void)xmlRsp.GetElem(); AttriValue = xmlRsp.GetElemValue(); if(AttriValue == NULL) { BP_RUN_LOG_INF("Get URL Response Data", "RtspPort is null"); return IVS_SDK_RET_SMU_SDK_XML_INVALD; } bRet = CToolsHelp::Memcpy(stMediaRsp.szRTSPPORT,PORT_LEN, AttriValue, strlen(AttriValue)); if(false == bRet) { BP_RUN_LOG_ERR(IVS_ALLOC_MEMORY_ERROR,"Get URL Response Data", "Memcpy error."); return IVS_ALLOC_MEMORY_ERROR; } return IVS_SUCCEED; #endif }