sensors HAL

by Ken Schultz » Thu, 05 Mar 2009 18:22:18 GMT


Sponsored Links
 Is there a recommended way to pass information between a
sensors_control_context_t struct and a sensors_data_context_t struct?
(i.e. active_sensors)  For devices without a hardware eCompass there
needs to be a way in the polling function to determine if the sensor
is activated, so it can inject data.  The polling function is part of
the sensors_data_context_t and the activate function is part of
sensors_control_context_t.

Thanks,
Ken
--~--~---------~--~----~------------~-------~--~----~

-~----------~----~----~----~------~----~------~--~---



Other Threads

1. The Google Phone is real (confirmed by Google)

Supposedly the GPhone is unlocked with GSM bands, not sure T-mob 3G or AT&T
3G, could be both??






> 

2. PCM Data - Frame Count

I am using the length of my PCM data buffer to calculate the number of
frames; depending if its mono or stereo or 8bit or 16bit.

For example, if it is a mono/8bit then the number of frames is the
length of the buffer. if it is stereo/16bit the number of frames is
the length / 4.

The problem is that the buffer, I create by reading the PCM raw
resource (file), seems to be too long (look below) . Therefore the
number of frames is also too heigh. why am I getting the buffer longer
then it should be?

there is another way to calculate the number of frames;



Number of Frames = <Sample Rate> * <duration of the PCM sample in [ms]

for example 11.025[kHz] * 4000 [ms] = 44100 [frames]

the above calculations should yield the same result, yet they don
(the problem is with the buffer length). I am certain that the second
result is correct. am I doing something wrong with the way I read in
the data? I should put it into the WHILE loop when reading. But that
not it.



Here is how I create the buffer;



private byte[] readResource (int resourceId)
{
    InputStream inputStream = null;
    byte[]  inputBuffer = null;
    try
    {
        inputStream = _Context.getResources().openRawResource
(resourceId);
        inputBuffer = new byte [inputStream.available()];
        inputStream.read(inputBuffer);
    }
    catch (IOException e)
    {
        Log.e(this.getClass().getName(), String.format("readResource:
Exception: %s", e.getMessage()));
    }
    finally
    {
        try
        {
            inputStream.close();
        }
        catch (IOException e)
        {
            Log.e(this.getClass().getName(), String.format
("readResource: Exception: %s", e.getMessage()));
        }
    }
    return inputBuffer;
}

-- 

3. ExpandableListView change background for child items

4. TextView ems, sp, typeface attributes

5. Rotate TextView to x degrees

6. Difference between pressing 'Back' button and 'Menu button

7. Extending the webkit or creating webkit plug in