Parse BLE advertiser manufacturer specific data for StickNFind.
@param {Object} advertiserData The object containing all parsed data.
165926
function process(advertiserData) {
  var data = advertiserData.manufacturerSpecificData.data;
  var packetType = data.substr(0,2);

  switch(packetType) {
    case '01':
      snfsingle.process(advertiserData);
      break;
    case '42':
      snsmotion.process(advertiserData);
      break;
    default:
  }
}
890852
function printCollectedDeviceData(results) {
        var dataToKeep = {
            'AIN0': 'val',
            'FIRMWARE_VERSION': 'val',
            'WIFI_IP': 'str',
            'ETHERNET_IP': 'str',
            'WIFI_RSSI': 'str',
            'WIFI_VERSION': 'val',
            'SERIAL_NUMBER': 'val',
            'HARDWARE_INSTALLED': 'productType',
        };
        var vals = [];
        results.forEach(function(result) {
            result = result.data;
            var data = {};
            var keyToKeep = 'res';
            if(dataToKeep[result.name]) {
                keyToKeep = dataToKeep[result.name];
            }
            data[result.name] = result.res;
            if(result[keyToKeep]) {
                data[result.name] = result[keyToKeep];
            }
            vals.push(data);
        });

        if(DEBUG_COLLECTED_DEVICE_DATA) {
            console.log('Connection Type', self.curatedDevice.savedAttributes.connectionTypeName);
            console.log('Serial Number', self.curatedDevice.savedAttributes.serialNumber);
            console.log('Read Data', self.curatedDevice.getDevice().handle,':');
            console.log(vals);
        }
    }
534091
function process(data) {
  var uuid = data.substr(2,2) + data.substr(0,2);

  // NOTE: this is for legacy compatibility
  var advertiserData = {
    serviceData: {
      uuid: uuid,
      data: data.substr(4)
    }
  };

  gattservices.process(advertiserData);

  return advertiserData.serviceData;
}
454934
function process(data) {
  var companyIdentifierCode = data.substr(2,2);
  companyIdentifierCode += data.substr(0,2);

  var companyName = companyIdentifierCodes.companyNames[companyIdentifierCode];
  if(typeof companyName === 'undefined') {
    companyName = 'Unknown';
  }

  // NOTE: this is for legacy compatibility
  var advertiserData = {
    manufacturerSpecificData: {
      companyName : companyName,
      companyIdentifierCode: companyIdentifierCode,
      data: data.substr(4)
    }
  };

  // Handle the unique case of AltBeacon
  if(altbeacon.isAltBeacon(advertiserData)) {
    altbeacon.process(advertiserData);
    return advertiserData.manufacturerSpecificData;
  }

  // Interpret the manufacturer specific data, if possible
  // Kindly respect ascending order of company identifier codes 
  switch(companyIdentifierCode) {
    case '004c':
      apple.process(advertiserData);
      return advertiserData.manufacturerSpecificData;
    case '00f9':
      sticknfind.process(advertiserData);
      return advertiserData.manufacturerSpecificData;
    case '015d':
      estimote.process(advertiserData);
      return advertiserData.manufacturerSpecificData;
    case '0274':
      motsai.process(advertiserData);
      return advertiserData.manufacturerSpecificData;
    case '0583':
      codebluecommunications.process(advertiserData);
      return advertiserData.manufacturerSpecificData;
    default:
      return advertiserData.manufacturerSpecificData;
  }
}
375076
function ads(query){
  var params = parse(query);
  for (var key in params) {
    for (var id in QUERYIDS) {
      if (key === id) {
        return {
          id : params[key],
          type : QUERYIDS[id]
        };
      }
    }
  }
}
649392
function data(selector, bindImmediate) {
    return function (target, propertyKey) {
        var metaTarget = target instanceof _angular_1.DataObserver ? target : target.constructor;
        var bindingsMeta = Reflect.getMetadata(constance_1.STATEX_DATA_BINDINGS_KEY, metaTarget);
        if (!Reflect.hasMetadata(constance_1.STATEX_DATA_BINDINGS_KEY, metaTarget)) {
            bindingsMeta = { selectors: {}, subscriptions: [], destroyed: !bindImmediate };
        }
        bindingsMeta.selectors[propertyKey] = selector;
        if (bindImmediate) {
            bindingsMeta.subscriptions.push({
                target: target,
                subscription: bindData(target, propertyKey, selector)
            });
        }
        Reflect.defineMetadata(constance_1.STATEX_DATA_BINDINGS_KEY, bindingsMeta, metaTarget);
    };
}
241841
private void updateConversationAdvertiserIdentifier(Conversation conversation) {
		checkConversationQueue();

		try {
			Configuration config = Configuration.load();
			if (config.isCollectingAdID()) {
				AdvertisingIdClientInfo info = AdvertiserManager.getAdvertisingIdClientInfo();
				String advertiserId = info != null && !info.isLimitAdTrackingEnabled() ? info.getId() : null;
				conversation.getDevice().setAdvertiserId(advertiserId);
			}
		} catch (Exception e) {
			ApptentiveLog.e(ADVERTISER_ID, e, "Exception while updating conversation advertiser id");
			logException(e);
		}
	}
