[Q] Change wifi regulatory domain for HTC Desire HD - Desire HD Q&A, Help & Troubleshooting

Hi all
My CM htc magic wifi regulatory domain allows selection of channels > 11, which is handy as the quietest for obvious reasons.
My wife's HTC Desire HD has no such menu, and I'd like to enable the additional channels so I can leave the router on the channel it had.
I have tried editing the '/system/build.prop' file so the line 'ro.wifi.channels=' changes to 'ro.wifi.channels=14'. After full reboot channel 14 isn't enabled.
Is there a way to enable the menu in wifi advanced settings?
I've done a lengthy google-search and there's plenty of people asking for other phones but no solutions that I can see. including this one>
http://forum.xda-developers.com/showthread.php?t=714136
but HTC Desire HD doesn't have /data/misc/wifi/reg_code
Update: found this in CM adv wireless settings, do you think same exists in Sense?
https://github.com/CyanogenMod/andr...m/android/settings/wifi/AdvancedSettings.java
DEBUGGABLE = SystemProperties.getInt("ro.debuggable", 0);
/**
* Remove user control of regulatory domain
* channel count settings in non userdebug builds
*/
if (DEBUGGABLE == 1) {
/*
* Fix the Run-time IllegalStateException that ListPreference requires an entries
* array and an entryValues array, this exception occurs when user open/close the
* slider in the Regulatory domain dialog.
*/
initNumChannelsPreference();
} else {
Preference chanPref = findPreference(KEY_NUM_CHANNELS);
if (chanPref != null) {
getPreferenceScreen().removePreference(chanPref);
}
}
Click to expand...
Click to collapse
Ideas?
Thanks

Related

[SDK] XFControls - Advanced UI SDK [UPDATED w/ Sense UI Example!]

