Example #1
0
ushort TGroup::execView( TView* p)
{
    if( p == 0 )
        return cmCancel;

    ushort saveOptions = p->options;
    TGroup *saveOwner = p->owner;
    TView *saveTopView = TheTopView;
    TView *saveCurrent= current;
    TCommandSet saveCommands;
    getCommands( saveCommands );
    TheTopView = p;
    p->options = p->options & ~ofSelectable;
    p->setState(sfModal, True);
    setCurrent(p, enterSelect);
    if( saveOwner == 0 )
        insert(p);
    ushort retval = p->execute();
    if( saveOwner == 0 )
        remove(p);
    setCurrent(saveCurrent, leaveSelect);    
    p->setState(sfModal, False);
    p->options = saveOptions;
    TheTopView = saveTopView;
    setCommands(saveCommands);
    return retval;
}
/**
* Create a new SyncBody object. The commands in <i>commands</i>
* must be of the allowed types.
*
* @param commands The array elements must be an instance of one of these
*                 classes: {@link Alert},  {@link Atomic}, {@link Copy},
*                 {@link Exec}, {@link Get}, {@link Map}, {@link Put},
*                 {@link Results}, {@link Search}, {@link Sequence},
*                 {@link Status}, {@link Sync}
* @param finalMsg is true if this is the final message that is being sent
*
*/
SyncBody::SyncBody(ArrayList* commands   , // AbstractCommand[]
                   bool       finalMsg) {

        initialize();
        setCommands(commands);
        setFinalMsg(finalMsg);
}
std::shared_ptr<Chip> STidPRGReaderUnit::getCurrentChip()
{
    auto ret = getDefaultReaderCardAdapter()->sendCommand({0x21, 0, 0, 0});
    if (ret.size() > 3)
    {
        auto uid_len = ret[2];
        if (static_cast<size_t>(3 + uid_len) >= ret.size())
        {
            auto card_uid = std::vector<uint8_t>(ret.begin() + 3, ret.end());
            auto chip     = createChip("Prox", card_uid);
            auto cmd      = std::make_shared<ProxCommand>();
            cmd->setReaderCardAdapter(getDefaultReaderCardAdapter());
            chip->setCommands(cmd);
            return chip;
        }
        else
            assert(0);
    }
    return nullptr;
}