MMAL error, failed to enable port - Raspberry Pi Q&A, Help & Troubleshooting

HI, I have this issue of not being able to connect to my Rpi camera, which is for home security use.
I think the problem may be that more than one process is trying to connect to the camera at the same time, but:
1. How can I find out which processes may be trying to connect?
2. How can I disable /delete those processes?
This is my alarm.py code. I think it's from this site: https://circuitdigest.com/microcontroller-projects/raspberry-pi-iot-intruder-alert-system
Code:
#!/usr/bin/env python3
import RPi.GPIO as gpio
import picamera
import time
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email import encoders
from email.mime.image import MIMEImage
fromaddr = "email_address" # change the email address accordingly
toaddr = "to_another_email_address"
mail = MIMEMultipart()
mail['From'] = fromaddr
mail['To'] = toaddr
mail['Subject'] = "Attachment"
body = "Please find the attachment"
led=17
pir=18
HIGH=1
LOW=0
gpio.setwarnings(False)
gpio.setmode(gpio.BCM)
gpio.setup(led, gpio.OUT) # initialize GPIO Pin as outputs
gpio.setup(pir, gpio.IN) # initialize GPIO Pin as input
data=""
def sendMail(data):
mail.attach(MIMEText(body, 'plain'))
print data
dat='%s.jpg'%data
print dat
attachment = open(dat, 'rb')
image=MIMEImage(attachment.read())
attachment.close()
mail.attach(image)
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(fromaddr, "make_password")
text = mail.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
def capture_image():
data= time.strftime("%d_%b_%Y|%H:%M:%S")
camera.start_preview()
time.sleep(5)
print data
camera.capture('%s.jpg'%data)
camera.stop_preview()
time.sleep(1)
sendMail(data)
gpio.output(led , 0)
camera = picamera.PiCamera()
camera.rotation=0
camera.awb_mode= 'auto'
camera.brightness=55
while 1:
if gpio.input(pir)==1:
gpio.output(led, HIGH)
capture_image()
while(gpio.input(pir)==1):
time.sleep(1)
else:
gpio.output(led, LOW)
time.sleep(0.01)
Thanks!

Related

Question about AudioRoutingManager

How to call a method SetAudioEndPoint from the class AudioRoutingManager?
I'm doing all the instructions with " msdn.microsoft.com/en-us/library/windowsphone/develop/jj207046(v=vs.105).aspx ". But when I try to call SetAudioEndPoint exception occurs "Eccess denied". What to do?
P.S. VoIP classes I do not use. ID_CAP_VOIP I added. Maybe it's because there is no active VoIP call?
Depends on the value of the enumeration you've chosen.
You can read more?
I try this:
Code:
LPCWSTR renderId = GetDefaultAudioRenderId(AudioDeviceRole::Communications);
HRESULT hr = E_FAIL;
hr = ActivateAudioInterface(renderId, __uuidof(IAudioClient2), (void**)&m_pDefaultRenderDevice);
hr = m_pDefaultRenderDevice->GetMixFormat(&m_waveFormatEx);
AudioClientProperties properties = {};
properties.cbSize = sizeof AudioClientProperties;
properties.eCategory = AudioCategory_Other;
hr = m_pDefaultRenderDevice->SetClientProperties(&properties);
WAVEFORMATEX temp;
MyFillPcmFormat(temp, 2, 44100, 16); // stereo, 44100 Hz, 16 bit
*m_waveFormatEx = temp;
m_sourceFrameSizeInBytes = (m_waveFormatEx->wBitsPerSample / 8) * m_waveFormatEx->nChannels;
hr = m_pDefaultRenderDevice->Initialize(AUDCLNT_SHAREMODE_SHARED, 0x88000000, 1000 * 10000, 0, m_waveFormatEx, NULL);
hr = m_pDefaultRenderDevice->GetService(__uuidof(IAudioRenderClient), (void**)&m_pRenderClient);
hr = m_pDefaultRenderDevice->Start();
The sound is played. But if I try to change SetAudioEndPoint an error occurs.
What's wrong?
Topic can be closed. I understood. Thank you all!
Please include an explanation of how you solved the problem so others who encounter it can find the fix!
You can then close the topic yourself if you want to, since you are the thread owner.