This is an Advanced UI SDK for developing finger-friendly Application UIs.
The reason for developing this SDK was mainly to learn about programming for Windows Mobile and the Compact Framework 3.5. I also developed this SDK because I could not find good UI controls that gave total display control to the programmer while taking care of all of the Physics, windowing, and frame buffering AND was open source.
Finally, this SDK was originally developed as part of the XDAFacebook application that I am currently developing.
I am releasing this SDK and its source so that people can have a good foundation to build finger-friendly Windows Mobile applications, and so that programmers starting off in the Windows Mobile world won't have to start from scratch when creating useful UI Controls.
Here are some of the features and uses of this SDK.
Features:
Fully customizable
Easily create custom UI Controls
Resolution independent
Full physics for rendering smooth scrolling
Uses:
Quickly create UI controls
Develop full UI SDKs
Learn basic UI programming for .net CF 3.5
I ask that if you use these controls, please provide feedback so that everyone can benefit!
Thank you and I hope you find these controls useful!
SDK Documentation
Even though the controls are easy to implement, they can seem intimidating at first. Here is an over-view of the core pieces to the SDK:
The IXFItem Interface:
Here are Properties of the interface
PHP:
XFPanelBase Parent { get; set; } // The item's List container
XFItemState State { get; set; } /* An Enum to describe the current item's state
This could include things like [B]Selected[/B] or [B]Normal[/B]*/
Bitmap Buffer { get; set; } // This is the item's cache buffer. Allows for speedy rendering
XFItemStyle Style { get; set; } // CSS like style object. Allows for easy customization
XFItemType ItemType { get; set; } /* Enum to label the type of the current object.
For example, [B]Clickable[/B] or [B]Display[/B] meaning the item won't change*/
The following are the methods that need to be implemented
PHP:
int GetHeight(); /* This returns the height of the item. This value is usually calulated
but in some instances is static. The value should be cached because this method
is called several times during the rendering process.*/
void ResetHeight(); // What ever needs to be done to reset the height cache
void ItemPaint(Graphics g, int x, int y); // Where the magic happens. More on this later
XFItemClickResult GetClickResult(); // An enum is return with what the action of clicking this item was.
The main part of the interface is the ItemPaint method. This method is called from the XFPanelList and passes a Graphics object created from the Buffer Bitmap of the Item. In this method, you do all of your graphics logic, drawing it with the supplied graphics object. The x and y are any offset numbers that should influence when the objects are based. Most of the time, these numbers will be 0, 0.
Because the programmer has total control over how the item is rendered, special care must be used when creating the items, to draw all the features with respect to the XFItemStyle object. This object usually is created in CTOR. An example of the XFItemStyle object being created in one of the SenseUI XFItem's CTORs:
PHP:
public SenseItem()
{
ItemType = XFItemType.Clickable;
Style = new XFItemStyle()
{
BoarderBottomColor = Color.FromArgb(189, 182, 189),
DashStyleBottom = System.Drawing.Drawing2D.DashStyle.Dash,
TextColor = Color.Black,
TextFont = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Regular),
SelectedTextFont = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Regular),
SecondaryTextFont = new Font(FontFamily.GenericSansSerif, 7, FontStyle.Regular),
SelectedSecondaryTextFont = new Font(FontFamily.GenericSansSerif, 7, FontStyle.Regular),
SecondaryTextColor = Color.FromArgb(57, 52, 57),
SelectedTextColor = Color.White,
SelectedBackgroundColor = Color.FromArgb(43, 36, 43),
SelectedSecondaryTextColor = Color.FromArgb(182, 178, 182),
Padding = 11,
PaddingBottom = 12,
PaddingLeft = 10,
PaddingRight = 16
};
}
You will also notice that the ItemType is also set here.
How you use the Style is a little more involved. In the ItemPaint, the programmer should base all of the features off of what is in the Style object. Here is an example of how the above Style object was used in the ItemPaint method:
PHP:
public void ItemPaint(Graphics g, int x, int y)
{
int width = Parent == null ? Screen.PrimaryScreen.WorkingArea.Width : Parent.Width;
XFControlUtils.DrawBoarders(Style, g, 0, 0, width, GetHeight());
int currX = Style.PaddingLeft;
int currY = Style.PaddingTop;
int mHeight = 0;
int sHeight = 0;
if (Icon != null)
currX += _iconSize + Style.PaddingLeft;
SizeF mText = new SizeF();
if (!string.IsNullOrEmpty(MainText))
{
mText = XFControlUtils.GetEllipsisStringMeasure(width - currX - Style.PaddingRight, MainText, Style.TextFont);
MainText = XFControlUtils.EllipsisWord(width - currX - Style.PaddingRight, MainText, Style.TextFont);
}
SizeF sText = new SizeF();
if (!string.IsNullOrEmpty(SecondaryText))
{
sText = XFControlUtils.GetEllipsisStringMeasure(width - currX - Style.PaddingRight, SecondaryText, Style.SecondaryTextFont);
SecondaryText = XFControlUtils.EllipsisWord(width - currX - Style.PaddingRight, SecondaryText, Style.SecondaryTextFont);
}
mHeight = (GetHeight() / 2) - ((int)mText.Height / 2);
if (!string.IsNullOrEmpty(SecondaryText))
{
mHeight = (GetHeight() / 2) - _textSpace - (int)mText.Height;
sHeight = (GetHeight() / 2) + _textSpace;
}
if (State == XFItemState.Selected)
{
XFControlUtils.DrawBackgroundSelected(Style, g, x, y, width, GetHeight());
if (!string.IsNullOrEmpty(MainText))
using (SolidBrush b = new SolidBrush(Style.SelectedTextColor))
g.DrawString(MainText, Style.SelectedTextFont, b, currX, mHeight);
if (!string.IsNullOrEmpty(SecondaryText))
using (SolidBrush b = new SolidBrush(Style.SelectedSecondaryTextColor))
g.DrawString(SecondaryText, Style.SelectedSecondaryTextFont, b, currX, sHeight);
}
else
{
if (!string.IsNullOrEmpty(MainText))
using (SolidBrush b = new SolidBrush(Style.TextColor))
g.DrawString(MainText, Style.TextFont, b, currX, mHeight);
if (!string.IsNullOrEmpty(SecondaryText))
using (SolidBrush b = new SolidBrush(Style.SecondaryTextColor))
g.DrawString(SecondaryText, Style.SecondaryTextFont, b, currX, sHeight);
}
if (Icon != null)
XFControlUtils.DrawAlphaFirstPix(g, Icon, Style.PaddingLeft, Style.PaddingTop);
}
That is as complex as it gets. Other than doing normal Event Handling for ClickReturns, this is all that is required to create beautiful UI Controls for your application.
I hope that this helps! Feel free to PM me or post a reply if you need further clarification.
Class List
Form Controls:
XFPanelContainer - The main control that interacts with the Form.
XFPanels:
XFPanelBase - Basic building block. Handles most of the generic functionality
XFPanelList - Can add IXFItem items.
XFPanelHeader - The top header bar for an XFPanelContainer
XFItems
IXFItem - Interface that all XFItems inherate
XFItemSimpleText - Simple item that displays text
XFItemBack - Special item that allows a panel to slide back
XFItemLoading - Item that allows for work to be down in the background.
XFControlUtils: Library of static, useful utilities for this SDK
DrawAlpha - Draws an image with a supplied Graphics object with a specific level of opacity
DrawAlphaFirstPix - Draws an image and renders all pixels that are the same color as pixel (1,1) are 100% transparent
DrawJustifiedString - draws a justified string
GetEllipsisStringMeasure - Takes a string and if it is more than the supplied width, clips the string and adds a trailing "..." at the end
EllipsisWord - same as the GetEllipsisStringMeasure, except it ellipsis at the words and not at the char level.
GetSizedString - Takes a string and adds "\n" so that the string wraps according to the supplied width
Many Others!
Sense UI Example
Here is a working example. I made this Sense UI example in about 3 hours 15 hours. It isn't complete but gives a good example of how to/why use this SDK. There are 3 screenshots of what this demo looks like.
I'll explain some of the pieces of code when I get some time later today.
The other great example of how to use this SDK is the XFAFacebook Application.
The source for this project is located @ http://code.google.com/p/xda-winmo-facebook/source/browse/#svn/trunk/XFSenseUI
There are a few screenshots of the XDAFacebook application included.
Finally, a quick start tutorial.
Start a new Smart Device project.
Add a reference to the XFControls.dll
Place the following lines of code in the Form1 constructor (after the InitializeComponent()
Code:
XFPanelContainer container = new XFPanelContainer();
container.Dock = DockStyle.Fill;
Controls.Add(container);
XFPanelList list = new XFPanelList();
container.SetMainPanel(list);
list.ShowScrollbar(true);
for (int i = 0; i < 50; i++)
{
list.Add("This is item " + i);
}
Run the project and you will get an output like the "SimpleText.png"
It's that easy!
UPDATE: I've added the XFSense to the Google Code page and have made some pretty extensive updates to it. I've added a few controls including sliders, toggles, checkboxes and radio buttons. It still isn't complete but I will be working to make it a full fledge Sense SDK.
Stay tuned!
Releases:
Initial Release - 9/1/10
When major updates occur, the DLLs will be posted here. The best thing to do is pull the source from the Google Code page and use that.
This will guarantee the freshes code will be used for your projects
Instructions:
Download and unzip the latest XFControls.zip from below.
Add the .dll as a reference.
Program!
The source can be found at: http://code.google.com/p/xda-winmo-facebook/source/browse/#svn/trunk/XDAFacebook/XFControls
List of downloads:
10/6/10 - Updated for speed and better scrolling! - XFControls 0.2.zip
9/1/10 - Initial upload - XFControls 0.1.zip
Other things I might have missed
Reserved Other
Sounds interesting! Definitely looking forward to some screenshots.
kliptik said:
Sounds interesting! Definitely looking forward to some screenshots.
Click to expand...
Click to collapse
Screenshots are up!
Only 3 downloads?! Hmmm.... I figured more people would be interested in a finger-friendly and open source UI SDK...
Is there something wrong with my posts? Are they too confusing?
Let me know what I can do to help! This has taken me a good deal of time to write and I would hope that it would be of use to someone else...
joe_coolish said:
Only 3 downloads?! Hmmm.... I figured more people would be interested in a finger-friendly and open source UI SDK...
Is there something wrong with my posts? Are they too confusing?
Let me know what I can do to help! This has taken me a good deal of time to write and I would hope that it would be of use to someone else...
Click to expand...
Click to collapse
Just DL'd a copy. I'm super swamped at the moment trying to get the next release of KD-Font out, but I'll try and check this out when I get a chance.
Thank you for your contribution!
I will definitely give this a test run at some point. Good work!
you have to add you own graphics to this sdk?
janneman22 said:
you have to add you own graphics to this sdk?
Click to expand...
Click to collapse
yes, this is a UI SDK. it is used to create user controls. The core code handles all the caching and physics, but the programmer must create the actual controls. including the graphics. look at the sense UI example to see how you can implement your own custom UI controls. like i said in the post, it only took about 3 hours to create those controls. most of which was spent creating graphics.
joe_coolish said:
yes, this is a UI SDK. it is used to create user controls. The core code handles all the caching and physics, but the programmer must create the actual controls. including the graphics. look at the sense UI example to see how you can implement your own custom UI controls. like i said in the post, it only took about 3 hours to create those controls. most of which was spent creating graphics.
Click to expand...
Click to collapse
oh right. but does it place controls in the toolbox, or have you to create the controls hard coded?
i could help you to make some grapics packages for this sdk
Ok, I've updated the binaries to be the latest and greatest. The scrolling is super smooth and things are starting to look pretty good!
I also will be updating the XFSense and I'll probably be extending it a little more because I plan on bringing it into the XDA Facebook app.
As always, let me know what you think!
EDIT: Oh, and to answer the question about adding objects to the toolbox, I have not added the OCX files (or whatever they are) so that they can be added to the tool box. But, after you've added the container and the panels, everything is logic after that, so adding the items to the toolbox really doesn't benefit too much.
As far as graphics, I would love help with graphics! Send me a PM and we'll talk!
joe_coolish said:
Here is a working example. I made this Sense UI example in about 3 hours. It isn't complete but gives a good example of how to/why use this SDK. There are 3 screenshots of what this demo looks like.
I'll explain some of the pieces of code when I get some time later today.
The other great example of how to use this SDK is the XFAFacebook Application.
The source for this project is located @ http://code.google.com/p/xda-winmo-facebook/source/browse/
There are a few screenshots of the XDAFacebook application included.
Finally, a quick start tutorial.
Start a new Smart Device project.
Add a reference to the XFControls.dll
Place the following lines of code in the Form1 constructor (after the InitializeComponent()
Code:
XFPanelContainer container = new XFPanelContainer();
container.Dock = DockStyle.Fill;
Controls.Add(container);
XFPanelList list = new XFPanelList();
container.SetMainPanel(list);
list.ShowScrollbar(true);
for (int i = 0; i < 50; i++)
{
list.Add("This is item " + i);
}
Run the project and you will get an output like the "SimpleText.png"
It's that easy!
Click to expand...
Click to collapse
Very nice control. I downloaded the sample (had problem with missing XFControl project but downloaded it from code.google).
Have a couple questions, how would i go about adding image to a child panel?
What I'm trying to so is have about 75 items on the main screen and each item will have sub-panel, when clicking on sub-panel I need to have label x2 and image.
Also when compiling the project I get error:
"Error 1 'XFControls.XFPanels.XFPanelHeader' does not contain a definition for 'BackgroundImage' and no extension method 'BackgroundImage' accepting a first argument of type 'XFControls.XFPanels.XFPanelHeader' could be found (are you missing a using directive or an assembly reference?) C:\downloads\C#\XFSenseUI\XFSenseUIDemo\Form1.cs 39 24 XFSenseUIDemo"
Alright, I'll post an example if I get some time in a bit. But as for the error, it is because the Core XFControls has been modified since the last time I updated this thread. You can download the freshes code from the google code page or use the attached DLL. I'd suggest the Google Code page, since it gets updated more frequently. But then you get all the XDAFacebook with it, so it can also be negative.
Basically to add an image to an XFItem to be added to the XFPanelList, you can either create your own item by inheriting from the IXFItem and doing all the image manipulation in the ItemDraw() method.
For an example of how to do that, look at the XFItemImageDisplay item in the XFControls.XFPanels.XFPanelItems namespace.
If you need something specific, let me know and I'll see if I can whip up an example
I'm new to C# and the compact framework so sample would be good...
Thanks
JarekG said:
I'm new to C# and the compact framework so sample would be good...
Thanks
Click to expand...
Click to collapse
Ok, could you describe how you want the control to look? Also, what you want to supply to the constructor? IE a path for an image, upper text, lower text, maybe even some style things. ETC

[25.MAR.2011][All Kernel Devs] AGPS Script Development

Greets All,
I finally decided to post this here in the hopes to help myself and as well as everyone else, including the Dev's of kernels. As you all know the AGPS support for the HD2 doesnt work as it should, and even the support for it isnt there. Obviously being that these are ports, there is still things that need to be fixed, even in native android, but thats a different topic.
As some of you may know or not, I created scripts taking it one step further to have our GPS's lock faster then they have, for anyone that has no idea what I am talking about: Instantaneous GPS Fixation CWR v1.1 USA & INTERNATIONAL COMPLETED!
While doing this, I ran into a script, and I have tried talking to the kernel dev's many of them and other then 1 responding and confirming my finding, no one has responded, so at this point, here is what I found to help, do what you want with it.
There seems to be a script missing in part of the kernel, its suppose to be located in include/hardware called "gps.h" which is the support for the agps. I looked thru alot of gits, did alot of searches, and have not found any that have this script. The one kernel dev that looked thru his kernel also told me that this script didnt exist, but also said that a file called "gps.c" should go with it. Being that I am NOT a genius programmer, I am limited in what I can do. I am trying to learn, but there is no concise tutorial that is new to use as a guide, they are all outdated.
So this is what I found so far. I have more info if anyone is interested in fixing this or needs more help, but I'm sure no one needs it cause you are all far superior then I am in development. Here is the script thats missing in all the kernels for agps support:
Code:
00001 /*
00002 * Copyright (C) 2010 The Android Open Source Project
00003 *
00004 * Licensed under the Apache License, Version 2.0 (the "License");
00005 * you may not use this file except in compliance with the License.
00006 * You may obtain a copy of the License at
00007 *
00008 * http://www.apache.org/licenses/LICENSE-2.0
00009 *
00010 * Unless required by applicable law or agreed to in writing, software
00011 * distributed under the License is distributed on an "AS IS" BASIS,
00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 * See the License for the specific language governing permissions and
00014 * limitations under the License.
00015 */
00016
00017 #ifndef ANDROID_INCLUDE_HARDWARE_GPS_H
00018 #define ANDROID_INCLUDE_HARDWARE_GPS_H
00019
00020 #include <stdint.h>
00021 #include <sys/cdefs.h>
00022 #include <sys/types.h>
00023
00024 #include <hardware/hardware.h>
00025
00026 __BEGIN_DECLS
00027
00028 /**
00029 * The id of this module
00030 */
00031 #define GPS_HARDWARE_MODULE_ID "gps"
00032
00033
00034 /** Milliseconds since January 1, 1970 */
00035 typedef int64_t GpsUtcTime;
00036
00037 /** Maximum number of SVs for gps_sv_status_callback(). */
00038 #define GPS_MAX_SVS 32
00039
00040 /** Requested operational mode for GPS operation. */
00041 typedef uint32_t GpsPositionMode;
00042 // IMPORTANT: Note that the following values must match
00043 // constants in GpsLocationProvider.java.
00044 /** Mode for running GPS standalone (no assistance). */
00045 #define GPS_POSITION_MODE_STANDALONE 0
00046 /** AGPS MS-Based mode. */
00047 #define GPS_POSITION_MODE_MS_BASED 1
00048 /** AGPS MS-Assisted mode. */
00049 #define GPS_POSITION_MODE_MS_ASSISTED 2
00050
00051 /** Requested recurrence mode for GPS operation. */
00052 typedef uint32_t GpsPositionRecurrence;
00053 // IMPORTANT: Note that the following values must match
00054 // constants in GpsLocationProvider.java.
00055 /** Receive GPS fixes on a recurring basis at a specified period. */
00056 #define GPS_POSITION_RECURRENCE_PERIODIC 0
00057 /** Request a single shot GPS fix. */
00058 #define GPS_POSITION_RECURRENCE_SINGLE 1
00059
00060 /** GPS status event values. */
00061 typedef uint16_t GpsStatusValue;
00062 // IMPORTANT: Note that the following values must match
00063 // constants in GpsLocationProvider.java.
00064 /** GPS status unknown. */
00065 #define GPS_STATUS_NONE 0
00066 /** GPS has begun navigating. */
00067 #define GPS_STATUS_SESSION_BEGIN 1
00068 /** GPS has stopped navigating. */
00069 #define GPS_STATUS_SESSION_END 2
00070 /** GPS has powered on but is not navigating. */
00071 #define GPS_STATUS_ENGINE_ON 3
00072 /** GPS is powered off. */
00073 #define GPS_STATUS_ENGINE_OFF 4
00074
00075 /** Flags to indicate which values are valid in a GpsLocation. */
00076 typedef uint16_t GpsLocationFlags;
00077 // IMPORTANT: Note that the following values must match
00078 // constants in GpsLocationProvider.java.
00079 /** GpsLocation has valid latitude and longitude. */
00080 #define GPS_LOCATION_HAS_LAT_LONG 0x0001
00081 /** GpsLocation has valid altitude. */
00082 #define GPS_LOCATION_HAS_ALTITUDE 0x0002
00083 /** GpsLocation has valid speed. */
00084 #define GPS_LOCATION_HAS_SPEED 0x0004
00085 /** GpsLocation has valid bearing. */
00086 #define GPS_LOCATION_HAS_BEARING 0x0008
00087 /** GpsLocation has valid accuracy. */
00088 #define GPS_LOCATION_HAS_ACCURACY 0x0010
00089
00090 /** Flags for the gps_set_capabilities callback. */
00091
00092 /** GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode.
00093 If this is not set, then the framework will use 1000ms for min_interval
00094 and will start and call start() and stop() to schedule the GPS.
00095 */
00096 #define GPS_CAPABILITY_SCHEDULING 0x0000001
00097 /** GPS supports MS-Based AGPS mode */
00098 #define GPS_CAPABILITY_MSB 0x0000002
00099 /** GPS supports MS-Assisted AGPS mode */
00100 #define GPS_CAPABILITY_MSA 0x0000004
00101 /** GPS supports single-shot fixes */
00102 #define GPS_CAPABILITY_SINGLE_SHOT 0x0000008
00103
00104 /** Flags used to specify which aiding data to delete
00105 when calling delete_aiding_data(). */
00106 typedef uint16_t GpsAidingData;
00107 // IMPORTANT: Note that the following values must match
00108 // constants in GpsLocationProvider.java.
00109 #define GPS_DELETE_EPHEMERIS 0x0001
00110 #define GPS_DELETE_ALMANAC 0x0002
00111 #define GPS_DELETE_POSITION 0x0004
00112 #define GPS_DELETE_TIME 0x0008
00113 #define GPS_DELETE_IONO 0x0010
00114 #define GPS_DELETE_UTC 0x0020
00115 #define GPS_DELETE_HEALTH 0x0040
00116 #define GPS_DELETE_SVDIR 0x0080
00117 #define GPS_DELETE_SVSTEER 0x0100
00118 #define GPS_DELETE_SADATA 0x0200
00119 #define GPS_DELETE_RTI 0x0400
00120 #define GPS_DELETE_CELLDB_INFO 0x8000
00121 #define GPS_DELETE_ALL 0xFFFF
00122
00123 /** AGPS type */
00124 typedef uint16_t AGpsType;
00125 #define AGPS_TYPE_SUPL 1
00126 #define AGPS_TYPE_C2K 2
00127
00128 /**
00129 * String length constants
00130 */
00131 #define GPS_NI_SHORT_STRING_MAXLEN 256
00132 #define GPS_NI_LONG_STRING_MAXLEN 2048
00133
00134 /**
00135 * GpsNiType constants
00136 */
00137 typedef uint32_t GpsNiType;
00138 #define GPS_NI_TYPE_VOICE 1
00139 #define GPS_NI_TYPE_UMTS_SUPL 2
00140 #define GPS_NI_TYPE_UMTS_CTRL_PLANE 3
00141
00142 /**
00143 * GpsNiNotifyFlags constants
00144 */
00145 typedef uint32_t GpsNiNotifyFlags;
00146 /** NI requires notification */
00147 #define GPS_NI_NEED_NOTIFY 0x0001
00148 /** NI requires verification */
00149 #define GPS_NI_NEED_VERIFY 0x0002
00150 /** NI requires privacy override, no notification/minimal trace */
00151 #define GPS_NI_PRIVACY_OVERRIDE 0x0004
00152
00153 /**
00154 * GPS NI responses, used to define the response in
00155 * NI structures
00156 */
00157 typedef int GpsUserResponseType;
00158 #define GPS_NI_RESPONSE_ACCEPT 1
00159 #define GPS_NI_RESPONSE_DENY 2
00160 #define GPS_NI_RESPONSE_NORESP 3
00161
00162 /**
00163 * NI data encoding scheme
00164 */
00165 typedef int GpsNiEncodingType;
00166 #define GPS_ENC_NONE 0
00167 #define GPS_ENC_SUPL_GSM_DEFAULT 1
00168 #define GPS_ENC_SUPL_UTF8 2
00169 #define GPS_ENC_SUPL_UCS2 3
00170 #define GPS_ENC_UNKNOWN -1
00171
00172 /** AGPS status event values. */
00173 typedef uint16_t AGpsStatusValue;
00174 /** GPS requests data connection for AGPS. */
00175 #define GPS_REQUEST_AGPS_DATA_CONN 1
00176 /** GPS releases the AGPS data connection. */
00177 #define GPS_RELEASE_AGPS_DATA_CONN 2
00178 /** AGPS data connection initiated */
00179 #define GPS_AGPS_DATA_CONNECTED 3
00180 /** AGPS data connection completed */
00181 #define GPS_AGPS_DATA_CONN_DONE 4
00182 /** AGPS data connection failed */
00183 #define GPS_AGPS_DATA_CONN_FAILED 5
00184
00185 /**
00186 * Name for the GPS XTRA interface.
00187 */
00188 #define GPS_XTRA_INTERFACE "gps-xtra"
00189
00190 /**
00191 * Name for the GPS DEBUG interface.
00192 */
00193 #define GPS_DEBUG_INTERFACE "gps-debug"
00194
00195 /**
00196 * Name for the AGPS interface.
00197 */
00198 #define AGPS_INTERFACE "agps"
00199
00200 /**
00201 * Name for NI interface
00202 */
00203 #define GPS_NI_INTERFACE "gps-ni"
00204
00205 /** Represents a location. */
00206 typedef struct {
00207 /** set to sizeof(GpsLocation) */
00208 size_t size;
00209 /** Contains GpsLocationFlags bits. */
00210 uint16_t flags;
00211 /** Represents latitude in degrees. */
00212 double latitude;
00213 /** Represents longitude in degrees. */
00214 double longitude;
00215 /** Represents altitude in meters above the WGS 84 reference
00216 * ellipsoid. */
00217 double altitude;
00218 /** Represents speed in meters per second. */
00219 float speed;
00220 /** Represents heading in degrees. */
00221 float bearing;
00222 /** Represents expected accuracy in meters. */
00223 float accuracy;
00224 /** Timestamp for the location fix. */
00225 GpsUtcTime timestamp;
00226 } GpsLocation;
00227
00228 /** Represents the status. */
00229 typedef struct {
00230 /** set to sizeof(GpsStatus) */
00231 size_t size;
00232 GpsStatusValue status;
00233 } GpsStatus;
00234
00235 /** Represents SV information. */
00236 typedef struct {
00237 /** set to sizeof(GpsSvInfo) */
00238 size_t size;
00239 /** Pseudo-random number for the SV. */
00240 int prn;
00241 /** Signal to noise ratio. */
00242 float snr;
00243 /** Elevation of SV in degrees. */
00244 float elevation;
00245 /** Azimuth of SV in degrees. */
00246 float azimuth;
00247 } GpsSvInfo;
00248
00249 /** Represents SV status. */
00250 typedef struct {
00251 /** set to sizeof(GpsSvStatus) */
00252 size_t size;
00253
00254 /** Number of SVs currently visible. */
00255 int num_svs;
00256
00257 /** Contains an array of SV information. */
00258 GpsSvInfo sv_list[GPS_MAX_SVS];
00259
00260 /** Represents a bit mask indicating which SVs
00261 * have ephemeris data.
00262 */
00263 uint32_t ephemeris_mask;
00264
00265 /** Represents a bit mask indicating which SVs
00266 * have almanac data.
00267 */
00268 uint32_t almanac_mask;
00269
00270 /**
00271 * Represents a bit mask indicating which SVs
00272 * were used for computing the most recent position fix.
00273 */
00274 uint32_t used_in_fix_mask;
00275 } GpsSvStatus;
00276
00277 /** Callback with location information. */
00278 typedef void (* gps_location_callback)(GpsLocation* location);
00279
00280 /** Callback with status information. */
00281 typedef void (* gps_status_callback)(GpsStatus* status);
00282
00283 /** Callback with SV status information. */
00284 typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info);
00285
00286 /** Callback for reporting NMEA sentences. */
00287 typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length);
00288
00289 /** Callback to inform framework of the GPS engine's capabilities.
00290 capability parameter is a bit field of GPS_CAPABILITY_* flags */
00291 typedef void (* gps_set_capabilities)(uint32_t capabilities);
00292
00293 /** Callback utility for acquiring the GPS wakelock.
00294 This can be used to prevent the CPU from suspending while handling GPS events. */
00295 typedef void (* gps_acquire_wakelock)();
00296
00297 /** Callback utility for releasing the GPS wakelock. */
00298 typedef void (* gps_release_wakelock)();
00299
00300 /** GPS callback structure. */
00301 typedef struct {
00302 /** set to sizeof(GpsCallbacks) */
00303 size_t size;
00304 gps_location_callback location_cb;
00305 gps_status_callback status_cb;
00306 gps_sv_status_callback sv_status_cb;
00307 gps_nmea_callback nmea_cb;
00308 gps_set_capabilities set_capabilities_cb;
00309 gps_acquire_wakelock acquire_wakelock_cb;
00310 gps_release_wakelock release_wakelock_cb;
00311 } GpsCallbacks;
00312
00313
00314 /** Represents the standard GPS interface. */
00315 typedef struct {
00316 /** set to sizeof(GpsInterface) */
00317 size_t size;
00318 /**
00319 * Opens the interface and provides the callback routines
00320 * to the implemenation of this interface.
00321 */
00322 int (*init)( GpsCallbacks* callbacks );
00323
00324 /** Starts navigating. */
00325 int (*start)( void );
00326
00327 /** Stops navigating. */
00328 int (*stop)( void );
00329
00330 /** Closes the interface. */
00331 void (*cleanup)( void );
00332
00333 /** Injects the current time. */
00334 int (*inject_time)(GpsUtcTime time, int64_t timeReference,
00335 int uncertainty);
00336
00337 /** Injects current location from another location provider
00338 * (typically cell ID).
00339 * latitude and longitude are measured in degrees
00340 * expected accuracy is measured in meters
00341 */
00342 int (*inject_location)(double latitude, double longitude, float accuracy);
00343
00344 /**
00345 * Specifies that the next call to start will not use the
00346 * information defined in the flags. GPS_DELETE_ALL is passed for
00347 * a cold start.
00348 */
00349 void (*delete_aiding_data)(GpsAidingData flags);
00350
00351 /**
00352 * min_interval represents the time between fixes in milliseconds.
00353 * preferred_accuracy represents the requested fix accuracy in meters.
00354 * preferred_time represents the requested time to first fix in milliseconds.
00355 */
00356 int (*set_position_mode)(GpsPositionMode mode, GpsPositionRecurrence recurrence,
00357 uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time);
00358
00359 /** Get a pointer to extension information. */
00360 const void* (*get_extension)(const char* name);
00361 } GpsInterface;
00362
00363 /** Callback to request the client to download XTRA data.
00364 The client should download XTRA data and inject it by calling
00365 inject_xtra_data(). */
00366 typedef void (* gps_xtra_download_request)();
00367
00368 /** Callback structure for the XTRA interface. */
00369 typedef struct {
00370 gps_xtra_download_request download_request_cb;
00371 } GpsXtraCallbacks;
00372
00373 /** Extended interface for XTRA support. */
00374 typedef struct {
00375 /** set to sizeof(GpsXtraInterface) */
00376 size_t size;
00377 /**
00378 * Opens the XTRA interface and provides the callback routines
00379 * to the implemenation of this interface.
00380 */
00381 int (*init)( GpsXtraCallbacks* callbacks );
00382 /** Injects XTRA data into the GPS. */
00383 int (*inject_xtra_data)( char* data, int length );
00384 } GpsXtraInterface;
00385
00386 /** Extended interface for DEBUG support. */
00387 typedef struct {
00388 /** set to sizeof(GpsDebugInterface) */
00389 size_t size;
00390
00391 /**
00392 * This function should return any information that the native
00393 * implementation wishes to include in a bugreport.
00394 */
00395 size_t (*get_internal_state)(char* buffer, size_t bufferSize);
00396 } GpsDebugInterface;
00397
00398 /** Represents the status of AGPS. */
00399 typedef struct {
00400 /** set to sizeof(AGpsStatus) */
00401 size_t size;
00402
00403 AGpsType type;
00404 AGpsStatusValue status;
00405 } AGpsStatus;
00406
00407 /** Callback with AGPS status information. */
00408 typedef void (* agps_status_callback)(AGpsStatus* status);
00409
00410 /** Callback structure for the AGPS interface. */
00411 typedef struct {
00412 agps_status_callback status_cb;
00413 } AGpsCallbacks;
00414
00415
00416 /** Extended interface for AGPS support. */
00417 typedef struct {
00418 /** set to sizeof(AGpsInterface) */
00419 size_t size;
00420
00421 /**
00422 * Opens the AGPS interface and provides the callback routines
00423 * to the implemenation of this interface.
00424 */
00425 void (*init)( AGpsCallbacks* callbacks );
00426 /**
00427 * Notifies that a data connection is available and sets
00428 * the name of the APN to be used for SUPL.
00429 */
00430 int (*data_conn_open)( const char* apn );
00431 /**
00432 * Notifies that the AGPS data connection has been closed.
00433 */
00434 int (*data_conn_closed)();
00435 /**
00436 * Notifies that a data connection is not available for AGPS.
00437 */
00438 int (*data_conn_failed)();
00439 /**
00440 * Sets the hostname and port for the AGPS server.
00441 */
00442 int (*set_server)( AGpsType type, const char* hostname, int port );
00443 } AGpsInterface;
00444
00445
00446 /** Represents an NI request */
00447 typedef struct {
00448 /** set to sizeof(GpsNiNotification) */
00449 size_t size;
00450
00451 /**
00452 * An ID generated by HAL to associate NI notifications and UI
00453 * responses
00454 */
00455 int notification_id;
00456
00457 /**
00458 * An NI type used to distinguish different categories of NI
00459 * events, such as GPS_NI_TYPE_VOICE, GPS_NI_TYPE_UMTS_SUPL, ...
00460 */
00461 GpsNiType ni_type;
00462
00463 /**
00464 * Notification/verification options, combinations of GpsNiNotifyFlags constants
00465 */
00466 GpsNiNotifyFlags notify_flags;
00467
00468 /**
00469 * Timeout period to wait for user response.
00470 * Set to 0 for no time out limit.
00471 */
00472 int timeout;
00473
00474 /**
00475 * Default response when time out.
00476 */
00477 GpsUserResponseType default_response;
00478
00479 /**
00480 * Requestor ID
00481 */
00482 char requestor_id[GPS_NI_SHORT_STRING_MAXLEN];
00483
00484 /**
00485 * Notification message. It can also be used to store client_id in some cases
00486 */
00487 char text[GPS_NI_LONG_STRING_MAXLEN];
00488
00489 /**
00490 * Client name decoding scheme
00491 */
00492 GpsNiEncodingType requestor_id_encoding;
00493
00494 /**
00495 * Client name decoding scheme
00496 */
00497 GpsNiEncodingType text_encoding;
00498
00499 /**
00500 * A pointer to extra data. Format:
00501 * key_1 = value_1
00502 * key_2 = value_2
00503 */
00504 char extras[GPS_NI_LONG_STRING_MAXLEN];
00505
00506 } GpsNiNotification;
00507
00508 /** Callback with NI notification. */
00509 typedef void (*gps_ni_notify_callback)(GpsNiNotification *notification);
00510
00511 /** GPS NI callback structure. */
00512 typedef struct
00513 {
00514 /**
00515 * Sends the notification request from HAL to GPSLocationProvider.
00516 */
00517 gps_ni_notify_callback notify_cb;
00518 } GpsNiCallbacks;
00519
00520 /**
00521 * Extended interface for Network-initiated (NI) support.
00522 */
00523 typedef struct
00524 {
00525 /** set to sizeof(GpsNiInterface) */
00526 size_t size;
00527
00528 /** Registers the callbacks for HAL to use. */
00529 void (*init) (GpsNiCallbacks *callbacks);
00530
00531 /** Sends a response to HAL. */
00532 void (*respond) (int notif_id, GpsUserResponseType user_response);
00533 } GpsNiInterface;
00534
00535 struct gps_device_t {
00536 struct hw_device_t common;
00537
00538 /**
00539 * Set the provided lights to the provided values.
00540 *
00541 * Returns: 0 on succes, error code on failure.
00542 */
00543 const GpsInterface* (*get_gps_interface)(struct gps_device_t* dev);
00544 };
00545
00546 __END_DECLS
00547
00548 #endif /* ANDROID_INCLUDE_HARDWARE_GPS_H */
00549
Also if anyone is interested, I also have a rom that has apparently agps support in the rom, the "4281-001_Huashan_Sense_21_Gingerbread.zip" has support for agps, because it also have the agps drivers located in there, obviously this is the "brother" of the HD2 in china, so you guys might want to disassemble that as well.
I hope this was helpful in getting this to work, if I can be of any help, then let me know, but I think this script is the starting point for agps, because even some "Native" Android phones dont have agps support.
Good luck, and Hope this was of some use to you.
I second this request and will do my part to help. However, I have not done any kernel building yet...I can still help test and gather data.
-CMYLXGO
You guys should really speak with Charansingh, he apparently has some ideas for AGPS
Go to Charansingh thread and download latest nightly and kernel..Charansingh said that he have some clues about this and implemented in last kernel and nightly..but karendar is right if someone could help you its Charansingh
This is the primary reason why I posted this here, as so that the Dev's see it, as we know some dev dont even look in the Q&A and this obviously isnt a Q&A, so I figured any Dev can look at this and check the kernel source they use and see if this file exists in there kernel, because this is from my searching the key to the gps and the agps.
Also as I said that I had a rom that had agps support, I am posting my Alpha script I was working on along with the drivers from the "Brother" om, which has the agps drivers, again, maybe this will help any of the dev's since I dont know how to compile kernels, or how to run the scripts for the results.
All I ask is that credit be given where credit is due. I ask for nothing more.
Alpha Script Attached Below and the gps.h file is included, again anything I can answer I will.
Some info on GPS and AGPS
I will try to keep this as simple as possible for general public.
- A GPS receiver (such as the one in the HTC HD2) listens to signals transmitted down to earth from gps satellites and by using the information can calculate where you are located with high accuracy.
- The signal is very weak and very slow. A full message is transmitted every 30 seconds and a gps receiver needs to learn current sat information by listening to the message. It needs to be able to receive the full message so it usually takes about 1 minute to get a lock/fix on gps but may take longer.
- AGPS means assisted gps and it consists of a gps receiver located on top of a building that continuously listens to gps messages and shares the information on the internet for agps capable hardware.
- With proper AGPS, cold starts (meaning first lock without sat info) is usually between 5-10 seconds because the phone does not need to listen to whole message since it already learned it from the internet. (so an active data connection is required, but very little bandwidth is used)
- After an initial lock (with or without agps) relocks within few hours to half a day will be very fast since the reasonably accurate sat info is already known and hasn't expired.
- AGPS should not be confused with the location service, which, by the use of your wifi connected ip or gsm service towers it gives you a rough location in just 1 second. (accuracy is usually a few hundred meters)
- gps signals are one way only. (your phone does NOT transmit any signal to satellites!)
- Since the signals are very (read: VERY) weak, a gps receiver/phone has to be outside to be able to get a lock/fix. Being near tall buildings, trees, clouds, rain, being inside a moving car all affect the ability to receive the signal so under those conditions it will probably take longer to get a fix. Still with proper agps usual lock times are around 20-30 seconds under bad conditions. You usually can't get a lock inside a building. (maybe near the window but not always)
- The problem with HD2 is, it was originally built as a windows phone and android (or specifically linux kernel and drivers actually) was ported to it by the community. It took several months, and Android on HD2 is almost perfect except agps support. HD2 hardware is capable of agps (it works flawlessly in winmo) but the custom written hd2 gps driver and/or linux kernel doesn't have proper support (yet)
- HD2 wasn't meant to be running Android and being able to run free Android on our phones is hard work of a lot of people, so we can't really complain about it. But it would be nice to see agps working since HD2 is one of the best cheap piece of hardware out there and most of us can't afford a new native android phone with agps support. Given the progress of HD2 Android project in the last 8 months, IMO it is possible for some developer to implement agps. They just need motivation (hint: donation)
- I currently have a second business phone with agps and it gets a fix really fast making using navigation much more convenient. From what I can see, HD2 gps time lags exactly 1 second behind a proper phone. It also lags speed calculation. (but it is accurate as long as your speed is constant) Also a proper phone reports satellites before an actual fix is made. HD2 accuracy report is also wrong (usually almost always reports 1 meter accuracy while other phones report 4-6 under the same conditions) These are some minor glitches with the hd2 gps. Use AGPS appears under location & security menu in Android whenever agps support is available.
- A proper way to test agps support is to use GPS STATUS app from the market and try to clear agps data and redownload to see if it actually downloads.
I hope this info helps.
More info:
http://en.wikipedia.org/wiki/Gps
http://en.wikipedia.org/wiki/Assisted_GPS
memin1857,
I tried this already about the GPS Status and seeing if it actually downloads the agps file, but using a logcat, it never states anything regarding anything its doing other then outputting tcp connections, so this is where I had trouble trying to find exactly what its doing, but apparently its not Logcat friendly to layout its procedure.
In my alpha script that I setup up, along with the agps drivers that i pulled from the 'brother' rom, there was an xtra.bin file in that rom, now from my reading and searches, this xtra.bin file is suppose to be downloaded into the root/data folder, after this point where that files goes I dont know, again some say this file gets loaded into the GPS chip, this I have a hard time accepting especially since I have the xtra.bin file from the rom, but as far as I know anything in the root/data folder gets re-written at a reboot, and if it doesnt, none of the kernels at this point when referencing the gps doesnt point to the file except the gps.conf file which we all know I altered.
There are more commands in the alpha script for the GPS and AGPS, which I tried to impliment into the my current script, but obviously without referencing these lines or files, they are not doing the job they should.
Hopefully some dev's will chime in to this thread and give at least some insight.
will try to investigate on this since my connection is still broken I have time to check it
And since most HD2's are based off the desire HD, and the att inspire 4g supposedly being a desire, it has the same issue. I have a completely stock att Inspire 4g, and I just tested this yesterday, and the exact same issue, wifi turned on (No Sim card installed) ran car panel and navigation, wifi picked up in 1 second, gps did not lock, which leads me to believe the desire has the same issue, I havent looked into the file system yet, but I am almost certain that when I do I wont be finding the agps.so files or anything related.
Inc S
I believe that there are a few devs who have RUU Inc-S and Desire S stock roms, maybe those roms have agps support?
QBANIN GPSfix
I have found this application which reset agps data and downloads a fresh xtra.bin and actually places it in /data then tries to relay the info to gps library.
http://podrozomania.info/~qba/modules/experimental/GPSfix-0.1.apk (also attached to this post below)
This application requires root access and whenever started quickly downloads xtra.bin and places it in /data and in about 30 seconds it says gps fixed in Android notification message. The app won't display any interface, you will just see data connection arrow light up a little, see xtra.bin come up in /data and gps fixed message in 30 seconds.
EDIT: The app is actually for SAMSUNG GALAXY SPICA I5700 only! But may help for hd2 agps implementation.
I am not yet sure if it works with hd2 android yet because after any lock, a relock within 4 hours is very fast even in non agps assisted hd2. So it will take a few days for me to make controlled tests. You test this app too please.
I wasn't able to find xtra.bin in file system with my samsung native android phone because from what I've searched and read that xtra.bin is actually directly inserted into gps library so with many phones we can't find in the file system.
BTW "default,supl" phrase without the quotes must exist in apn type in apn settings for agps to work. (so android knows which apn connection it should use to download agps data, if it can't find supl apn type it won't download at all, this would also happen if wifi is enabled)
It seems some agps working android phones have
secgps.conf file in /data/gps
libsecgps.so in /system/lib
agpsd file in /system/bin
I have found those files for gingerbread but as I have stated in my above post I need a few days to properly test.
secgps.conf is a text file that can be freely edited. Extrtact and put these files to above mentioned locations with root explorer and bu sure to set permissions fully enabled. (the zip files are not for CWM)
The contents of secgps.conf varies slightly from phone to phone.
From what I've read, SUPL module is part of libgps.so (and the gps library libgps.so for hd2 is likely to be missing supl module) http://gitorious.org/htc-hd2-android-libraries/libgps
I also learned that there is an older method of agps called Control Plane (as opposed to SUPL/User Plane) which gets the data from gsm provider directly, it could be an alternative way. Of course your provider may not be supplying this service. AGPS mode can be changed to CP from a secret menu with samsung phones, unsure about hd2.
SUPL port varies from 7275 to 7276. It might be standart and secure port. ro.ril.def.agps.mode setting in build.prop may be setting agps secure mode on and off, unsure about it. I think secgps means secure gps and possibly just uses ssl to download agps data.
Hey,
I've found some information here that could help the devs maybe:
http://android.git.kernel.org/?p=pl...b3c244bea5941d5a3e8d8ec1b905b5be3076e;hb=HEAD and here: http://android.git.kernel.org/?p=platform/hardware/qcom/gps.git;a=summary
Unfortunatelly I don't know C++ but from what I could read into the sources the data there could be used as a starting point in fixing the reminder of gps functions on HD2.
I've posted the link into the IRC channel but unfortunatelly no dev was around to have a look on it so I hope they are reading this here
Hope this helps.
Best regards.
memin1857 said:
I have found this application which reset agps data and downloads a fresh xtra.bin and actually places it in /data then tries to relay the info to gps library.
http://podrozomania.info/~qba/modules/experimental/GPSfix-0.1.apk (also attached to this post below)
This application requires root access and whenever started quickly downloads xtra.bin and places it in /data and in about 30 seconds it says gps fixed in Android notification message. The app won't display any interface, you will just see data connection arrow light up a little, see xtra.bin come up in /data and gps fixed message in 30 seconds.
EDIT: The app is actually for SAMSUNG GALAXY SPICA I5700 only! But may help for hd2 agps implementation.
I am not yet sure if it works with hd2 android yet because after any lock, a relock within 4 hours is very fast even in non agps assisted hd2. So it will take a few days for me to make controlled tests. You test this app too please.
I wasn't able to find xtra.bin in file system with my samsung native android phone because from what I've searched and read that xtra.bin is actually directly inserted into gps library so with many phones we can't find in the file system.
BTW "default,supl" phrase without the quotes must exist in apn type in apn settings for agps to work. (so android knows which apn connection it should use to download agps data, if it can't find supl apn type it won't download at all, this would also happen if wifi is enabled)
Click to expand...
Click to collapse
This GPSFIX apk is interesting, it is just a downloader for the xtra.bin file, which is one good step, but I have to look into the apk and see what region its downloading for.
As for the location of the xtra.bin file, its located in the root /data folder, and can confirm its existence after running this apk in Raf's 4.0.
memin1857 said:
It seems some agps working android phones have
secgps.conf file in /data/gps
libsecgps.so in /system/lib
agpsd file in /system/bin
I have found those files for gingerbread but as I have stated in my above post I need a few days to properly test.
secgps.conf is a text file that can be freely edited. Extrtact and put these files to above mentioned locations with root explorer and bu sure to set permissions fully enabled. (the zip files are not for CWM)
The contents of secgps.conf varies slightly from phone to phone.
From what I've read, SUPL module is part of libgps.so (and the gps library libgps.so for hd2 is likely to be missing supl module) http://gitorious.org/htc-hd2-android-libraries/libgps
I also learned that there is an older method of agps called Control Plane (as opposed to SUPL) which gets the data from gsm provider directly, it could be an alternative way. Of course your provider may not be supplying this service. AGPS mode can be changed to CP from a secret menu with samsung phones, unsure about hd2.
SUPL port varies from 7275 to 7276. It might be standart and secure port. ro.ril.def.agps.mode setting in build.prop may be setting agps secure mode on and off, unsure about it. I think secgps means secure gps and possibly just uses ssl to download agps data.
Click to expand...
Click to collapse
I am going to look into the info you provided, because yes most of those files belong and we dont have all of them, but also you are missing the files in the alpha script I uploaded because they are the drivers from what I see for the agps. If you look at any of my conf files, the SUPL is there, but and User_plane, and I believe in the Alpha Script, I have additional commands for gps/agps, and that is one of them.
dlsniper said:
Hey,
I've found some information here that could help the devs maybe:
http://android.git.kernel.org/?p=pl...b3c244bea5941d5a3e8d8ec1b905b5be3076e;hb=HEAD and here: http://android.git.kernel.org/?p=platform/hardware/qcom/gps.git;a=summary
Unfortunatelly I don't know C++ but from what I could read into the sources the data there could be used as a starting point in fixing the reminder of gps functions on HD2.
I've posted the link into the IRC channel but unfortunatelly no dev was around to have a look on it so I hope they are reading this here
Hope this helps.
Best regards.
Click to expand...
Click to collapse
Thats the missing gps.c file thats needed to along with the gps.h, if they are compatabile, then they might be able to be compiled into the kernel, good find.
Now, I am posting this here and I am going to post it into my thread in the Q&A and I would like anyone to test this out to verify I'm not nuts.
I want anyone willing to try this to report back to this thread the results:
Install the GPSFIX 0.1 thats been posted by memin1857, then run it, after which I want you to use your favorite root explorer, navcigate to system/etc/gps.conf, open this file to edit the text, at the last line I want you to put this line:
AGPS=/data/xtra.bin
XTRA_SERVER_1=/data/xtra.bin
Then save and exit the file. Then run your GPS software, or GPS Status, and post the results, cause I just did this and added the two lines, and I got a very fast lock, much faster then that I anticipated.
Please post results!
memin1857 said:
It seems some agps working android phones have
secgps.conf file in /data/gps
libsecgps.so in /system/lib
agpsd file in /system/bin
I have found those files for gingerbread but as I have stated in my above post I need a few days to properly test.
secgps.conf is a text file that can be freely edited. Extrtact and put these files to above mentioned locations with root explorer and bu sure to set permissions fully enabled. (the zip files are not for CWM)
The contents of secgps.conf varies slightly from phone to phone.
From what I've read, SUPL module is part of libgps.so (and the gps library libgps.so for hd2 is likely to be missing supl module) http://gitorious.org/htc-hd2-android-libraries/libgps
I also learned that there is an older method of agps called Control Plane (as opposed to SUPL) which gets the data from gsm provider directly, it could be an alternative way. Of course your provider may not be supplying this service. AGPS mode can be changed to CP from a secret menu with samsung phones, unsure about hd2.
SUPL port varies from 7275 to 7276. It might be standart and secure port. ro.ril.def.agps.mode setting in build.prop may be setting agps secure mode on and off, unsure about it. I think secgps means secure gps and possibly just uses ssl to download agps data.
Click to expand...
Click to collapse
AFAIK, http://gitorious.org/htc-hd2-android-libraries/libgps is the gps source code for Froyo, not for Gingerbread. Not sure.
We have "setprop ro.ril.def.agps.mode 2" in init.htcleo.rc.
HD2 has amss version 3200 for gps, but when we compile it it doesnt work.the amss version is same as all other *gsm* snapdragons. I think it could be a kernel and the lib incompatibility. HD2 kernel source is 99% based on HTC Kernel sources rather than aosp. AOSP sources are always better so thats the reason i want to fully change the kernel source to AOSP base rather than HTC. AOSP is more compatible with everything. So i am gonna see the gps kernel source for hd2 and bravo or nexus one in cm kernel and do the necessary changes, also there are some agps lines that were missing in init.htcleo.rc and i have added that to the latest build i have uploaded. So test if anything GPS related is speeded up.
Currently we have ported WIFI and Bluetooth AOSP drivers to HD2 source, GPS i dont know, kgsl(gpu) is the same and i am still reading its kernel for more changes so i think in some time we should have a better hd2.
Just for people who want 720p
if we do the HTC implementation we need to use the latest DSP drivers which are not being used right now and also configure 720p stuff in camera , encoders. We already have the omxcore for it
If we do Google Implementation we would only need the latest DSP drivers and use NExus One Camera and OMX libs
charnsingh_online said:
HD2 has amss version 3200 for gps, but when we compile it it doesnt work.the amss version is same as all other *gsm* snapdragons. I think it could be a kernel and the lib incompatibility. HD2 kernel source is 99% based on HTC Kernel sources rather than aosp. AOSP sources are always better so thats the reason i want to fully change the kernel source to AOSP base rather than HTC. AOSP is more compatible with everything. So i am gonna see the gps kernel source for hd2 and bravo or nexus one in cm kernel and do the necessary changes, also there are some agps lines that were missing in init.htcleo.rc and i have added that to the latest build i have uploaded. So test if anything GPS related is speeded up.
Currently we have ported WIFI and Bluetooth AOSP drivers to HD2 source, GPS i dont know, kgsl(gpu) is the same and i am still reading its kernel for more changes so i think in some time we should have a better hd2.
Just for people who want 720p
if we do the HTC implementation we need to use the latest DSP drivers which are not being used right now and also configure 720p stuff in camera , encoders. We already have the omxcore for it
If we do Google Implementation we would only need the latest DSP drivers and use NExus One Camera and OMX libs
Click to expand...
Click to collapse
Yeah, I was wondering that...Wi-Fi works much better now on you're build with extremely low drain < 10 mAh normally, had even 2mAh with Wi-Fi ON
Its amazing, normally before it was 20-40mAh drain, even more...not to mention no wake up lag with Wi-Fi ON...Great work
charnsingh_online said:
HD2 has amss version 3200 for gps, but when we compile it it doesnt work.the amss version is same as all other *gsm* snapdragons. I think it could be a kernel and the lib incompatibility. HD2 kernel source is 99% based on HTC Kernel sources rather than aosp. AOSP sources are always better so thats the reason i want to fully change the kernel source to AOSP base rather than HTC. AOSP is more compatible with everything. So i am gonna see the gps kernel source for hd2 and bravo or nexus one in cm kernel and do the necessary changes, also there are some agps lines that were missing in init.htcleo.rc and i have added that to the latest build i have uploaded. So test if anything GPS related is speeded up.
Currently we have ported WIFI and Bluetooth AOSP drivers to HD2 source, GPS i dont know, kgsl(gpu) is the same and i am still reading its kernel for more changes so i think in some time we should have a better hd2.
Just for people who want 720p
if we do the HTC implementation we need to use the latest DSP drivers which are not being used right now and also configure 720p stuff in camera , encoders. We already have the omxcore for it
If we do Google Implementation we would only need the latest DSP drivers and use NExus One Camera and OMX libs
Click to expand...
Click to collapse
Then I have one question, why is the code in the first post, not anywhere in the kernel soruces that I have looked at? Apparently this code has something to do with it, now unless your statement of removing the code was based that the amss wasnt functioning with that, then I misunderstood, but if this script wasnt in there along with the gps.c then wouldnt that conform to it?
Also the huashan rom that was leaked about a month or two ago, being the "brother" of the HD2 in china, wouldnt that lead to some clues to the implimentation of the agps? Because it doesnt seem that the Desire or Desire HD has this in place either. I have the Inspire 4G from ATT and it has the same issues as our current ports, and this is stock directly from HTC itself, os it makes you wonder if its just missing entirely.
dlsniper said:
Hey,
I've found some information here that could help the devs maybe:
http://android.git.kernel.org/?p=pl...b3c244bea5941d5a3e8d8ec1b905b5be3076e;hb=HEAD and here: http://android.git.kernel.org/?p=platform/hardware/qcom/gps.git;a=summary
Unfortunatelly I don't know C++ but from what I could read into the sources the data there could be used as a starting point in fixing the reminder of gps functions on HD2.
I've posted the link into the IRC channel but unfortunatelly no dev was around to have a look on it so I hope they are reading this here
Hope this helps.
Best regards.
Click to expand...
Click to collapse
[platform/hardware/qcom/gps.git] / loc_api / libloc_api / Android.mk
It will produce /system/lib/hw/gps.mahimahi.so (e.g. for Nexus One) which cannot be used on HD2.
U can produce gps.htcleo.so if u do it in the vendor, compile cm7 for leo from sources and you will be able to compile it but i am not able to get the compiled version working, could be amss problem, kernel problem or hardware lib problem.

