Access Cell tower Objects using Telephony package in react native - reactjs

I am trying to make geolocation request with API call (in react native) https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_API_KEY. This API takes following inputs in request body.
{
"homeMobileCountryCode": 310,
"homeMobileNetworkCode": 410,
"radioType": "gsm",
"carrier": "Vodafone",
"considerIp": "true",
"cellTowers": [
// See the Cell Tower Objects section below.
],
"wifiAccessPoints": [
// See the WiFi Access Point Objects section below.
]
}
{
"cellTowers": [
{
"cellId": 42,
"locationAreaCode": 415,
"mobileCountryCode": 310,
"mobileNetworkCode": 410,
"age": 0,
"signalStrength": -60,
"timingAdvance": 15
}
]
}
I am able to get all properties listed above except following using package Telephony and CarrierInfo in react native. It would be great if someone can locate the package and function to get these details in react-native.
locationAreaCode
age
signalStrength
timingAdvance

Related

Problem with StatusReport trait in Smart Home Actions

I have a Security System with traits action.devices.traits.ArmDisarm and action.devices.traits.StatusReport and some other sensors: WaterLeak Sensor, Door Sensor ...
I report some errors about other devices with StatusReport state.
For example: when the door sensor detects that the door is open, the security system must give deviceOpen error.
When I say, "Is my security system ok?", my server's response to the query intent is the JSON below, but Google Assistant says that he couldn't reach my action (Unexpected error happened).
Is there anything wrong with this response?
{
"requestId": "10417064006786362499",
"payload": {
"devices": {
"3rL3QL7Kq2HrQjs53Y7o": {
"isArmed": true,
"currentStatusReport": [
{
"blocking": true,
"deviceTarget": "4BCIpzBWpgLA24mMI7r2",
"priority": 0,
"statusCode": "deviceOpen"
},
{
"blocking": true,
"deviceTarget": "MxRCd6ERRSWzYzyNTE8S",
"priority": 0,
"statusCode": "waterLeakDetected"
}
],
"status": "EXCEPTIONS",
"online": true
}
}
}
}
In Firebase Console there are no errors.
Logs in Firebase Console
Your response to the query intent looks right, but there might be an error in other parts of the process. You can follow the Troubleshooting Guide to see how your failed intent is counted in the Smart Home metrics and what are the details on your logs. (Firebase logs only gives info about your server. The logging mentioned in the guide (Google Cloud Logging) is a different and more comprehensive for the intent handling)

Camel - Poll rest endpoint and split JSON list

So I have a rest API that lives at https://foo.bar/api which returns either an empty json list [] or a list that contains 1 or more items:
[
{
"#class": "foo.bar.java.MyObject",
"name": "Joe Bloggs"
},
{
"#class": "foo.bar.java.MyObject",
"name": "Fred Flinstone"
}
]
Now I am trying to have camel take in this data from my endpoint and hand each object within the list to a processor. I've tried the following:
fromF("timer://foo-poll?fixedRate=true&delay=5s&period=%d&bridgeErrorHandler=true", pollRate)
.toF("https4://%s/%s", host, requestPath)
.log("Received: ${body}")
.split()
.jsonpath("$")
.log("Split: ${body}")
.process(barProccessor);
As well as various attempts to unmarshal the data using .unmarshal(new ListJacksonDataFormat(MyObject.class)) or .unmarshal().json(JsonLibrary.Jackson, List.class)
where nothing has worked.
Using the larger code block above, there are no errors nor is the "Split: ${body}" log message printers out.
Unmarshalling using either methods described above throws this regardless of how many items are returned from the API:
com.fasterxml.jackson.databind.exc.MismatchedInputException: No
content to map due to end-of-input
When there
Okay, managed to figure this out if anyone else is facing a similar issue. The working route builder:
fromF("timer://foo-poll?fixedRate=true&delay=5s&period=%d&bridgeErrorHandler=true", pollRate)
.toF("https4://%s/%s", host, requestPath)
.log("Received: ${body}")
.streamCaching("true")
.unmarshal(new ListJacksonDataFormat(MyObject.class))
.split()
.jsonpath("$")
.log("Split: ${body}")
.process(barProccessor);
I have enabled stream caching and unmarshalled the list using Jackson.