157843
def parse_and_validate(unparsed_data)
      parsed_data = JSON.parse(unparsed_data)
      if parsed_data['deprecated']
        STDERR.puts "WARNING: Fauxhai platform data for #{parsed_data['platform']} #{parsed_data['platform_version']} is deprecated and will be removed in the 7.0 release 3/2019. #{PLATFORM_LIST_MESSAGE}"
      end
      parsed_data
    end
261925
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
	private boolean matchesPartialData(@Nullable final byte[] data,
									   @Nullable final byte[] dataMask,
									   @Nullable final byte[] parsedData) {
		if (data == null) {
			// If filter data is null it means it doesn't matter.
			// We return true if any data matching the manufacturerId were found.
			return parsedData != null;
		}
		if (parsedData == null || parsedData.length < data.length) {
			return false;
		}
		if (dataMask == null) {
			for (int i = 0; i < data.length; ++i) {
				if (parsedData[i] != data[i]) {
					return false;
				}
			}
			return true;
		}
		for (int i = 0; i < data.length; ++i) {
			if ((dataMask[i] & parsedData[i]) != (dataMask[i] & data[i])) {
				return false;
			}
		}
		return true;
	}
611876
function parseData(data)
{
    var tmp_data = {};
    if (nlib.isString(data)) {
        if (data.match(/\.json/i) && grunt.file.exists(data)) {
          tmp_data = grunt.file.readJSON(data);
        } else if (data.match(/\.ya?ml/i) && grunt.file.exists(data)) {
          tmp_data = grunt.file.readYAML(data);
        } else {
            tmp_data = data;
        }
    } else if (nlib.isObject(data) || nlib.isArray(data)) {
        for (var i in data) {
            if (nlib.isString(data[i])) {
                var parsed = parseData(data[i]);
                if (nlib.isString(parsed)) {
                    tmp_data[i] = parsed;
                } else {
                    tmp_data = merge(tmp_data, parsed);
                }
            } else {
                tmp_data = merge(tmp_data, data[i]);
            }
        }
    }
    return tmp_data;
}
763982
function Bid(value) {
  if (this.init_) {
    this.init_();
  }
  /** @property {Array.<number, number>} [sizes] the dimension sizes of the slot bid */
  this.sizes =  [];
  /** @property {string} [slot] the slot name */
  this.slot;
  /** @property {string|number} value the bid value. Default: empty string */
  this.value = util.asType(value) === 'undefined' ? '' : value;
  /** @property {string} type derived bid value type: from {@link util.asType}  */
  this.type = util.asType(this.value);
  /** @property {string} [label] optional label for adserver key targeting for bid value e.g. <code>label=2.00</code> */
  this.label;
  /** @property {string} [provider] the bid provider name */
  this.provider;
  /** @property {object} [targeting] ad server targeting key/values in addition to the bid value */
  this.targeting = {};
}
1208589
def contact_advertiser(self, name, email, contact_number, message):
        

        req = Request(debug=self._debug)

        ad_search_type = self.search_type
        agent_id = self.agent_id
        ad_id = self.id

        response = req.post('https://www.daft.ie/ajax_endpoint.php?', params={
            'action': 'daft_contact_advertiser',
            'from': name,
            'email': email,
            'message': message,
            'contact_number': contact_number,
            'type': ad_search_type,
            'agent_id': agent_id,
            'id': ad_id
        })

        if self._debug:
            logging.info("Status code: %d" % response.status_code)
            logging.info("Response: %s" % response.content)
        if response.status_code != 200:
            logging.error("Status code: %d" % response.status_code)
            logging.error("Response: %s" % response.content)
        return response.status_code == 200