Bluetooth Amazon FireTV Stick Remote

I have made some progress in finding out whats wrong but no idea how to fix it.
After installing evtest I get the following:
Code:
OpenELEC:~ # cat /proc/bus/input/devices
I: Bus=0005 Vendor=1949 Product=0404 Version=011b
N: Name="Amazon Fire TV Remote"
P: Phys=00:1a:7d:da:71:13
S: Sysfs=/devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/bluetooth/hci0/hci0:71/0005:1949:0404.0001/input/input0
U: Uniq=a0:02:dc:e0:f9:d7
H: Handlers=kbd event0
B: PROP=0
B: EV=10001b
B: KEY=10000 1110 40000800 1681 0 0 0
B: ABS=100 0
B: MSC=10
Code:
OpenELEC:~ # evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x5 vendor 0x1949 product 0x404 version 0x11b
Input device name: "Amazon Fire TV Remote"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 96 (KEY_KPENTER)
Event code 103 (KEY_UP)
Event code 105 (KEY_LEFT)
Event code 106 (KEY_RIGHT)
Event code 108 (KEY_DOWN)
Event code 139 (KEY_MENU)
Event code 158 (KEY_BACK)
Event code 164 (KEY_PLAYPAUSE)
Event code 168 (KEY_REWIND)
Event code 172 (KEY_HOMEPAGE)
Event code 208 (KEY_FASTFORWARD)
Event type 3 (EV_ABS)
Event code 40 (ABS_MISC)
Value 0
Min 0
Max 255
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Properties:
Property type 20 (EV_REP)
Property code 0 (REP_DELAY)
Value 1000
Property code 1 (REP_PERIOD)
Value 33
Testing ... (interrupt to exit)
***********************************************
This device is grabbed by another process.
No events are available to evtest while the
other grab is active.
In most cases, this is caused by an X driver,
try VT-switching and re-run evtest again.
***********************************************
So something is capturing the input and not letting it go through. Any idea how to fix this?
Just an update. Connected a Bluetooth keyboard and that worked fine and gave the same evtest output saying something else was grabbing the input which would mean that's not the problem with the Amazon remote.
Again, any help is welcomed!
This has been bugging me for the last day or two as well; and to be honest - still is.
The below will work but just seems "wrong" to have to use eventlircd for this...
/storage/.config/eventlircd.d/aftvsremote.evmap
(copy /etc/eventlircd.d to /storage/.config/eventlircd.d)
Code:
KEY_KPENTER = KEY_OK
KEY_UP = KEY_UP
KEY_LEFT = KEY_LEFT
KEY_RIGHT = KEY_RIGHT
KEY_DOWN = KEY_DOWN
KEY_MENU = KEY_EPG
KEY_BACK = KEY_EXIT
KEY_PLAYPAUSE = KEY_PLAY
KEY_REWIND = KEY_REWIND
KEY_HOMEPAGE = KEY_MEDIA
KEY_FASTFORWARD = KEY_FASTFORWARD
/storage/.config/autostart.sh
Bind mount because I'm too lazy to rebuild the openelec squashfs image
Code:
mount --bind /storage/.config/eventlircd.d/ /etc/eventlircd.d/
/storage/.config/udev.rules.d/99-eventlircd.rules
Code:
SUBSYSTEMS=="bluetooth", GOTO="begin-bluetooth"
GOTO="end-bluetooth"
LABEL="begin-bluetooth"
ATTRS{name}=="Amazon Fire TV Remote", \
ENV{eventlircd_enable}="true", \
ENV{eventlircd_evmap}="aftvsremote.evmap"
LABEL="end-bluetooth"
Thank you so much!!! I got a chance to enter the code today and it works perfectly! I had to repair after the initial reboot but it keeps pairing after that for all other reboots. I hope they put this into openelec from here on out.
Again thanks!

[Q] Adding custom text to retrived data from database

