Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBJECT_LIST response format request. #187

Open
1 of 3 tasks
paloky opened this issue Oct 23, 2024 · 0 comments
Open
1 of 3 tasks

OBJECT_LIST response format request. #187

paloky opened this issue Oct 23, 2024 · 0 comments

Comments

@paloky
Copy link

paloky commented Oct 23, 2024

Node Version: 18.19.0

Node BACstack Version: 0.0.1-beta.14

  • Bug Report
  • Feature Request
  • Question

Hi.
I am making a Bacnet server for an IoT application.
I am having problems with the return of the Objects list. The client (YABE) always responds with “Could not read the ‘Object List’ count”.

How should I respond to the OBJECT_LIST request?

Here my test code:

  server.on('readProperty', (request, remoteAddress) => {
        console.log('Received "readProperty" ');
        console.log(request);

        const objectId = request.request.objectId;
        const propertyId = request.request.property.id;        
                
        // Lectura del DEVICE
        //if (objectId.type==8 && propertyId==bacnet.enum.PropertyIdentifier.OBJECT_LIST)
        if (propertyId === bacnet.enum.PropertyIdentifier.OBJECT_LIST) 
        {       
          console.log("Generando Lista de Objetos....");
          
        
             const objectsTable = {
               '0': { type: bacnet.enum.ObjectType.ANALOG_INPUT },
               '1': { type: bacnet.enum.ObjectType.ANALOG_OUTPUT },
               // Add more object if necessari.
             };
  
           
            const bac_obj_list = Object.keys(objectsTable).map(instance => ({
              type: bacnet.enum.ApplicationTags.OBJECTIDENTIFIER,
              value: {type: objectsTable[instance].type, instance: parseInt(instance, 10)}
            }));
    
            console.log("ObjectList: ", bac_obj_list);
            
       //     server.readPropertyResponse(request.address, request.invokeId, objectId, propertyId, [
       //         {value: bac_obj_list, type: bacnet.enum.ApplicationTags.OBJECTIDENTIFIER}
       //     ]);
            
            server.readPropertyResponse(request.address, request.invokeId, objectId, propertyId, bac_obj_list);
  
        }
        return;

What am I doing wrong?
Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant