code: function extractAssociationIds(devices) {
    var associationIds = [];
  
    for(var deviceId in devices) {
      var device = devices[deviceId];
      var hasAssociationIds = device.hasOwnProperty("associationIds");
      if(!hasAssociationIds) {
        device.associationIds = reelib.tiraid.getAssociationIds(device);
      }
      for(var cId = 0; cId < device.associationIds.length; cId++) {
        if(associationIds.indexOf(device.associationIds[cId]) < 0) {
          associationIds.push(device.associationIds[cId]);
        }
      }
    }
  
    return associationIds;
  }
docs: Extract all non-duplicate association ids from the given list of devices,
  adding an assocationIds field to each device when absent.
  @param {Object} devices The given devices.
  @return {Array} Non-duplicate association identifiers.