Esempio n. 1
0
void LLParcel::clearParcel()
{
	overrideParcelFlags(PF_DEFAULT);
	setName(LLStringUtil::null);
	setDesc(LLStringUtil::null);
	setMediaURL(LLStringUtil::null);
	setMediaType(LLStringUtil::null);
	setMediaID(LLUUID::null);
    setMediaDesc(LLStringUtil::null);
	setMediaAutoScale(0);
	setMediaLoop(TRUE);
	mMediaWidth = 0;
	mMediaHeight = 0;
	setMediaCurrentURL(LLStringUtil::null);
	setMediaAllowNavigate(TRUE);
	setMediaPreventCameraZoom(FALSE);
	setMediaURLTimeout(0.0f);
	setMusicURL(LLStringUtil::null);
	setInEscrow(FALSE);
	setAuthorizedBuyerID(LLUUID::null);
	setCategory(C_NONE);
	setSnapshotID(LLUUID::null);
	setUserLocation(LLVector3::zero);
	setUserLookAt(LLVector3::x_axis);
	setLandingType(L_LANDING_POINT);
	setAuctionID(0);
	setGroupID(LLUUID::null);
	setPassPrice(0);
	setPassHours(0.f);
	mAccessList.clear();
	mBanList.clear();
	//mRenterList.reset();
}
void LLPanelGroup::onOpen(const LLSD& key)
{
	if(!key.has("group_id"))
		return;

	// open the desired panel
	if (key.has("open_tab_name"))
	{
		// onOpen from selected panel will be called from onTabSelected callback
		LLTabContainer* tab_ctrl = getChild<LLTabContainer>("groups_accordion");
		tab_ctrl->selectTabByName(key["open_tab_name"]);
	}

	LLUUID group_id = key["group_id"];
	if(!key.has("action"))
	{
		setGroupID(group_id);
		getChild<LLAccordionCtrl>("groups_accordion")->expandDefaultTab();
		return;
	}

	std::string str_action = key["action"];

	if(str_action == "refresh")
	{
		if(mID == group_id || group_id == LLUUID::null)
			refreshData();
	}
	else if(str_action == "close")
	{
		onBackBtnClick();
	}
	else if(str_action == "create")
	{
		setGroupID(LLUUID::null);
	}
	else if(str_action == "refresh_notices")
	{
		LLPanelGroupNotices* panel_notices = findChild<LLPanelGroupNotices>("group_notices_tab_panel");
		if(panel_notices)
			panel_notices->refreshNotices();
	}

}
Esempio n. 3
0
Message::Message()
{
    d = new MessageData;
    qRegisterMetaType<Message>("Message");
    setType( "" );
    setPayload( "" );
    setSenderID( 0 );
    setGroupID( 0 );
    setSeconds( 0 );
    setUseconds( 0 );
    setBridgeID( 0 );
    setHist( false );
    setName( "Unknown" );
    setSender( 0 );
}
Esempio n. 4
0
void LLPanelGroup::onOpen(const LLSD& key)
{
    if(!key.has("group_id"))
        return;

    LLUUID group_id = key["group_id"];
    if(!key.has("action"))
    {
        setGroupID(group_id);
        getChild<LLAccordionCtrl>("groups_accordion")->expandDefaultTab();
        return;
    }

    std::string str_action = key["action"];

    if(str_action == "refresh")
    {
        if(mID == group_id || group_id == LLUUID::null)
            refreshData();
    }
    else if(str_action == "close")
    {
        onBackBtnClick();
    }
    else if(str_action == "create")
    {
        setGroupID(LLUUID::null);
    }
    else if(str_action == "refresh_notices")
    {
        LLPanelGroupNotices* panel_notices = findChild<LLPanelGroupNotices>("group_notices_tab_panel");
        if(panel_notices)
            panel_notices->refreshNotices();
    }

}
Esempio n. 5
0
Message::Message( QString type, QByteArray payload, quint64 senderID, quint64 groupID,
                    quint32 seconds, quint32 useconds, quint32 bridgeID, bool hist ,
                    QString name, Target* sender )
{
    d = new MessageData;
    qRegisterMetaType<Message>("Message");

    setType( type );
    setPayload( payload );
    setSenderID( senderID );
    setGroupID( groupID );
    setSeconds( seconds );
    setUseconds( useconds );
    setBridgeID( bridgeID );
    setHist( hist );
    setName( name );
    setSender( sender );
}
Esempio n. 6
0
void LLPanelGroup::refreshData()
{
    if(mSkipRefresh)
    {
        mSkipRefresh = FALSE;
        return;
    }
    LLGroupMgr::getInstance()->clearGroupData(getID());

    setGroupID(getID());

    // 5 second timeout
    childDisable("btn_refresh");
    childDisable("groups_accordion");

    mRefreshTimer.start();
    mRefreshTimer.setTimerExpirySec(5);
}
Esempio n. 7
-10
//This is the main function that gets called from the Arduino program
void Ospom::Run(int SensorReadDelayMS)
{
  //Having these written out twice as const int's saves a lot of RAM
  const int  EEPIDLoc[23] = {9,28,47,66,85,104,123,142,161,180,199,218,237,256,275,294,313,332,351,370};
	//Location of Element Type (Sensor, actuator, nothing)
  const int EEPTypLoc[23] = {17,36,55,74,93,112,131,150,169,188,207,226,245,264,283,302,321,340,359,378};
	//Location of Element Function (Analog Read, Digital Read, Analog Write, ect)
  const int EEPFuncLoc[23] = {18,37,56,75,94,113,132,151,170,189,208,227,246,265,284,303,322,341,360,379};
	//Location of Element Slope(if sensor) or Fail Safe(if actuator) value
  const int EEPSlopeFSLoc[23] = {20,39,58,77,96,115,134,153,172,191,210,229,248,267,286,305,324,343,362,381};
	//Location of Element Y-intercept(if sensor) or Extra(if actuator)
  const int EEPYintExLoc[23] = {24,43,62,81,100,119,138,157,176,195,214,233,252,271,290,309,328,347,366,385};

  unsigned long TimeNow = 0;
  static unsigned long SensorStreamStartTime;
  static unsigned long LastMeasurement;
  static unsigned long LastSend;
  static unsigned int SendDelay;

  if (TriacDimming) {
    triacDimming();
  }

  if (incomingUSBmsg()) {
    if (groupCommand) {
      //Do Group Command Stuff
      switch (groupCommandVal()) {
        case 0:
          sendGroupID();
          break;
        case 10:
          sendSensorData();
          break;
        case 11:
	  SendDelay = GroupCommandInt;  //Grab the time in milliseconds
          SensorStreamStartTime = millis();                   //to delay before sending again
          SendData = true;
          break;
        case 13:
          sendActuatorData();
          break;
        case 17:
          watchDog();
          break;
        case 18:
          setGroupID();
          break;
        default:
          fail();
          break;
      }
    }
	//Element Command Section accepts commands and takes action
    else if (ElementCommand) {
	//Store the Element ID we are working with in a temporary variable
      char ElementID[9] = "        ";  //A temporary Variable for the ELement ID
      EEPROM.readBlock<char>(EEPIDLoc[ElementNumber], ElementID, 8);  //Reads the Element ID from EEPROM
      //Do what the command Character says
      if (ElementCommandChar == 'R') {
         //Read the element value, and send it back to the odroid 
        Serial.print(GroupID);
        Serial.print("/");
        Serial.print(ElementID);
        Serial.print(":");
        Serial.println(ElementCalVal[ElementNumber]);
      }
      else if (ElementCommandChar == 'I') {
         //Change the Elements ID
        EEPROM.updateBlock<char>(EEPIDLoc[ElementNumber], CommandCharArray, 8);
        success();
      }
      else if (ElementCommandChar == 'T') {
         //Change the Elements Type (s = sensor, a = actuator, n = nothing, z=SetBy EEPROM Loader Program)
	EEPROM.write(EEPTypLoc[ElementNumber],CommandCharArray[0]);
	ElementType[ElementNumber] = EEPROM.read(EEPTypLoc[ElementNumber]);
        success();
      }
      else if (ElementCommandChar == 'C') {
         //Change the Elements Function (0=unused, 1=analogRead, 2=digitalRead, 3=analogWrite, 
			// 4=digitalWrite, 5=Triac, 10=SetBy EEPROM Loader Program)
	EEPROM.updateInt(EEPFuncLoc[ElementNumber], ElementCommandInt);
	ElementFunction[ElementNumber] = EEPROM.readInt(EEPFuncLoc[ElementNumber]);
        success();
      }
      else if (ElementCommandChar == 'A') {
	//Read the Element Type and Send it back to the odroid
	Serial.print(GroupID);
        Serial.print("/");
        Serial.print(ElementID);
        Serial.print(":");
        Serial.println(ElementType[ElementNumber]);
      }
      else if (ElementCommandChar == 'D') {
	//Read the Element Function and Send it back to the odroid
	Serial.print(GroupID);
        Serial.print("/");
        Serial.print(ElementID);
        Serial.print(":");
        Serial.println(ElementFunction[ElementNumber]);
      }
      else if (ElementCommandChar == 'M') {
        //Change the Elements Calibration Slope
        EEPROM.updateFloat(EEPSlopeFSLoc[ElementNumber], ElementCommandFloat);  //Save value to EEPROM);
        ElementSlopeFS[ElementNumber] = ElementCommandFloat;
        success();
      }
      else if (ElementCommandChar == 'B') {
        //Change the Elements Calibration Slope
        EEPROM.updateFloat(EEPYintExLoc[ElementNumber], ElementCommandFloat);  //Save value to EEPROM);
        ElementYintEx[ElementNumber] = ElementCommandFloat;
        success();
      }
      else if (ElementCommandChar == 'W') {
	//Write (Set) the Actuator
	if (ElementType[ElementNumber] == 'a') {  //Make sure it's an actuator (so we don't break sensors)
	  if ((ElementFunction[ElementNumber] == 3) && (ElementCommandInt != 100) && (ElementCommandInt != 0)) {  //AnalogWrite
	    if ((ElementCommandInt > 0) && (ElementCommandInt < 100)) {
	      ElementCalVal[ElementNumber] = ElementCommandInt;  //Save the Actuator Value so it can tell what it is if asked
	      ElementCommandInt = ElementCommandInt * 255 / 100; //convert to 0-255 for PWM
	      analogWrite(ElementPin[ElementNumber], ElementCommandInt);  //AnalogWrite (PWM) if it's a 1-99 value
	      success();
	    }
	    else {
	      fail();
	    }
	  }     //This does the digital writes, and also takes care of 100% on and 100% off PWM dimming
	  else if ((ElementFunction[ElementNumber] == 4) || (ElementFunction[ElementNumber] == 3)) {  //DigitalWrite
	    ElementCalVal[ElementNumber] = ElementCommandInt;  //Save the Actuator Value so it can tell what it is if asked
	    if (ElementCommandInt == 0) { //0 means turn off the actuator
	      digitalWrite(ElementPin[ElementNumber], LOW);
	      success();
	    }
	    else if (ElementCommandInt == 100) {  //100 means turn on the actuator
	      digitalWrite(ElementPin[ElementNumber], HIGH);
	      success();
	    }
	    else {
	      fail();
	    }
	  }
	  else if (ElementFunction[ElementNumber] == 5) { //Triac Dimming 115v/240v AC Outlets
	      //Decides if the input was appropriate, and sets the Stored Value betwenn 0 and 100 %
	    if (ElementCommandInt == 0) {
	      digitalWrite(ElementPin[ElementNumber], LOW);
	      ElementCalVal[ElementNumber] = ElementCommandInt;  //Save the Actuator Value so it can tell what it is if asked
	      success();
	    }
	    else if (ElementCommandInt == 100) {  //100 means turn on the outlet all the way
	      digitalWrite(ElementPin[ElementNumber], HIGH);
	      ElementCalVal[ElementNumber] = ElementCommandInt;
	      success();
	    }
	    else if ((ElementCommandInt > 0.00) && (ElementCommandInt < 100.00)) {
	      ElementCalVal[ElementNumber] = ElementCommandInt;
	      ElementTotalValue[ElementNumber] = ElementCalVal[ElementNumber];
	      ElementTotalValue[ElementNumber] = 80 * ElementTotalValue[ElementNumber];
	      ElementTotalValue[ElementNumber] = 8000 - ElementTotalValue[ElementNumber];
	      ElementYintEx[ElementNumber] = 1;
	    //  ElementCalVal[ElementNumber] = 80 * ElementCalVal[ElementNumber];  //convert to Delay:
            //  ElementCalVal[ElementNumber] = 8000 - ElementCalVal[ElementNumber];  // MilliDelay=8300-(83*%Dim)
	      Serial.println(ElementCalVal[ElementNumber]);
	      Serial.println(ElementTotalValue[ElementNumber]);
	      success();
	    }
	    else {
	      fail();
	    }
	      //Sets the TriacDimming Boolean to true if any of the outlets are dimmed between 1 and 99%
	    TriacDimming = false;
	    for (int i = 0; i < 20; i++) {
   	     if (ElementType[i] == 'a') {   //s = sensor, a = actuator, n = nothing
    	       if (ElementFunction[i] == 5) {  // 5=Triac Dimming
		 if ((ElementCalVal[i] < 100.00) && (ElementCalVal[i] > 0.00)) {
		   TriacDimming = true;
		 }
	       }
	     }
	   }
	  }
	  else {
	    fail();
	  }
   	}
	else {
	  fail();
	}
      }
      else if (ElementCommandChar == 'S') {  //Not sure if storing an in where a float goes sometimes will matter
	//Set Fail Safe Value
	EEPROM.updateInt(EEPSlopeFSLoc[ElementNumber], ElementCommandInt);
	ElementSlopeFS[ElementNumber] = ElementCommandInt;
        success();
      }
      else if (ElementCommandChar == 'F') {
	//Read Fail Safe Value
	Serial.print(GroupID);
        Serial.print("/");
        Serial.print(ElementID);
        Serial.print(":");
        Serial.println(EEPROM.readInt(EEPSlopeFSLoc[ElementNumber]));
      }
      else {
        fail();  //Return a -1
      }
      clearTheMsg(); 

    }
    else {
      fail();
    }

    clearTheMsg();
  }

  //Measure sensor elements (with the delay decided in the main sketch), put them in an array
  TimeNow = millis();  //Check the time
  if (TimeNow > LastMeasurement + SensorReadDelayMS) {
    LastMeasurement = millis();
    readSensors();  
  }

  //Send a Stream of Sensor Data for 1 minute if it has been requested
  if (SendData) {
    if (SensorStreamStartTime + 60000 > TimeNow)  {  //Send Data Stream
      if (Pause) {
        Pause = false;
      }
      else {
        if (TimeNow > LastSend + SendDelay) {
          sendSensorData();
          LastSend = millis();
        }
      }
    }
    else {  //  Stop Sending Data
      SendData = false;
      SensorStreamStartTime = 0;
      SendDelay = 0;
      LastSend = 0;
    }
  }
}