[Q] ListBox Binding Error with Observable Collection

Hi all!
Since days I have a problem now. I have an app that manage Entries in a list A. If one of these entries End-Date is today I whant that entry to be shown in a second list B. This is checked when I return from the "addNewItem" Window so I use onNavigatedTo.
Code:
// Static Variables
public static ObservableCollection<Item> lstToday = new ObservableCollection<Item>();
public static ObservableCollection<Item> lstWeek = new ObservableCollection<Item>();
public static ObservableCollection<Item> lstAll = new ObservableCollection<Item>();
// Constructor
public MainPage()
{
InitializeComponent();
MessageBox.Show("Initialize Component");
lbToday.ItemsSource = lstToday;
lbWeek.ItemsSource = lstWeek;
lbAll.ItemsSource = lstAll;
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
DateTime currentDate = DateTime.Now;
foreach (Item item in lstAll)
{
if (item.endDate.ToString("yyyy'-'MM'-'dd").Equals(currentDate.ToString("yyyy'-'MM'-'dd")))
{
lstToday.Add(item);
MessageBox.Show("Item '" + item.name + "' added to Todaylist");
}
}
}
private void appBarNew_Click(object sender, EventArgs e)
{
NavigationService.Navigate(new Uri(string.Format("/EditAddItem.xaml"), UriKind.Relative));
}
After that I get an "System.Diagnostics.Debugger.Break();" error that doesn't occur when I delete "lbToday.ItemsSource = lstToday;" to avoid the ListBox Binding.
With lbAll ist runs without any problems!
Can I bind the Listbox direct to the ObservableCollection in XAML=
I really don't know, whats to do. So do you?
It would make my day!
Thanks!
What is the exception message and stack trace when the exception is thrown? (you can browse the properties of the exception using visual studio).
Your code actually works for me (although I had to make some assumptions about what is in lstAll as you don't mention that, and you may have an error in the DataTemplate for the listbox for binding your Item class)
Things to try:
Have you tried it with non static observable collections?
Use binding assignments in the xaml rather than setting the itemssource directly (e.g. using a viewmodel). Then you can let the phone engine worry about when to do the assigments. If you do that don't forget to set the page's datacontext property.
Try it with simple collections of strings first (rather than binding an 'item' class) so you can check it's working without a datatemplate.
Hope you fix it.
Ian

Advice on strategy

I'm developing a WP7 app, working alongside a Windows (server) application. They are talking with each other using sockets.
As soon as the WP7 app opens, I wish to perform a network scan to find the server application.
I already found out how to get the IP address of the WP7. So let's say I know the server should be somewhere at 192.168.0.*. How do I go about scanning this network?
I tried many things, the last of which is the code below. The problem here is that somehow the TIMEOUT_MILLISECONDS parameter seems to be like playing roulette (tried everything in the range of 100-2000 with different success). In addition, if I sweep the whole subnet like in the code below the phone cannot seem to handle the work. I only get it to work if I set the timeout to 2000 (which is way to long) and by scanning up to 5 IP's in the for-loop, instead of the whole subnet.
Is there anyone that knows a better and much more efficient(!) way to do this?
Code:
string thisIP = "192.168.0.101"; // I normally get this from some other function
string[] arrIP = thisIP.ToString().Split('.');
string IPBase = arrIP[0] + "." + arrIP[1] + "." + arrIP[2] + ".";
//MessageBox.Show(address.ToString());
for (int i = 2; i < 254; i++) {
string IP = IPBase + i;
CheckConnection CheckConn = new CheckConnection();
string resultConnect = CheckConn.Connect(IP, int.Parse(Resource1.port));
if (resultConnect == "Success") {
CheckConn.Send("isAlive");
string result = CheckConn.Receive();
if (result.Contains("yes")) {
// We have found the server
break;
}
}
CheckConn.Close();
}
Code:
public class CheckConnection
{
// Cached Socket object that will be used by each call for the lifetime of this class
Socket _socket = null;
static ManualResetEvent _clientDone = new ManualResetEvent(false);
const int TIMEOUT_MILLISECONDS = 100;
const int MAX_BUFFER_SIZE = 2048;
public string Connect(string hostName, int portNumber) {
string result = string.Empty;
DnsEndPoint hostEntry = new DnsEndPoint(hostName, portNumber);
_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.RemoteEndPoint = hostEntry;
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e) {
result = e.SocketError.ToString();
_clientDone.Set();
});
_clientDone.Reset();
_socket.ConnectAsync(socketEventArg);
_clientDone.WaitOne(TIMEOUT_MILLISECONDS);
return result;
}
public string Send(string data) {
string response = "Operation Timeout";
if (_socket != null) {
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.RemoteEndPoint = _socket.RemoteEndPoint;
socketEventArg.UserToken = null;
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e) {
response = e.SocketError.ToString();
_clientDone.Set();
});
byte[] payload = Encoding.UTF8.GetBytes(data);
socketEventArg.SetBuffer(payload, 0, payload.Length);
_clientDone.Reset();
_socket.SendAsync(socketEventArg);
// Block the UI thread for a maximum of TIMEOUT_MILLISECONDS seconds.
// If no response comes back within this time then proceed
_clientDone.WaitOne(TIMEOUT_MILLISECONDS);
}
else {
response = "Socket is not initialized";
}
return response;
}
public string Receive() {
string response = "Operation Timeout";
if (_socket != null) {
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.RemoteEndPoint = _socket.RemoteEndPoint;
socketEventArg.SetBuffer(new Byte[MAX_BUFFER_SIZE], 0, MAX_BUFFER_SIZE);
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e) {
if (e.SocketError == SocketError.Success) {
response = Encoding.UTF8.GetString(e.Buffer, e.Offset, e.BytesTransferred);
response = response.Trim('\0');
}
else {
response = e.SocketError.ToString();
}
_clientDone.Set();
});
_clientDone.Reset();
_socket.ReceiveAsync(socketEventArg);
_clientDone.WaitOne(TIMEOUT_MILLISECONDS);
}
else {
response = "Socket is not initialized";
}
return response;
}
public void Close() {
if (_socket != null) {
_socket.Close();
}
}
}
Why you don't know the server IP?
I can't help you with your subnet scanning problem, don't have experience with that corner of WP7 programming.
But I do wonder what kind of arrangement leads to the problem that your app does not know the server address and therefore has to scan for it. Is neither a fixed IP available for your server nor some kind of DNS service up to tell you the current IP?
Even if there are multiple servers running and the phone has the job to somehow decide which one of those is responsible for it, you still could set up some kind of super-server that the phones could ask first which server they should address.
In any way, phones scanning subnets to find servers as some routine app startup action is a bad idea, if you ask me.
Please note that by 'server' I'm just revering to a software that accepts socket connections. This software is installed into a Windows computer that most likely has it's IP from DHCP.
The server software itself could present it's IP address so the end-user can type this address into the client on their WP7. Nice for tech-savvy folks, but that's not how software should be designed in my opinion. People don't need to know what an IP address is and shouldn't be force into typing 'weird numbers'. Properly designed software just have to work instantly and developers (again in my opinion) need to take care of a good design and that includes making things plug-and-play where they can.
Take a look at 'PC Remote' and you will see the kind of easy plug-and-play experience I'm looking for.
Did you check broadcast?
I'm really not network guy, but from Googling I got the impression that people use broadcast instead of IP range scanning for such IP number discovery tasks, and there seems to be a way to do broadcast on WP7 (albeit only using some tricks / hardly documented functionalilty):
E.g. see this thread:
http://stackoverflow.com/questions/8533471/udp-broadcasting-in-windows-phone-7
Which links to this:
http://forums.create.msdn.com/forums/t/88975.aspx
This makes sense to me after reading that broadcast is also the method how a client finds its DHCP server - isn't that the exact same scenario like yours?
Did you already check this way of looking at the problem, or maybe rule it out already for some reason?
It's better if you use a multicast group to send/receive packages. I had way better experience with it than using the Broadcast IP.
You need to join the multicast group with the phone and with the server app. I know there are multicast classes but I found it easier and mor convient to implement it with a socket...
And after you found the server, I'd use a persistent tcp connection which should improve your network performance (udp and wp7 is sometimes really strange...)
Thanks rbrunner7 and chabun for your comments, I appreciate your input!
rbrunner7 said:
Did you already check this way of looking at the problem, or maybe rule it out already for some reason?
Click to expand...
Click to collapse
I did, briefly, but abandoned this path after reading about the physical network equipment (switches etc.) having the need to support broadcasting which might not always be the case.
Anyway, your mentioned post describes 'limited broadcasting', which might be exactly what I should be looking for. Hopefully hardware limitations will not be applicable; I will look into this method further and will let you know how it works out!
roady001 said:
the physical network equipment (switches etc.) having the need to support broadcasting which might not always be the case.
Click to expand...
Click to collapse
I had the same doubts about that as it's also the case for multicasting. Most modern equipement supports it though and you can always provide the possibility to manually enter the server ip if you can't discover one via multicast/broadcast

