10 10 10 Community

  • Home
  • About
  • FAQ
  • Requirements
  • Support
  • License
  • Activity
  • Members
  • Groups
  • Forums
  • Avatar

    Muhammad-Arafat posted an update in the group Bug reports:   14 years ago · View

    Hi,
    I’ve been trying to use the subscription ”SUB_RECEIVED_CAM_INFO”, but I keep getting this error message:

    STEP 4 – SETUP PHASE
    Error: Invalid argument: Storage::readChar(): invalid position
    iCS –> #Error while receiving response from Application: tcpip::Socket::receive() @ recv: Success

    I added some similar code to Server::LookForNewSubscriptions:

    bool
    Server::LookForNewSubscriptions() {
    int timestep = myInputStorage.readInt();
    int nodeId = myInputStorage.readInt();

    // create reply message
    writeStatusCmd(CMD_ASK_FOR_SUBSCRIPTION, APP_RTYPE_OK, ””);

    if (!ApplicationLogic::m_camAreaIsSet) {
    Area area = ApplicationLogic::GetCamArea();
    SubsSetCamArea(myOutputStorage, nodeId, timestep, area);
    } else if (!ApplicationLogic::m_returnCarAreaIsSet) {
    Area area = ApplicationLogic::GetReturningCarArea();
    SubsReturnCarsInZone(myOutputStorage, nodeId, timestep, area);
    } else if (!ApplicationLogic::m_returnCamMessagesInfoIsSet) {
    bool flag = ApplicationLogic::SetCamInfoFlagToTrue();
    SubsReceivedCamInfo(myOutputStorage, nodeId, timestep);
    } else if (ApplicationLogic::m_camAreaIsSet && ApplicationLogic::m_returnCarAreaIsSet && ApplicationLogic::m_returnCamMessagesInfoIsSet) {
    StopAskingForSubscription(myOutputStorage, nodeId, timestep);
    }

    return true;
    }

    and here’s the function that forms the second primitive of the reply:

    bool
    Server::SubsReceivedCamInfo(Storage& myOutputStorage, int nodeId, int timestep) {
    // command length
    myOutputStorage.writeUnsignedByte(1 + 1 + 1);
    // command type
    myOutputStorage.writeUnsignedByte(CMD_ASK_FOR_SUBSCRIPTION);
    // subscription type
    myOutputStorage.writeUnsignedByte(SUB_RECEIVED_CAM_INFO);

    return true;
    }

    I can’t see where I went wrong.. I even checked how iCS receives this primitive, and it was just three unsigned bytes.

    please help me,

    Kind Regards,
    Muhammad

  • iTETRIS is a project funded by the European Commision (7th Framework Programme)
    7th Framework Programme
  • Copyright © 2010 iTetris Project Consortium - All rights reserved
  • Accesible design with XHTML and CSS