JSON-LD: 'Syntax error: value, object or array expected.'

I am getting the "value, object or array expected." syntax error when I test my JSON-LD code with Google's Structured Data Testing Tool. The error appears on line 143 of my code.
I am implementing Schema.org for a local business website with JSON-LD. I have
tried replacing the [ brackets with } brackets for the image object, and
even tried removing the comma on line 143. I either get the same error, or new errors appear. I have searched other problems related to this error, but they both had different code.
{
"#context": "https://schema.org",
"#type": "LocalBusiness",
"image": [
"http://secureservercdn.net/166.62.110.232/kkk.bd6.myftpupload.com/wp-
content/uploads/2019/05/360webclicks-logo2-4.fw_.png",
],
Highlighted error in the SDTT:
The last value must not be followed by a comma.
So, this
"image": [
"image.png",
],
should be this
"image": [
"image.png"
],
If you only have one value, you could omit the array ([…]):
"image": "image.png",

Training Job in Sagemaker gives error in locating file in S3 to docker image path

I am trying to use scikit_bring_your_own/container/decision_trees/train mode, running in AWS CLI, I had no issues. Trying to replicate in Creating Sagemaker Training Job , facing issue in loading data from S3 to docker image path.
In CLI command we used specify the docker run -v $(pwd)/test_dir:/opt/ml --rm ${image} train from where the input needs to referred.
In training job, mentioned the S3 bucket location and output path for model artifacts.
Error entered in the exception as in train - "container/decision_trees/train"
raise ValueError(('There are no files in {}.\n' +
'This usually indicates that the channel ({}) was incorrectly specified,\n' +
'the data specification in S3 was incorrectly specified or the role specified\n' +
'does not have permission to access the data.').format(training_path, channel_name))
Traceback (most recent call last):
File "/opt/program/train", line 55, in train
'does not have permission to access the data.').format(training_path, channel_name))
So not understanding is there any tweaking required or any access missing.
kindly help
If you set the InputDataConfig in the CreateTrainingJob API like this
"InputDataConfig": [
{
"ChannelName": "train",
"DataSource": {
"S3DataSource": {
"S3DataDistributionType": "FullyReplicated",
"S3DataType": "S3Prefix",
"S3Uri": "s3://<bucket>/a.csv"
}
},
"InputMode": "File",
},
{
"ChannelName": "eval",
"DataSource": {
"S3DataSource": {
"S3DataDistributionType": "FullyReplicated",
"S3DataType": "S3Prefix",
"S3Uri": "s3://<bucket>/b.csv"
}
},
"InputMode": "File",
}
]
SageMaker download the data specified above from S3 to the /opt/ml/input/data/channel_name directory in the Docker container. In this case, the algorithm container should be able to find the input data under
/opt/ml/input/data/train/a.csv
/opt/ml/input/data/eval/b.csv
You can find more details in https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-training-algo.html

sagemaker deep forecaseting file parsing error

I am trying out Deep AR foreDeep AR Forecastingcasting training algorithm. My training job keeps failing with the following error while parsing the jsonlines file:
row: 1) Failure reason
ClientError: Error when parsing json (source: /opt/ml/input/data/train/daily_call_vol_lines.json, row: 1)
I am attaching the file (json) with json lines format I tried with
Any help into why the parser fails on sagemaker side would help!
Pasting the file content:
{
"TimeStamp": "2017-07-01",
"Number of Calls": 14
}
{
"TimeStamp": "2017-07-02",
"Number of Calls": 62
}
{
"TimeStamp": "2017-07-03",
"Number of Calls": 972
}
The format you are using is not supported, each line should be of this form for a json file: {"start": "2017-07-01", "target": [14, 62, 972, ...]}. The description of the formats that are supported can be found here, you can also have a look of this end-to-end example that generates training data in json format.

Resources