Code Monkey home page Code Monkey logo

Comments (5)

UltimatPronin avatar UltimatPronin commented on May 26, 2024

@taligentx, I find all needed parts inside dscKeybusPrintData.cpp
in [Armed by access code] & [Disarmed by access code] sections.

The main idea is to know and maybe log which user armed/disarmed system.

Maybe in future you will add storage of last used access code number in variable to simplify usage together with Admed/Disarmed events?

For now I will try to get this codes numbers in my sketch using code parts from dscKeybusPrintData.cpp.

from dsckeybusinterface.

taligentx avatar taligentx commented on May 26, 2024

As you've seen, the data is available but not currently tracked, I'll look into it.

from dsckeybusinterface.

UltimatPronin avatar UltimatPronin commented on May 26, 2024

@taligentx ,thank you!
Now I get it like this:

String sUserCode_id="";
void setStatus(byte partition) {
...
switch (dsc.status[partition]) {
...
case 0x04: __getAccesCodeID(); writeLog("Armed stay by "+sUserCode_id); break;
...
}
}

void __getAccesCodeID() {
  
  sUserCode_id="";
  bool bOK=false;
  while (!bOK){
    switch (dsc.panelData[0]) {
      //case 0xA5: bOK=true; __getAccesCodeID_0xA5(); break;      
      case 0xEB: bOK=true; __getAccesCodeID_0xEB(); break; //Access Code ID always is getted here 
      default: {      
        break;
      }
    }
    
    dsc.handlePanel();  // Continues processing Keybus data
  }
}

void __getAccesCodeID_0xEB() {  
  switch (dsc.panelData[7]) {
    case 0x00: __getAccesCodeID_0(8); return;
  default: {      
      return;
    }
  }
}


void __getAccesCodeID_0(byte panelByte) {

  bool decoded = true;
  switch (dsc.panelData[panelByte]) {
    case 0x49: break;
    case 0x4A: break;
    case 0x4B: break;
    case 0x4C: break;
    case 0x4D: break;
    case 0x4E: break;
    case 0x4F: break;
    case 0x50: break;
    case 0x51: break;
    case 0x52: break;
    case 0x53: break;
    case 0x54: break;
    case 0x55: break;
    // 0x56 - 0x75: Zone tamper, zones 1-32
    // 0x76 - 0x95: Zone tamper restored, zones 1-32
    case 0x98: break;
    // 0x99 - 0xBD: Armed by access code
    case 0xBE: break;
    case 0xBF: break;
    // 0xC0 - 0xE4: Disarmed by access code
    case 0xE5: break;
    case 0xE6: break;
    case 0xE7: break;
    case 0xE8: break;
    case 0xE9: break;
    case 0xEA: break;
    case 0xEC: break;
    case 0xEF: break;
    case 0xF0: break;
    case 0xF1: break;
    case 0xF4: break;
    case 0xFF: break;
    default: decoded = false;
  }
  if (decoded) return;


  if (dsc.panelData[panelByte] >= 0x99 && dsc.panelData[panelByte] <= 0xBD) {
    byte dscCode = dsc.panelData[panelByte] - 0x98;
    if (dscCode >= 35) dscCode += 5;

  //sUserCode_id+="Armed by ";
  switch (dscCode) {
    case 33: sUserCode_id+="duress "; break;
    case 34: sUserCode_id+="duress "; break;
    case 40: sUserCode_id+="master "; break;
    case 41: sUserCode_id+="supervisor "; break;
    case 42: sUserCode_id+="supervisor "; break;
    default: sUserCode_id+="user "; break;
  }
  sUserCode_id+="code ";
  sUserCode_id+=String(dscCode);   
  
    return;
  }

 
  
  if (dsc.panelData[panelByte] >= 0xC0 && dsc.panelData[panelByte] <= 0xE4) {
    byte dscCode = dsc.panelData[panelByte] - 0xBF;
    if (dscCode >= 35) dscCode += 5;
  //sUserCode_id+="Disarmed by ";
  switch (dscCode) {
    case 33: sUserCode_id+="duress "; break;
    case 34: sUserCode_id+="duress "; break;
    case 40: sUserCode_id+="master "; break;
    case 41: sUserCode_id+="supervisor "; break;
    case 42: sUserCode_id+="supervisor "; break;
    default: sUserCode_id+="user "; break;
  }
  sUserCode_id+="code ";
  sUserCode_id+=String(dscCode); 
  
    return;
  }
}

I think this is not the best way, but it works in my current test sketch.

from dsckeybusinterface.

taligentx avatar taligentx commented on May 26, 2024

Added to the develop branch, check the Status examples to see how it can be used. Note that the panel sends the access code in a separate message after the armed/disarmed status, so it's handled as a separate status instead of combined with the armed status checking.

from dsckeybusinterface.

UltimatPronin avatar UltimatPronin commented on May 26, 2024

Thank you!

from dsckeybusinterface.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.