Hi,
im a beginner i have small problem i have small application build where i can add stuff to the database and read it thats working fine for me but now for example i want to be it like example the output from the database is test test but i want it like Name : test Adress : test how can i fix this.
Thank you
Splitting Text
Not sure if I've understood correctly, but are you getting a String back from the database like this: "test test"?
If so you can use the String split() command to break your String into segments. For example:
Code:
String returned = //Get String from the database
String[] split = returned.split(" ");
String name = "Name: " + split[0]; //This contains your first word
String address = "Address: " + split[1]; //This contains your second word
How are you connecting to your database? Depending on how you connect, it is possible to return just a name, or just an address, rather than all columns in a row.
For example, using HQL (Hibernate Query Language) you could write something like:
Code:
SELECT address FROM person p WHERE p.name = "Harry"
This would return all the addresses of people called Harry from the table person

[GUIDE][Difficulty: Advanced] Send an SMS with Address, Speed, and URL for a Map Pin

Your phone is lost, or you've got a relative who you're okay with sharing your location to. If you're driving, it's hard to give them an exact location, but thanks to the power of Tasker and a Javascriptlet, you can do that and more. With this task, you'll be able to automatically send an SMS with the current Address, current Speed that the phone is traveling, and a URL that drops a pin on the phone's location in Google Maps. Very helpful for easily finding a location! I would like to thank Redditor /u/popillol for figuring out the proper Javascriptlet to parse the Google Maps Geocoding API results.
Prerequisites
Secure Settings plugin if you are rooted and want to be able to automatically toggle location mode
Create a new Profile and select the Event context. Go to Phone and select Received Text. For the Type, leave it at Any and the Sender field blank. However for the Content field, choose a trigger phrase that you will share with your trusted relatives. This trigger phrase should be unique enough that there is no way it will trigger based off of any random text message.
Create a Task and name it 'Get Location.'
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Now, for the task itself. Be warned that this involves some Javascript, so be sure you copy/paste the functions in properly otherwise it might not work.
Variables --> Variable Set. Set Name to %from and To to %SMSRF. This gets the phone number that the text was sent from and puts it into a variable called %from.
(If Rooted) Plugin --> Secure Settings. Choose Location Mode/High Accuracy under System+ Actions.
Location --> Get Location. Set the source as Any.
Net --> HTTP Get. Under Serverort, put in the following URL to access the Google Maps Geocoding API:
Code:
maps.google.com/maps/api/geocode/json?latlng=%LOC&sensor=false
Set Mime Type as text/xml
Code --> Javascriptlet. For the code, add the following:
Code:
var locj = JSON.parse(global("%HTTPD"));
var spd = Number(global("%LOCSPD"))*2.23693629;
var lat = global("%LOC").split(",");
var lon = Math.abs(lat[1]);
lat = lat[0];
var latd = Math.floor(lat);
var latm = ( lat - latd )*60;
var lats = ( latm - Math.floor(latm) )*60;
latm = Math.floor(latm);
var lond = Math.floor(lon);
var lonm = ( lon - lond )*60;
var lons = ( lonm - Math.floor(lonm) )*60;
lonm = Math.floor(lonm);
lat = latd+"\°"+latm+"\'"+lats.toFixed(1)+"%22N";
lon = lond+"\°"+lonm+"\'"+lons.toFixed(1)+"%22W";
var url = "https://www.google.com/maps/place/"+lat+"+"+lon+"/@"+global("%LOC")+",14z";
if ( locj.results.length > 0 )
{
var short = locj.results[0].address_components[0].short_name;
if ( short.search(/[^\d-]/) == -1 )
short = "";
else
short = "("+short+") ";
var add = locj.results[0].formatted_address;
add = short+add.replace(", USA","");
}
Phone --> Send SMS. For the Number, put in %from. For the Message, put in the following:
Code:
%add
Speed ~ %spd mph
URL: %url
That's it! As mentioned in the Reddit thread for this, you can use AutoInput to automate turning on/off location services if you aren't rooted, but it's a bit of a messy implementation so I recommend just leaving location services on.
Maybe publish the script that can be downloaded and inserted from tasker. Thanks.
vizdak said:
Maybe publish the script that can be downloaded and inserted from tasker. Thanks.
Click to expand...
Click to collapse
I've attached the script in the post. Enjoy!
MishaalRahman said:
I've attached the script in the post. Enjoy!
Click to expand...
Click to collapse
Dropped pin is not accurate, its showing all blue area. Whats the problem?
Hi,
Just bought tasker and setted this up, seems like the url query is not working, any tips?
Also, putting that url in chrome gives me the following:
Code:
{
"results" : [],
"status" : "ZERO_RESULTS"
}
Regards.
MishaalRahman said:
Your phone is lost, or you've got a relative who you're okay with sharing your location to. If you're driving, it's hard to give them an exact location, but thanks to the power of Tasker and a Javascriptlet, you can do that and more. With this task, you'll be able to automatically send an SMS with the current Address, current Speed that the phone is traveling, and a URL that drops a pin on the phone's location in Google Maps. Very helpful for easily finding a location! I would like to thank Redditor /u/popillol for figuring out the proper Javascriptlet to parse the Google Maps Geocoding API results.
Prerequisites
Secure Settings plugin if you are rooted and want to be able to automatically toggle location mode
Create a new Profile and select the Event context. Go to Phone and select Received Text. For the Type, leave it at Any and the Sender field blank. However for the Content field, choose a trigger phrase that you will share with your trusted relatives. This trigger phrase should be unique enough that there is no way it will trigger based off of any random text message.
Create a Task and name it 'Get Location.'
Now, for the task itself. Be warned that this involves some Javascript, so be sure you copy/paste the functions in properly otherwise it might not work.
Variables --> Variable Set. Set Name to %from and To to %SMSRF. This gets the phone number that the text was sent from and puts it into a variable called %from.
(If Rooted) Plugin --> Secure Settings. Choose Location Mode/High Accuracy under System+ Actions.
Location --> Get Location. Set the source as Any.
Net --> HTTP Get. Under Serverort, put in the following URL to access the Google Maps Geocoding API:
Code:
maps.google.com/maps/api/geocode/json?latlng=%LOC&sensor=false
Set Mime Type as text/xml
Code --> Javascriptlet. For the code, add the following:
Code:
var locj = JSON.parse(global("%HTTPD"));
var spd = Number(global("%LOCSPD"))*2.23693629;
var lat = global("%LOC").split(",");
var lon = Math.abs(lat[1]);
lat = lat[0];
var latd = Math.floor(lat);
var latm = ( lat - latd )*60;
var lats = ( latm - Math.floor(latm) )*60;
latm = Math.floor(latm);
var lond = Math.floor(lon);
var lonm = ( lon - lond )*60;
var lons = ( lonm - Math.floor(lonm) )*60;
lonm = Math.floor(lonm);
lat = latd+"\°"+latm+"\'"+lats.toFixed(1)+"%22N";
lon = lond+"\°"+lonm+"\'"+lons.toFixed(1)+"%22W";
var url = "https://www.google.com/maps/place/"+lat+"+"+lon+"/@"+global("%LOC")+",14z";
if ( locj.results.length > 0 )
{
var short = locj.results[0].address_components[0].short_name;
if ( short.search(/[^\d-]/) == -1 )
short = "";
else
short = "("+short+") ";
var add = locj.results[0].formatted_address;
add = short+add.replace(", USA","");
}
Phone --> Send SMS. For the Number, put in %from. For the Message, put in the following:
Code:
%add
Speed ~ %spd mph
URL: %url
That's it! As mentioned in the Reddit thread for this, you can use AutoInput to automate turning on/off location services if you aren't rooted, but it's a bit of a messy implementation so I recommend just leaving location services on.
Click to expand...
Click to collapse
The part where you used +"%22N" and +"%22W" wouldn't it only make it work in the northern part of America?
Tried it out, and by my location I should be in Denmark, but the URL leads me to be somewhere in the Atlantic Ocean.
If I delete the two parts or simply change the W to an E, it works... But isn't it possible to make Google determine if it should be N/S and W/E? I mean, it can be fixed with an If(), but isn't there a way to make the api do that? But that's a cool script! I've been looking for ages for a function that could do the speed without root - you helped me out, thanks!
mnhs1010 said:
Dropped pin is not accurate, its showing all blue area. Whats the problem?
Click to expand...
Click to collapse
Sometimes, the URL that gets sent in the SMS doesn't format properly (there's nothing you can do about that except maybe use a URL shortener service) so you'll have to make sure you copy/paste the ENTIRE URL that gets sent rather than just clicking on what it gives you.
Cryorus said:
Hi,
Just bought tasker and setted this up, seems like the url query is not working, any tips?
Also, putting that url in chrome gives me the following:
Code:
{
"results" : [],
"status" : "ZERO_RESULTS"
}
Regards.
Click to expand...
Click to collapse
Hi, it's perhaps failing because your phone failed to get a location lock, meaning %LOC is not being set. If %LOC is not set, then the URL query will not work as Google Maps is expecting GPS coordinates being passed to it. As for why it doesn't work when you open the URL in Chrome, same reason.
One thing you can do is add an Alert --> Flash command and Flash %LOC right after the "Get Location" action. If you don't see GPS coordinates pop up then it means Tasker timed out on getting a location on you.
patrickpetersen said:
The part where you used +"%22N" and +"%22W" wouldn't it only make it work in the northern part of America?
Tried it out, and by my location I should be in Denmark, but the URL leads me to be somewhere in the Atlantic Ocean.
If I delete the two parts or simply change the W to an E, it works... But isn't it possible to make Google determine if it should be N/S and W/E? I mean, it can be fixed with an If(), but isn't there a way to make the api do that? But that's a cool script! I've been looking for ages for a function that could do the speed without root - you helped me out, thanks!
Click to expand...
Click to collapse
You are correct. To make the Javascriptlet work globally, you would need to do the following (this is from the Redditor that came up with the Javascript):
This assumes you're using North latitude numbers and West longitude numbers (so North America). If you want to use it globally, this would be the way to do it:
In the javascriptlet, check the sign (+ or -) of lon before getting the absolute value, and assign a new variable string with either W or E based on the sign. Do the same thing with lat (after the lat=lat[0] line) and with N or S. Then near the bottom where it puts the degrees, minutes, and seconds together, use that string variable after the "%22". I haven't tested it but that should work.
Click to expand...
Click to collapse
MishaalRahman said:
Sometimes, the URL that gets sent in the SMS doesn't format properly (there's nothing you can do about that except maybe use a URL shortener service) so you'll have to make sure you copy/paste the ENTIRE URL that gets sent rather than just clicking on what it gives you.
Hi, it's perhaps failing because your phone failed to get a location lock, meaning %LOC is not being set. If %LOC is not set, then the URL query will not work as Google Maps is expecting GPS coordinates being passed to it. As for why it doesn't work when you open the URL in Chrome, same reason.
One thing you can do is add an Alert --> Flash command and Flash %LOC right after the "Get Location" action. If you don't see GPS coordinates pop up then it means Tasker timed out on getting a location on you.
Click to expand...
Click to collapse
Thanks for the tip, it seems that step 3. Get Location takes a while (around a minute or more) to complete, after that, Flashing %LOC doesn't return anything.
Edit: Working now, I turned options for GPS to use Wifi and Bluethooth and it worked, but the link isn't sent completly, the hyperlink breaks at the first comma. Example: www.url.com/22w22s1234,etc.
Edit 2: Just read that there is nothing to do about it... gona find a way around.
Edit 3: Found a way around using the bitly API, the problem now is even if I change the location N to S (I'm in South America) it doesn't pin anything. (It doesnt even with N)
MishaalRahman said:
You are correct. To make the Javascriptlet work globally, you would need to do the following (this is from the Redditor that came up with the Javascript):
Click to expand...
Click to collapse
Can someone edit the script and provide me for global? I am in Pakistan and its not showing accurate drop pin.
This is the link it is giving me: https://www.google.com/maps/place/-34°32'48.6"S+70°37'12.2"W/@-33.4531551,-70.6200612,14z
No marker and the address is not accurate.
Edit: Address was not accurate because of where I was (office) went outside and it worked perfectly, still there is no pointer in the map.
MishaalRahman said:
Your phone is lost, or you've got a relative who you're okay with sharing your location to. If you're driving, it's hard to give them an exact location, but thanks to the power of Tasker and a Javascriptlet, you can do that and more. With this task, you'll be able to automatically send an SMS with the current Address, current Speed that the phone is traveling, and a URL that drops a pin on the phone's location in Google Maps. Very helpful for easily finding a location! I would like to thank Redditor /u/popillol for figuring out the proper Javascriptlet to parse the Google Maps Geocoding API results.
Prerequisites
Secure Settings plugin if you are rooted and want to be able to automatically toggle location mode
Create a new Profile and select the Event context. Go to Phone and select Received Text. For the Type, leave it at Any and the Sender field blank. However for the Content field, choose a trigger phrase that you will share with your trusted relatives. This trigger phrase should be unique enough that there is no way it will trigger based off of any random text message.
Create a Task and name it 'Get Location.'
Now, for the task itself. Be warned that this involves some Javascript, so be sure you copy/paste the functions in properly otherwise it might not work.
Variables --> Variable Set. Set Name to %from and To to %SMSRF. This gets the phone number that the text was sent from and puts it into a variable called %from.
(If Rooted) Plugin --> Secure Settings. Choose Location Mode/High Accuracy under System+ Actions.
Location --> Get Location. Set the source as Any.
Net --> HTTP Get. Under Serverort, put in the following URL to access the Google Maps Geocoding API:
Code:
maps.google.com/maps/api/geocode/json?latlng=%LOC&sensor=false
Set Mime Type as text/xml
Code --> Javascriptlet. For the code, add the following:
Code:
var locj = JSON.parse(global("%HTTPD"));
var spd = Number(global("%LOCSPD"))*2.23693629;
var lat = global("%LOC").split(",");
var lon = Math.abs(lat[1]);
lat = lat[0];
var latd = Math.floor(lat);
var latm = ( lat - latd )*60;
var lats = ( latm - Math.floor(latm) )*60;
latm = Math.floor(latm);
var lond = Math.floor(lon);
var lonm = ( lon - lond )*60;
var lons = ( lonm - Math.floor(lonm) )*60;
lonm = Math.floor(lonm);
lat = latd+"\°"+latm+"\'"+lats.toFixed(1)+"%22N";
lon = lond+"\°"+lonm+"\'"+lons.toFixed(1)+"%22W";
var url = "https://www.google.com/maps/place/"+lat+"+"+lon+"/@"+global("%LOC")+",14z";
if ( locj.results.length > 0 )
{
var short = locj.results[0].address_components[0].short_name;
if ( short.search(/[^\d-]/) == -1 )
short = "";
else
short = "("+short+") ";
var add = locj.results[0].formatted_address;
add = short+add.replace(", USA","");
}
Phone --> Send SMS. For the Number, put in %from. For the Message, put in the following:
Code:
%add
Speed ~ %spd mph
URL: %url
That's it! As mentioned in the Reddit thread for this, you can use AutoInput to automate turning on/off location services if you aren't rooted, but it's a bit of a messy implementation so I recommend just leaving location services on.
Click to expand...
Click to collapse
mnhs1010 said:
Can someone edit the script and provide me for global? I am in Pakistan and its not showing accurate drop pin.
Click to expand...
Click to collapse
Try to follow the instructions from the redditor or manually switch the 22N to 22S and 22W to 22E
patrickpetersen said:
Try to follow the instructions from the redditor or manually switch the 22N to 22S and 22W to 22E
Click to expand...
Click to collapse
its working fine 3 days but now it is sending the last same location always not new location.
Cryorus said:
Thanks for the tip, it seems that step 3. Get Location takes a while (around a minute or more) to complete, after that, Flashing %LOC doesn't return anything.
Edit: Working now, I turned options for GPS to use Wifi and Bluethooth and it worked, but the link isn't sent completly, the hyperlink breaks at the first comma. Example: www.url.com/22w22s1234,etc.
Edit 2: Just read that there is nothing to do about it... gona find a way around.
Edit 3: Found a way around using the bitly API, the problem now is even if I change the location N to S (I'm in South America) it doesn't pin anything. (It doesnt even with N)
Click to expand...
Click to collapse
I'm having this problem as well, the "Get Location" times out no matter how high I set the time out value to be. I've Turned on WiFi and Bluetooth scannaing to no avail. Whenever the task runs, I see the GPS icon show up in my status bar. And Google Maps has no problem getting my location quickly and accurately. I'm not sure what's going on
Ben Abel said:
I'm having this problem as well, the "Get Location" times out no matter how high I set the time out value to be. I've Turned on WiFi and Bluetooth scannaing to no avail. Whenever the task runs, I see the GPS icon show up in my status bar. And Google Maps has no problem getting my location quickly and accurately. I'm not sure what's going on
Click to expand...
Click to collapse
Did you test it outside? It takes a while to get my location here at my work, but outside it is super fast.
Cryorus said:
Did you test it outside? It takes a while to get my location here at my work, but outside it is super fast.
Click to expand...
Click to collapse
I just did, and it worked!
I don't know how Google Maps can get a lock on my so easily while I'm inside, but Tasker struggles, haha. Perhaps Google Services it's using Google Service's last known location of me.
It's simpler to use GeoTask in order to get the address and location.
Big Brother now works for me. Thanks, MishaalRahman.
One thing to point out for paranoid/right peoplle, it is possible to make an email-to-SMS gateway trigger it, although it does require setting up a new Context.
For those who do not know, a SMS gateway is when you send an email to a carrier's portal, and they pass the message along as an SMS. It also works backwards, sending an SMS back will send the reply to the sending email address. Wikipedia has a list of U.S. ones. For those outside the U.S., some research will be required, so go practice your Google-fu.
One thing to check for is the message may be wrapped in transit with things like the sender's name, subject line, etc. Test it out thoroughly, as the Context's contents must match the SMS exactly in order to trigger the Task. I recommend sending the message and simply copy/pasting what it spits out as the new Context's contents.
Last caveat, check to make sure that the message actually comes through the email reply, AT&T's SMS-to-email parser breaks on the degree symbol (Unicode B0 ALT+0176 °), so some editing may be required on the receiving end prior to presenting the URL to Gmaps. Once again, test thoroughly.
I don't know why, but I'm not able to import your projects into my tasker @MishaalRahman. Is there any way to export them in another format? Could you upload that? Is anyone else having this issue?
Would be awesome!
Cheers
I love the whole idea. It's great! Can you please write the Java scriptlet for me that works anywhere in the world? Requesting because I do not know coding at all.

Trying to save a hex stream string as separate numerical values

Hi,
I am designing a BLE scanner that is required to receive and display the advertised packets of data (as well as other functions). So far this has been successful and the hex stream is being displayed using the following function:
// Device scan callback.
private ScanCallback leScanCallback = new ScanCallback() {
@override
public void onScanResult(int callbackType, ScanResult result) {
// gets data from the BLE scan for broadcasting packets
ScanRecord Scanned = result.getScanRecord();
String address = btAdapter.getAddress();
//Gets advertised packets in a byte array
byte[] packetData = Scanned.getBytes();
//conversion to a hex stream from the byte array
for (byte hex : packetData) {
x.append(String.format("%02X", hex));
}
However, i have been asked to represent the hex stream as separate numerical values for each byte using ASCI! I attempted this with just the byte array, but the outcome of the byte array was not the 62 bit hex stream I was expecting. but instead 8 random symbols.
I have also tried the parseint() function in many different ways. Each of which compiles successfully, But proceeds to crash my app when i try to start a scan!
Any help on how best to achieve my requirements would be much appreciated.

Categories

Resources