[Q] Editing Kernal C Code, and adding a function to Java - General Questions and Answers

Hello,
I am extremely lost here.
The RSSI (Received Signal Strength Index) for Wifi P2P in Android is not implemented. It is set to a constant 60 in the Java code. However, looking at the kernel, in p2p_supplicant.c, there is a pointer bss->level that contains the RSSI.
If I create a function in that file to get RSSI which just returns bss->level, how can I call that in Java?
I know that I will be creating a custom ROM, and I will read about doing that, but my question is how to connect the Java with the C?

Related

[Q] get link quality

Hi,
I'm writing an application on android, and for a long time I'm trying to get the lq(link quality) value of an existing bluetooth connection between two mobile phones. I've read on a forum about a method named getLinkQuality() included in
the Bluez API written in C, and I want to include it into my Java code. Does anyone have a similar problem-related example code, like getting RSSI value, any advice or any other idea to get the link quality level? I had troubles using Android NDK so I could really use some help.
Regards,
Peter

WiFi and 3g simultaneously Guide - need help following instructions

Hi,
I currently try to follow these instructions...
http://mobisocial.stanford.edu/news...together-by-hacking-connectivityservice-java/
Very hard for me. Don't know what to do.
The goal of COIN project is to use WiFi and 3G connections simultaneously. So it conflicts with the policy of Connectivity Service, but there is no configuration to edit the policy, and it is hard coded. You can find the clue in ConnectivityService.java:handleConnect function.
Our current solution is quite brutal, which is to mask the eyes of Connectivity Service by modifying its message handler entry like the following:
// must be stateless – things change under us.
private class MyHandler extends Handler {
@Override
public void handleMessage(Message msg) {
NetworkInfo info;
//added by COIN to disable Connectivity Service
int networkState = 8; //not any following state
/*use static google dns server for wifi and 3g*/
if (msg.what == NetworkStateTracker.EVENT_STATE_CHANGED) {
SystemProperties.set(“net.dns1″, “8.8.8.8″);
SystemProperties.set(“net.dns2″, “8.8.4.4″);
bumpDns();
}
//////////////////////////////////////////////
//switch (msg.what) {
switch (networkState) {
case NetworkStateTracker.EVENT_STATE_CHANGED:
info = (NetworkInfo) msg.obj;
int type = info.getType();
…..
And then compile the modified ConnectivityService.java in the android source code tree, you can get an new services.jar file in framework directory. Replace the existing services.jar on the cell phone with the following adb commands, then reboot the phone
adb shell “mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system”
adb shell “chmod 0777 /system/framework”
adb push services.jar /system/framework
adb shell “chmod 0644 /system/framework/services.jar”
adb shell “chmod 0755 /system/framework”
Click to expand...
Click to collapse
Does he mean I have to compile the whole Android source code again?
So I would need to learn first, how to compile Android, then change this file, compile Android, copy file?
Instant of adb shell, could I also use root explorer?
How device dependant is this? Or how android version dependant?
Could someone offer the compiled file?
No answer yet.
I believe so. This is actually what compelled me to go learn to compile android by myself-- the constant switching between 3g and wifi in a semi-strong wifi zone sucks. For now I am starting with CM7 since it is so popular.
Yes you would need to compile the whole OS and it will only work on an AOSP rom. It will also be very version dependent.
Please let me know if it worked ! I probably don't think it will. Read this on the page:
Pallas Says:
April 13, 2012 at 5:58 am
are you sure the packets are going thru both interfaces?
I think it doesn’t work, simply because you would need two default gateways, leading to some hard problems:
- how does the system choose where to send the packets?
- for outgoing packets: unless the two connections have both statically assigned public IP addresses, which is very unlikely, you will end up with two differently NATed paths, and the client will refuse packets coming from two different ip addresses on the same connection.
- for incoming packets: to let the client send packets to both interfaces, you would need to send them from both interfaces with different source ip addresses: it will not work, the client will get confused. and anyway you would need support at the application level.
to solve all this, you’d need to:
- make an ad-hoc application which understands all this and can send chuncks to both interfaces, then merge all the returning chunks. you’d need support at the application level: for example you’d need http byte range support on both client and server
- divide “equally” the single specific connections thru the two gateways. this may work but it’s pretty hard if you do not have access to advanced routing and traffic shaping at the kernel level. may be possible on a phone with custom compiled aosp rom and modified kernel
gouthamsn said:
Please let me know if it worked ! I probably don't think it will. Read this on the page:
Pallas Says:
April 13, 2012 at 5:58 am
are you sure the packets are going thru both interfaces?
I think it doesn’t work, simply because you would need two default gateways, leading to some hard problems:
- how does the system choose where to send the packets?
- for outgoing packets: unless the two connections have both statically assigned public IP addresses, which is very unlikely, you will end up with two differently NATed paths, and the client will refuse packets coming from two different ip addresses on the same connection.
- for incoming packets: to let the client send packets to both interfaces, you would need to send them from both interfaces with different source ip addresses: it will not work, the client will get confused. and anyway you would need support at the application level.
to solve all this, you’d need to:
- make an ad-hoc application which understands all this and can send chuncks to both interfaces, then merge all the returning chunks. you’d need support at the application level: for example you’d need http byte range support on both client and server
- divide “equally” the single specific connections thru the two gateways. this may work but it’s pretty hard if you do not have access to advanced routing and traffic shaping at the kernel level. may be possible on a phone with custom compiled aosp rom and modified kernel
Click to expand...
Click to collapse
(Probably for your Interest
This project works on a MultiPath-TCP Implementation (follow link to mptcp.info.ucl.ac.be). The hard times you get is compiling the Kernel with the additional files. This Protocol can only work effectively for download Purposes if the Server also has a MPTCP Kernel running. But on the other Hand you can shut down a single connection without loosing the active Connection (Downloads are not interrupted and improved Bandwidth Capacity if your Server is MPTCP-Ready)
Until now this Protocol is only working for Homeservers or similar Projects, where you have full access to the Server and the working Kernel of the system.
I am currently working on implementation of the Protocol for my Bachelor Thesis. I already compiled a working Kernel (Glados Nexus S) and now i'm working on keeping both Interfaces active. I hope this Tut can help me...
Has anybody tried other approaches to this topic? I tried manually loading the wifi-module and configuring it, but i only managed to ping via one Interface.
You managed to make it work?
bagers said:
No answer yet.
Click to expand...
Click to collapse
You managed to make it work? i want to make it also for my master thesis

[Q] android to Pc

I am working on a project to guide blind students. I am using WiFi Tags and android mobile. WiFi tags are placed on the wall and android is carried by blind student. The student's time table, shortest path algorithm to reach specific lecture hall is loaded onto HOST.
Whenever android mobiles comes in vicinity of any Wifi tag, it receives the beacons from WiFi Tag. In order to achieve this, android has to scan all the wifi devices every 3 sec(say).So, the android has to forward the WiFi tag id (mac address), android mac id, Received Signal Strength to the HOST. So, how should I do this? What are the different applications to be loaded onto the android mobile? How should the scanning be done?
Once HOST receives the data from android, it will determine the shortest path in accordance to algorithm and has to send back instruction (say direction - Go Left) to android. So, how can we do this? Since the student is visually impaired, the incoming msg should be audio.
Please let me know how to achieve this? I am new to android.
Thanks Shaban

[Q] Can't modify Wifi operations...

Hello, I'm trying to modify Wifi operations (802.11 MAC) in Nexus S.
For example, I'm trying to change the values of fields in MAC header in Beacon frame or Null data frame(for power saving mode).
But, I have a critical problem that I cannot find the corresponding kernel files.
I don't know where the 802.11 MAC header is created in case of TX,
and where the values of fields of 802.11 MAC header are extracted from the received packet in case of RX.
Actually, I found several kernel files relating to 802.11 operations, so for example, kernel/net/mac80211/*, and so on.
Especially, kernel/net/mac802.11/tx.c includes "ieee80211_subif_start_xmit" function.
However, when I compile the kernel files to generate zImage, they are not included (they are not compiled), but my Nexus S works properly.
Also, I found that Nexus S employing JB uses kernel/drivers/net/wireless/bcmdmd/*
However, in .../bcmdhd/*, the functions which might be 802.11-related are not executed when browsing Internet using Nexus S.
Please let me know how to do or what to do...
and I'm currently working on the kernel version is 3.0.31 (JB).
Thank you.

How add a toggle button for active inactive in Yii CgridView

By the help of FPDI library, I tried to write some exsiting pdf files but able to wirte only single page of pdf.
Below is my code:
PHP:
require_once '../includes/fpdf/fpdf.php';
require_once '../includes/fpdf/fpdi.php';
$pdf = new FPDI();
$pageCount = $pdf->setSourceFile("contractFinalTrans.pdf");
$tplIdx = $pdf->importPage(1);
$pdf->addPage();
$pdf->useTemplate($tplIdx, 10, 10, 200);
//set position in pdf document
// now write some text above the imported page
//$pdf->SetFont('Arial');
$pdf->SetFontSize(10);
$pdf->SetTextColor(255,0,0);
$pdf->SetXY(50, 50);
$pdf->Write(0, "page 1");///print this output
$pdf->SetAutoPageBreak(true,22);
$pdf->addPage();
$tplIdx = $pdf->importPage(2);
//$pdf->addPage();
$pdf->useTemplate($tplIdx, 10, 10, 200);
//set position in pdf document
// now write some text above the imported page
//$pdf->SetFont('Arial');
$pdf->SetFontSize(10);
$pdf->SetTextColor(255,0,0);
$pdf->SetXY(100 , 100);
$pdf->Write(0, "page 2");
$pdf->Output();
Can anyone suggest me how to Edit Existing multiple pdf using fpdf Library in PHP
I have explored many php developer forum related to this issue but I am unable to get satisfactory solutions. Hope this forum help me out for the same issue.
How to connect MySQL database in Java ?
I am coding a module in java that need a database connection with MySQL. I heard about DriverManager but I think it is pretty old method for database connection. Is there any newer and efficient way of doing the same. This Java questions and answers forum comprises of large number of tech and coding expert, So I expect quick and satisfactory solution or full set of instruction/ code require for this.
Connect mysql Java, Java mysql connection, DB connection in Java
http://findnerd.com/askquestion/java
I am coding a module in java that need a database connection with MySQL. I heard about DriverManager but I think it is pretty old method for database connection. Is there any newer and efficient way of doing the same. This Java questions and answers forum comprises of large number of tech and coding expert, So I expect quick and satisfactory solution or full set of instruction/ code require for this.

Categories

Resources