| | |
| | | |
| | | } |
| | | |
| | | void CHsmsPassive::addVariableValueToItem(ISECS2Item* pParent, SERVO::CVariable* pVariable) |
| | | { |
| | | ASSERT(pParent); |
| | | ASSERT(pVariable); |
| | | |
| | | SERVO::SVFromat format = pVariable->getFormat(); |
| | | switch (format) |
| | | { |
| | | case SERVO::SVFromat::U1: |
| | | pParent->addU1Item((unsigned char)pVariable->getIntValue(), "SV"); |
| | | break; |
| | | case SERVO::SVFromat::U2: |
| | | pParent->addU2Item((unsigned char)pVariable->getIntValue(), "SV"); |
| | | break; |
| | | case SERVO::SVFromat::I2: |
| | | pParent->addI2Item((unsigned char)pVariable->getIntValue(), "SV"); |
| | | break; |
| | | case SERVO::SVFromat::A20: |
| | | case SERVO::SVFromat::A50: |
| | | pParent->addItem(pVariable->getValue().c_str(), "SV"); |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | void CHsmsPassive::linkEventReport(unsigned int CEID, unsigned int RPTID) |
| | | { |
| | | SERVO::CCollectionEvent* pEvent = getEvent(CEID); |
| | |
| | | // S1F1 |
| | | replyAreYouThere(pMessage); |
| | | } |
| | | else if (nStream == 1 && pHeader->function == 3) { |
| | | replySelectedEquipmentStatusData(pMessage); |
| | | } |
| | | else if (nStream == 1 && pHeader->function == 13) { |
| | | replyEstablishCommunications(pMessage); |
| | | } |
| | |
| | | return 0; |
| | | } |
| | | |
| | | int CHsmsPassive::replySelectedEquipmentStatusData(IMessage* pRecv) |
| | | { |
| | | if (m_pPassive == NULL || STATE::SELECTED != m_pPassive->getState()) { |
| | | return ER_NOTSELECT; |
| | | } |
| | | |
| | | IMessage* pMessage = NULL; |
| | | HSMS_Create1Message(pMessage, m_nSessionId, 1, 4, pRecv->getHeader()->systemBytes); |
| | | ASSERT(pMessage); |
| | | |
| | | unsigned char SVU1 = 0; |
| | | unsigned int SVID = 0; |
| | | ISECS2Item* pBody = pRecv->getBody(); |
| | | if (pBody == nullptr || pBody->getType() != SITYPE::L) { |
| | | pMessage->getBody()->addU1Item(SVU1, "SV"); |
| | | goto MYREPLY; |
| | | } |
| | | if (!pBody->getSubItemU4(0, SVID)) { |
| | | pMessage->getBody()->addU1Item(SVU1, "SV"); |
| | | goto MYREPLY; |
| | | } |
| | | |
| | | SERVO::CVariable* pVariable = getVariable(SVID); |
| | | if (pVariable == nullptr) { |
| | | pMessage->getBody()->addU1Item(SVU1, "SV"); |
| | | goto MYREPLY; |
| | | } |
| | | addVariableValueToItem(pMessage->getBody(), pVariable); |
| | | |
| | | MYREPLY: |
| | | m_pPassive->sendMessage(pMessage); |
| | | LOGI("<HSMS>[SECS Msg SEND]%s", pMessage->toString()); |
| | | HSMS_Destroy1Message(pMessage); |
| | | |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | // S2F13 |
| | | int CHsmsPassive::replyEquipmentConstantRequest(IMessage* pRecv) |
| | | { |