Heart Sensor/Passive Wellness sensor

Hello dear forum members,
As far as I know , moto360 doesn't have a sensor of type : TYPE_HEART_RATE, it's called passive wellness sensor.
The problem is that this wellness sensor is not giving me any data, as opposed to every other sensor that I've tried (like gravity, accelerometer...)
I've been waiting for more than 5 min but this sensor gives me data only when I start the app.
I've tried sdk20,sdk21,sdk22,sdk23 ... still no result I also have the android.permission.BODY_SENSORS in my manifest
Question : How to get the sensor working, what can I do?
Code:
package com.x.firstapp;
import android.app.Activity;
import android.os.Bundle;
import android.support.wearable.view.WatchViewStub;
import android.util.Log;
import android.widget.Toast;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.view.WindowManager;
public class MainActivity extends Activity implements SensorEventListener {
private SensorManager mSensorManager;
private Sensor mHeartSensor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
}
});
// keep watch screen on
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Toast.makeText(getApplicationContext(), "Hi Oleg", Toast.LENGTH_LONG).show();
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
mHeartSensor = mSensorManager.getDefaultSensor(65538); //wellness sensor
mSensorManager.registerListener(this, mHeartSensor, SensorManager.SENSOR_DELAY_NORMAL);
}
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() == 65538) {
String msg = "" + (int) event.values[0];
Log.d("Main Activity", msg);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
Log.d("Main Activity", "accuracy : " + accuracy + " sensor : " + sensor.getName());
}
@Override
protected void onStop() {
super.onStop();
mSensorManager.unregisterListener(this);
}
only output out of this "wellness" sensor (only when app starts) :
D/Main Activity: accuracy : 3 sensor : Wellness Passive Sensor
D/Main Activity: 0​
I have also posted this question on stack overflow, but so far - no success.
As soon as I get an answer here I'll spread it on stack overflow as well.
Thank you
Did you ever solve this? This might help.
What version of OS is your device running. For me, on my moto360 gen 1, now running 6.0.1, I have the permission in the manifest, but I MUST request it from the user using the new android M request mechanism, as BODY_SENSORS is labelled as a dangerous permission. Under debug, you can see all the sensors in the list if you get all sensors, but the iteration through them checks granted permissions.
Apparently, if the app is installed as a companion to an on phone app, it inherits the permissions from the device, so you don't need to ask, but a side-loaded app needs to ask.
Having said that, I clearly got a null for the HEART_RATE sensor until I'd requested user permissions. You at least get something.
dazbys said:
Did you ever solve this? This might help.
What version of OS is your device running. For me, on my moto360 gen 1, now running 6.0.1, I have the permission in the manifest, but I MUST request it from the user using the new android M request mechanism, as BODY_SENSORS is labelled as a dangerous permission. Under debug, you can see all the sensors in the list if you get all sensors, but the iteration through them checks granted permissions.
Apparently, if the app is installed as a companion to an on phone app, it inherits the permissions from the device, so you don't need to ask, but a side-loaded app needs to ask.
Having said that, I clearly got a null for the HEART_RATE sensor until I'd requested user permissions. You at least get something.
Click to expand...
Click to collapse
Hello,
It's a year later. I have a 2nd gen Moto 360 Sport. The android version is 6.01.
I am having what sounds like the same problem. Did you ever solve this?
I am using software which I basically copied from the web. When I run the software I get onAccuracyChanged events with accuracy values somewhere between one and three – mostly two and three.
But, I never get onSensorChanged events. I have the BODY_SENSORS permission in the manifest. And on the watch, if I go into Settings-Permissions, I see that the Sensors permission is enabled.
You mention "I MUST request it from the user using the new android M request mechanism". I'm not familiar with this mechanism. Could you explain a little more? I will also search for more information about this.
Do you have any more suggestions? Did you ever get yours working? It seems strange that I get the onAccuracyChanged events, but no onSensorChanged events. Could it possibly be something like the accuracy has to be four or greater in order to get onSensorChanged events?
Thanks,
Barry.
To answer my own question…
Of course it turned out I had a software error - I had assumed one of the event fields was an integer, it was not.
As was stated in the original answer: Be sure to have the BODY_SENSORS permission in the manifest (for both the phone and wearable). Since I am using SDK platform 20 rather than 23, I don't need to follow the android M procedure of requesting permission, but on the watch I did make sure the Settings-Permissions for my app had Sensors enabled.

Categories

Resources