64944
function searchForBondedDevice(params)
{
	console.log('Searching for bonded device')
	evothings.ble.getBondedDevices(
		// Success function.
		function(devices)
		{
			for (var i in devices)
			{
				var device = devices[i]
				if (device.name == params.name)
				{
					console.log('Found bonded device: ' + device.name)
					params.onFound(device)
					return // bonded device found
				}
			}
			params.onNotFound()
		},
		// Error function.
		function(error)
		{
			params.onNotFound()
		},
		{ serviceUUIDs: params.serviceUUIDs })
}
518224
function ParseReply(mesgId, data, sid) {
    var i;

    for(i = 0 ; i < callbackList.length ; i++) {
        if(callbackList[i].id.toString() === mesgId.toString() ) {
            callbackList[i].func(data, sid);
        }
    }
}
397570
def _parse_v2_advertisement(self, rssi, sender, data):
        

        if len(data) != 31:
            return

        # We have already verified that the device is an IOTile device
        # by checking its service data uuid in _process_scan_event so
        # here we just parse out the required information

        device_id, reboot_low, reboot_high_packed, flags, timestamp, \
        battery, counter_packed, broadcast_stream_packed, broadcast_value, \
        _mac = unpack("<LHBBLBBHLL", data[7:])

        reboots = (reboot_high_packed & 0xF) << 16 | reboot_low
        counter = counter_packed & ((1 << 5) - 1)
        broadcast_multiplex = counter_packed >> 5
        broadcast_toggle = broadcast_stream_packed >> 15
        broadcast_stream = broadcast_stream_packed & ((1 << 15) - 1)

        # Flags for version 2 are:
        #   bit 0: Has pending data to stream
        #   bit 1: Low voltage indication
        #   bit 2: User connected
        #   bit 3: Broadcast data is encrypted
        #   bit 4: Encryption key is device key
        #   bit 5: Encryption key is user key
        #   bit 6: broadcast data is time synchronized to avoid leaking
        #   information about when it changes

        self._device_scan_counts.setdefault(device_id, {'v1': 0, 'v2': 0})['v2'] += 1

        info = {'connection_string': sender,
                'uuid': device_id,
                'pending_data': bool(flags & (1 << 0)),
                'low_voltage': bool(flags & (1 << 1)),
                'user_connected': bool(flags & (1 << 2)),
                'signal_strength': rssi,
                'reboot_counter': reboots,
                'sequence': counter,
                'broadcast_toggle': broadcast_toggle,
                'timestamp': timestamp,
                'battery': battery / 32.0,
                'advertising_version':2}

        self._trigger_callback('on_scan', self.id, info, self.ExpirationTime)

        # If there is a valid reading on the advertising data, broadcast it
        if broadcast_stream != 0xFFFF & ((1 << 15) - 1):
            if self._throttle_broadcast and \
               self._check_update_seen_broadcast(sender, timestamp, broadcast_stream, broadcast_value,
                                                 broadcast_toggle, counter=counter, channel=broadcast_multiplex):
                return

            reading = IOTileReading(timestamp, broadcast_stream, broadcast_value, reading_time=datetime.datetime.utcnow())
            report = BroadcastReport.FromReadings(info['uuid'], [reading], timestamp)
            self._trigger_callback('on_report', None, report)
1338243
static void parseData(String[] args, BiConsumer<String, Boolean> data) {
        CommandLine commandLine = parseCommandLine(args);
        Object value = commandLine.optionValue("d");
        if (value != null) {
            data.accept(value.toString(), commandLine.hasOption("x"));
        } else {
            data.accept(null, commandLine.hasOption("x"));
        }
    }
268249
function (data) {
        var items = [];
        data.forEach(function (d, i) {
            if (d.includes('ITEM:') && d.length > 3) {
                var iid = data[i + 1];
                var item = {
                    item: {
                        id: Number(iid[1].trim()),
                        name: d[2].replace(/_/g, ' '),
                        price: d[3],
                        change: d[4]
                    }
                };
                items.push(item);
            }
        });
        return items;
    }