예제 #1
0
/* ------------------------------------------------------------------------- */
static int StartTx(TServant *const servant)
{
    TTxControl *const ctrl = &servant->m_tx;

    if (SetTxData(servant->m_session.m_connection, ctrl))
        return -EXIT_FAILURE;

    ctrl->m_handler = OnTxMessage;
    EL_SetEventEvents(servant->m_session.m_io_event, POLLOUT, 0x00);

    return -EXIT_SUCCESS;
}
예제 #2
0
/* ------------------------------------------------------------------------- */
static int OnTxMessage(TServant *const servant)
{
    TTxControl *const ctrl = &servant->m_tx;

    if (SetTxData(servant->m_session.m_connection, ctrl))
        return -EXIT_FAILURE;

    if (0 == ctrl->m_n_to_send)
    {
        StopTx(servant);
        if (OnMessageSent(servant))
            return -EXIT_FAILURE;
    }

    return -EXIT_SUCCESS;
}
예제 #3
0
int ITxFormView::SetConfigData(xmlDocPtr pDoc)
{
    int hResult = S_FALSE;
    if (nullptr != m_pouTxDataStore)
    {
        m_pouTxDataStore->DeleteAllMsgItems();
    }
    if (pDoc == nullptr)
    {
        SetDefaultWindowPos();
        return hResult;
    }
    std::string strConfigTag = "";
    GetConfigTag(strConfigTag);
    strConfigTag += "/" + std::string(DEF_WND_POS);
    xmlChar* pXpath = (xmlChar*)(strConfigTag.c_str());

    xmlXPathObjectPtr pObjectPath = xmlUtils::pGetNodes(pDoc, pXpath);
    if (pObjectPath != nullptr)
    {
        xmlNodeSetPtr pNodeSet = pObjectPath->nodesetval;
        if (nullptr != pNodeSet)
        {
            xmlNodePtr pNode = pNodeSet->nodeTab[0];       //Take First One only
            WINDOWPLACEMENT WndPlacement;
            xmlUtils::ParseWindowsPlacement(pNode, WndPlacement);
            SetTxData(TX_WINDOW_PLACEMENT, &WndPlacement);
        }
    }

    strConfigTag = "";
    GetConfigTag(strConfigTag);
    strConfigTag += "/" + std::string(DEF_MSG_LIST);
    xmlChar* pXpathChannel = (xmlChar*)strConfigTag.c_str();
    pObjectPath = xmlUtils::pGetNodes(pDoc, pXpathChannel);
    if (pObjectPath != nullptr)
    {
        xmlNodeSetPtr pNodeSet = pObjectPath->nodesetval;

        if (nullptr != pNodeSet)
        {
            xmlChar* pchPathMsg = (xmlChar*)DEF_MESSAGE;
            xmlXPathObjectPtr pObjectPath = xmlUtils::pGetChildNodes(pNodeSet->nodeTab[0], pchPathMsg);
            if (nullptr != pObjectPath)
            {
                hResult = S_OK;
                xmlNodeSetPtr pNodeMsg = pObjectPath->nodesetval;
                if (nullptr != pNodeMsg)
                {
                    if (S_OK == AddNewMsgItemsToDataStore(pNodeMsg->nodeNr) && nullptr != m_pouTxDataStore)
                    {
                        m_pouTxDataStore->SetMsgItemsConfigData(pNodeSet->nodeTab[0]);
                    }
                }
            }
        }
    }
    //Support for older .cfx for CAN where Message Blocks were used and LIN used Channel_Msg_List Tag.
    else
    {
        hResult = SetOldFormatConfigData(pDoc);
    }
    return hResult;
}