ble/services/EddystoneService.h
void swapOutFrames(FrameTypes frameType) {
        uint8_t  serviceData[SERVICE_DATA_MAX];
        unsigned serviceDataLen = 0;
        //hard code in the eddystone UUID
        serviceData[serviceDataLen++] = BEACON_EDDYSTONE[0];
        serviceData[serviceDataLen++] = BEACON_EDDYSTONE[1];

        // if certain frames are not enabled, then skip them. Worst case TLM is always enabled
        switch (frameType) {
            case tlm:
                // TLM frame
                if (tlmIsSet) {
                    DBG("Swapping in TLM Frame: version=%x, Batt=%d, Temp = %d, PDUCnt = %d, TimeSinceBoot=%d",
                        TlmVersion,
                        TlmBatteryVoltage,
                        TlmBeaconTemp,
                        TlmPduCount,
                        TlmTimeSinceBoot);
                    serviceDataLen += constructTLMFrame(serviceData + serviceDataLen, 20);
                    DBG("\t Swapping in TLM Frame: len=%d", serviceDataLen);
                    updateAdvPacket(serviceData, serviceDataLen);
                }
                break;
            case url:
                // URL Frame
                if (urlIsSet) {
                    DBG("Swapping in URL Frame: Power: %d", defaultUrlPower);
                    serviceDataLen += constructURLFrame(serviceData + serviceDataLen, 20);
                    DBG("\t Swapping in URL Frame: len=%d ", serviceDataLen);
                    updateAdvPacket(serviceData, serviceDataLen);
                    //switchFlag = false;
                }
                break;
            case uid:
                // UID Frame
                if (uidIsSet) {
                    DBG("Swapping in UID Frame: Power: %d", defaultUidPower);
                    serviceDataLen += constructUIDFrame(serviceData + serviceDataLen, 20);
                    DBG("\t Swapping in UID Frame: len=%d", serviceDataLen);
                    updateAdvPacket(serviceData, serviceDataLen);
                    //switchFlag = false;
                }
                break;
            default:
                ERR("You have not initialized a Frame yet, please initialize one before starting a beacon");
                ERR("uidIsSet = %d, urlIsSet = %d, tlmIsSet = %d", uidIsSet, urlIsSet, tlmIsSet);
        }
    }
/*
    *   State machine for switching out frames.
    *   This function is called by the radioNotificationCallback when a frame needs to get swapped out.
    *   This function exists because of time constraints in the radioNotificationCallback, so it is effectively
    *   broken up into two functions.
    */
State machine for switching out frames.
This function is called by the radioNotificationCallback when a frame needs to get swapped out.
This function exists because of time constraints in the radioNotificationCallback, so it is effectively
broken up into two functions.
State machine for switching out frames . This function is called by the radioNotificationCallback when a frame needs to get swapped out . This function exists because of time constraints in the radioNotificationCallback so it is effectively broken up into two functions .
void swapOutFrames(FrameTypes frameType) {
        uint8_t  serviceData[SERVICE_DATA_MAX];
        unsigned serviceDataLen = 0;
        serviceData[serviceDataLen++] = BEACON_EDDYSTONE[0];
        serviceData[serviceDataLen++] = BEACON_EDDYSTONE[1];
        switch (frameType) {
            case tlm:
                if (tlmIsSet) {
                    DBG("Swapping in TLM Frame: version=%x, Batt=%d, Temp = %d, PDUCnt = %d, TimeSinceBoot=%d",
                        TlmVersion,
                        TlmBatteryVoltage,
                        TlmBeaconTemp,
                        TlmPduCount,
                        TlmTimeSinceBoot);
                    serviceDataLen += constructTLMFrame(serviceData + serviceDataLen, 20);
                    DBG("\t Swapping in TLM Frame: len=%d", serviceDataLen);
                    updateAdvPacket(serviceData, serviceDataLen);
                }
                break;
            case url:
                if (urlIsSet) {
                    DBG("Swapping in URL Frame: Power: %d", defaultUrlPower);
                    serviceDataLen += constructURLFrame(serviceData + serviceDataLen, 20);
                    DBG("\t Swapping in URL Frame: len=%d ", serviceDataLen);
                    updateAdvPacket(serviceData, serviceDataLen);
                }
                break;
            case uid:
                if (uidIsSet) {
                    DBG("Swapping in UID Frame: Power: %d", defaultUidPower);
                    serviceDataLen += constructUIDFrame(serviceData + serviceDataLen, 20);
                    DBG("\t Swapping in UID Frame: len=%d", serviceDataLen);
                    updateAdvPacket(serviceData, serviceDataLen);
                }
                break;
            default:
                ERR("You have not initialized a Frame yet, please initialize one before starting a beacon");
                ERR("uidIsSet = %d, urlIsSet = %d, tlmIsSet = %d", uidIsSet, urlIsSet, tlmIsSet);
        }
    }
void swapOutFrames ( FrameTypes frameType ) { uint8_t serviceData [ SERVICE_DATA_MAX ] ; unsigned serviceDataLen = 0 ; serviceData [ serviceDataLen ++ ] = BEACON_EDDYSTONE [ 0 ] ; serviceData [ serviceDataLen ++ ] = BEACON_EDDYSTONE [ 1 ] ; switch ( frameType ) { case tlm : if ( tlmIsSet ) { DBG ( " " , TlmVersion , TlmBatteryVoltage , TlmBeaconTemp , TlmPduCount , TlmTimeSinceBoot ) ; serviceDataLen += constructTLMFrame ( serviceData + serviceDataLen , 20 ) ; DBG ( " \t " , serviceDataLen ) ; updateAdvPacket ( serviceData , serviceDataLen ) ; } break ; case url : if ( urlIsSet ) { DBG ( " " , defaultUrlPower ) ; serviceDataLen += constructURLFrame ( serviceData + serviceDataLen , 20 ) ; DBG ( " \t " , serviceDataLen ) ; updateAdvPacket ( serviceData , serviceDataLen ) ; } break ; case uid : if ( uidIsSet ) { DBG ( " " , defaultUidPower ) ; serviceDataLen += constructUIDFrame ( serviceData + serviceDataLen , 20 ) ; DBG ( " \t " , serviceDataLen ) ; updateAdvPacket ( serviceData , serviceDataLen ) ; } break ; default : ERR ( " " ) ; ERR ( " " , uidIsSet , urlIsSet , tlmIsSet ) ; } }
State machine for switching out frames.
State machine for switching out frames .
//hard code in the eddystone UUID // if certain frames are not enabled, then skip them. Worst case TLM is always enabled // TLM frame // URL Frame //switchFlag = false; // UID Frame //switchFlag = false;