OMNET++ BLUETOOTH

Bluetooth is a wireless technology which is widely used for short range communication.Bluetooth utilizes standard 2.4 GHz frequency which is compatible with each other during communication.

For Example: Between desktop and laptop computers, PDAs (like the Palm Pilot or Handspring Visor), digital cameras, scanners, cellular phones, and printers.

Characteristics of Bluetooth technology:

  • Lower power consumption through a reduced duty cycle.
  • Fast connection and discovery.
  • Specification of Bluetooth technology is based on the frequency-hopping spread spectrum.
  • Host controller interface support for three-wire UART.
  • It uses radio waves to send information between two devices that are close to each other.

 

Architecture of Bluetooth technology:
This is the architecture of Bluetooth technology in machine to machine communication

Architecture-of-Bluetooth
Architecture-of-Bluetooth

Advantages of Bluetooth technology:

  • Simplicity of use.
  • Processing power and battery power that it requires in order to operate is very low.
  • It does not require a clear line of sight between the synced devices.
  • Maximum range that it offers is 100 meters, but this range is not same for all similar connection. It will be depends on the nature of the devices and version that they operate.
  • Requires no cables and wires is something that has made it so popular.

Sample OMNeT++ Bluetooth Source Code:

void Bluetooth::initialize(int stage)
{
    Bluetooth::initialize(stage);
    if (stage == 0){
        hasPar("coreDebug") ? coreDebug = par("coreDebug").boolValue() : coreDebug = false;
        coreEV << "initializing Bluetooth stage " << stage << endl;
        hasPar("scaleNodeByDepth") ? scaleNodeByDepth
        		= par("scaleNodeByDepth").boolValue()
       		: scaleNodeByDepth = true;
        
		world = FindModule<BaseWorldUtility*>::findGlobalModule();
       if (hasPar("updateInterval")) {
        	updateInterval = par("updateInterval");
        } else {
            updateInterval = 0;
        }
	        bool use2D = world->use2D();       
        Coord pos = world->getRandomPosition();      
        double x = hasPar("x") ? par("x").doubleValue() : -1;
        double y = hasPar("y") ? par("y").doubleValue() : -1;
        double z = hasPar("z") ? par("z").doubleValue() : -1;       
        if(x > -1) pos.x = x;
        if(y > -1) pos.y = y;
        if(!use2D && z > -1) pos.z = z;

        move.setStart(pos);
		coreEV << "start pos: " << move.getStartPos().info() << endl; //check whether position is within the playground if (!move.getStartPos().isInBoundary(Coord::ZERO, world->getPgs())) {
            error("node position specified in omnetpp.ini exceeds playgroundsize");
        }

        // set speed and direction of the Move
        move.setSpeed(0);
        move.setDirectionByVector(Coord::ZERO);
    }