[Q] One V rom port muting issue - HTC One V

Hi xda,
Over at sensation xl forum we are trying to port a ROM from HTC One V to HTC Sensation Xl, we are so close to a fully working rom, but we have a bug left we just can't fix.
The ROM is on Android 4.0.4 with Sense 4.1 but we also trying to port Android 4.0.4 with Sense 4.0 and it has the same bug.
Here is the problem:
When I am calling someone and a SMS message comes in the phone are trying to make a sound so I know I got a SMS, but it does not play a sound. The only thing it does is muting the sound from speaker. I can get the speaker working again if I press mute and unmute again. We had tried many different things but no luck finding the bug. I am then thinking what about adding a function so when on call and SMS comes in the phone does not making notification, only when calls end I can see in SMS app that there is a new SMS.
I had found a way to cancel notification but that will cancel all notifications on SMS no matter on call or not.
I went to Message.apk ------ MessagingNotification.smali and found this:
Code:
const-string v2, "MessagingNotification"
const-string v3, ">> enter initiateEffectOfNotification"
invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 2078
if-eqz p1, :cond_174
.line 2079
And I changed to this:
Code:
const-string v2, "MessagingNotification"
#const-string v3, ">> enter initiateEffectOfNotification"
invoke-static {v2, v3}, Landroid/util/Log;->d (Ljava/lang/String;Ljava/lang/String;)I
.line 2078
if-eqz p1, :cond_174
.line 2079
And then no notifications while in call and the speaker don't mute, but it will remove all notifications no matter in call or not.
I am then thinking what code can I make to remove notifications while in call but still gets notifications when I am not in call?
I have made a logcat for you and in line 764 this is found:
Code:
11-07 22:42:00.407: D/MessagingNotification(2446): Thread id > 3
11-07 22:42:00.407: D/MessagingNotification(2446): Contact id > 11
11-07 22:42:00.417: D/MessagingNotification(2446): Unread count: 1, 1
11-07 22:42:00.417: D/MessagingNotification(2446): Notify notification complete, can cancel notification now
11-07 22:42:00.427: D/MessagingNotification(2446): deliverNotification
11-07 22:42:00.427: D/MessagingNotification(2446): New message
11-07 22:42:00.427: D/MessagingNotification(2446): RECEIVED_NOTIFICATION_ENABLED> true
11-07 22:42:00.427: D/MessagingNotification(2446): updateNotification>
11-07 22:42:00.437: D/SmsReceiverService(2446): sms notification unlock
11-07 22:42:00.457: D/PhoneRemoteUtil(2446): isSupportPhoneRemote = false
11-07 22:42:00.497: V/CarModeProvider(6806): content://com.htc.AutoMotive/mode
11-07 22:42:00.507: D/MessagingNotification(2446): Charm indicator: 0
11-07 22:42:00.507: D/MessagingNotification(2446): >> enter initiateEffectOfNotification
11-07 22:42:00.507: D/xxxx!!(2446): ringtoneStr= content://media/internal/audio/media/94
11-07 22:42:00.517: V/AudioTrack(2446): setVolume(0.316228, 0.316228), mAudioSession (io) -1
11-07 22:42:00.517: V/AudioTrack(2446): start 0x2688e78
11-07 22:42:00.527: V/AudioTrack(2446): start 0x2688e78 before lock cblk 0x528ac000
11-07 22:42:00.527: D/AudioPolicyManager(105): startOutput() output 3, stream 0, session 19
11-07 22:42:00.527: V/AudioPolicyManagerBase(105): changeRefCount() stream 0, count 1
11-07 22:42:00.527: D/AudioPolicyManager(105): getDeviceForStrategy() from cache strategy 1, device 1
11-07 22:42:00.527: V/AudioPolicyManagerBase(105): getNewDevice() selected device 1
11-07 22:42:00.527: D/AudioPolicyManager(105): getDeviceForStrategy() from cache strategy 1, device 1
11-07 22:42:00.527: V/AudioPolicyManagerBase(105): getNewDevice() selected device 1
11-07 22:42:00.527: D/AudioPolicyManager(105): setOutputDevice() output 3 device 1 delayMs 0
11-07 22:42:00.527: D/AudioPolicyManager(105): setOutputDevice() prevDevice 1
11-07 22:42:00.527: D/AudioPolicyManager(105): setOutputDevice() prevHWDevice 1
11-07 22:42:00.527: D/AudioPolicyManager(105): setOutputDevice() setting same device 1 or null device for output 3
11-07 22:42:00.527: D/AudioPolicyManager(105): linearToSpecifyHtcVolume(volume:100, streamType:0, audio_devices:1)
The rest of the logcat can be found Here
Please have a look and help us it doesn't matter if the notify don't comes when in call, only thing that is important is that it doesn't mute when incall

By the way, Me, Stona175, Lexmazter, fshami and vertigo is trying to fix the bug but cant find a way, (vertigo quit some time ago but it was him that started porting sense 4.0 to sensation xl) maby i forgot somebody, but what i mean is that we are really working hard on finding that bug but everytime we are running into a wall with no solution
to start with the bug also came if somebody calls us when we are in call the speaker also got mute, but that one is fixed now, the thing we have left is the damm muting when reciving a sms when incall
Please help us

Bump. No one that will help us?
Sent from my HTC Sensation XL with Beats Audio X315e using xda premium

anders3408 said:
Bump. No one that will help us?
Sent from my HTC Sensation XL with Beats Audio X315e using xda premium
Click to expand...
Click to collapse
We still needs new eyes on this error please
Sent from my HTC Sensation Z710e using XDA Premium HD app

Dont kno about it... But can contact the dev of the rom u r porting.... Might help u???

This problem is somewhere here, i think
if (mMode == AudioSystem::MODE_IN_CALL) {
switch (device ) {
case SND_DEVICE_HEADSET:
new_aic_rxmode = CALL_DOWNLINK_EMIC_HEADSET;
new_aic_txmode = CALL_UPLINK_EMIC_HEADSET;
break;
case SND_DEVICE_SPEAKER:
case SND_DEVICE_SPEAKER_BACK_MIC:
new_aic_rxmode = CALL_DOWNLINK_IMIC_SPEAKER;
new_aic_txmode = CALL_UPLINK_IMIC_SPEAKER;
break;
case SND_DEVICE_HEADSET_AND_SPEAKER:
case SND_DEVICE_HEADSET_AND_SPEAKER_BACK_MIC:
new_aic_rxmode = RING_HEADSET_SPEAKER;
break;
case SND_DEVICE_NO_MIC_HEADSET:
case SND_DEVICE_NO_MIC_HEADSET_BACK_MIC:
new_aic_rxmode = CALL_DOWNLINK_IMIC_HEADSET;
new_aic_txmode = CALL_UPLINK_IMIC_HEADSET;
break;
case SND_DEVICE_HANDSET:
case SND_DEVICE_HANDSET_BACK_MIC:
new_aic_rxmode = CALL_DOWNLINK_IMIC_RECEIVER;
new_aic_txmode = CALL_UPLINK_IMIC_RECEIVER;
break;
default:
break;
}
} else {
if (checkOutputStandby()) {
if (device == SND_DEVICE_FM_HEADSET) {
new_aic_rxmode = FM_OUT_HEADSET;
new_aic_txmode = FM_IN_HEADSET;
} else if (device == SND_DEVICE_FM_SPEAKER) {
new_aic_rxmode = FM_OUT_SPEAKER;
new_aic_txmode = FM_IN_SPEAKER;
}
} else {
switch (device) {
case SND_DEVICE_HEADSET_AND_SPEAKER:
case SND_DEVICE_HEADSET_AND_SPEAKER_BACK_MIC:
case SND_DEVICE_HEADPHONE_AND_SPEAKER:
new_aic_rxmode = RING_HEADSET_SPEAKER;
break;
case SND_DEVICE_SPEAKER:
case SND_DEVICE_SPEAKER_BACK_MIC:
new_aic_rxmode = PLAYBACK_SPEAKER;
break;
case SND_DEVICE_HANDSET:
case SND_DEVICE_HANDSET_BACK_MIC:
new_aic_rxmode = PLAYBACK_RECEIVER;
break;
case SND_DEVICE_HEADSET:
case SND_DEVICE_NO_MIC_HEADSET:
case SND_DEVICE_NO_MIC_HEADSET_BACK_MIC:
new_aic_rxmode = PLAYBACK_HEADSET;
break;
default:
break;
}
}
Click to expand...
Click to collapse

Keep hope I'll read the log and help u when I get home
Sent from my One V using xda premium

system/etc/audio_policy.conf
and check
system/lib/hw
and tell me your audio. drivers

1ceb0x said:
system/etc/audio_policy.conf
and check
system/lib/hw
and tell me your audio. drivers
Click to expand...
Click to collapse
Thx for your help.
We don't have config for audio_policy.
Our sense 4.1 rom.
Decompiled audio_policy.default.so
AudioPolicyManager.cpp

stona175 said:
Thx for your help.
We don't have config for audio_policy.
Our sense 4.1 rom.
Decompiled audio_policy.default.so
AudioPolicyManager.cpp
Click to expand...
Click to collapse
We have audio_policy.conf in jelly bean ROM.
Code:
#
# Audio policy configuration for generic device builds (goldfish audio HAL - emulator)
#
# Global configuration section: lists input and output devices always present on the device
# as well as the output device selected by default.
# Devices are designated by a string that corresponds to the enum in audio.h
global_configuration {
attached_output_devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE
default_output_device AUDIO_DEVICE_OUT_SPEAKER
attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC
}
# audio hardware module section: contains descriptors for all audio hw modules present on the
# device. Each hw module node is named after the corresponding hw module library base name.
# For instance, "primary" corresponds to audio.primary.<device>.so.
# The "primary" module is mandatory and must include at least one output with
# AUDIO_OUTPUT_FLAG_PRIMARY flag.
# Each module descriptor contains one or more output profile descriptors and zero or more
# input profile descriptors. Each profile lists all the parameters supported by a given output
# or input stream category.
# The "channel_masks", "formats", "devices" and "flags" are specified using strings corresponding
# to enums in audio.h and audio_policy.h. They are concatenated by use of "|" without space or "\n".
audio_hw_modules {
primary {
outputs {
primary {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_AUX_DIGITAL
flags AUDIO_OUTPUT_FLAG_PRIMARY
}
}
inputs {
primary {
sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000
channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO
formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_AMR_NB|AUDIO_FORMAT_EVRC|AUDIO_FORMAT_QCELP
devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_AUX_DIGITAL|AUDIO_DEVICE_IN_VOICE_CALL
}
}
}
a2dp {
outputs {
primary {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_ALL_A2DP
flags AUDIO_OUTPUT_FLAG_PRIMARY
}
}
}
}
Sent from my Sensation XL using XDA Premium HD app

anders3408 said:
We have audio_policy.conf in jelly bean ROM.
Code:
#
# Audio policy configuration for generic device builds (goldfish audio HAL - emulator)
#
# Global configuration section: lists input and output devices always present on the device
# as well as the output device selected by default.
# Devices are designated by a string that corresponds to the enum in audio.h
global_configuration {
attached_output_devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE
default_output_device AUDIO_DEVICE_OUT_SPEAKER
attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC
}
# audio hardware module section: contains descriptors for all audio hw modules present on the
# device. Each hw module node is named after the corresponding hw module library base name.
# For instance, "primary" corresponds to audio.primary.<device>.so.
# The "primary" module is mandatory and must include at least one output with
# AUDIO_OUTPUT_FLAG_PRIMARY flag.
# Each module descriptor contains one or more output profile descriptors and zero or more
# input profile descriptors. Each profile lists all the parameters supported by a given output
# or input stream category.
# The "channel_masks", "formats", "devices" and "flags" are specified using strings corresponding
# to enums in audio.h and audio_policy.h. They are concatenated by use of "|" without space or "\n".
audio_hw_modules {
primary {
outputs {
primary {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_AUX_DIGITAL
flags AUDIO_OUTPUT_FLAG_PRIMARY
}
}
inputs {
primary {
sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000
channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO
formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_AMR_NB|AUDIO_FORMAT_EVRC|AUDIO_FORMAT_QCELP
devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_WIRED_HEADSET|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_AUX_DIGITAL|AUDIO_DEVICE_IN_VOICE_CALL
}
}
}
a2dp {
outputs {
primary {
sampling_rates 44100
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_ALL_A2DP
flags AUDIO_OUTPUT_FLAG_PRIMARY
}
}
}
}
Sent from my Sensation XL using XDA Premium HD app
Click to expand...
Click to collapse
Ye but i'm still on ICS 4.0.4

stona175 said:
Ye but i'm still on ICS 4.0.4
Click to expand...
Click to collapse
yes i know what about using audio files from jb ? or from cm9 ?

anders3408 said:
yes i know what about using audio files from jb ? or from cm9 ?
Click to expand...
Click to collapse
I was thought about it but as i don't have a phone to test some changes i decide to lose it and sxl forum.
I was forgot congratulation a rly good job with Evervolv.:good:

stona175 said:
I was thought about it but as i don't have a phone to test some changes i decide to lose it and sxl forum.
I was forgot congratulation a rly good job with Evervolv.:good:
Click to expand...
Click to collapse
Thanks i hope you get a sxl some day and get back on the device again

Related

Call Log API

Does anyone knows how to read the Call Log DB?
Is there any API to do it?
Examples, links anything....
Tnx good people
just use the CeDatabase calls
fields are:
Code:
#define FIELDID(id, type) ((id)<<16 | (type))
enum DBSYSCALLLOG_FIELDS {
// 1 exists, but use is unknown FIELDID(1, CEVT_I2)
DBSYSCALLLOG_START_FIELD=FIELDID(2, CEVT_FILETIME),
DBSYSCALLLOG_END_FIELD=FIELDID(3, CEVT_FILETIME),
DBSYSCALLLOG_CALLTYPE_FIELD=FIELDID(4, CEVT_I4),
// 5 is not used
DBSYSCALLLOG_NUMBER_FIELD=FIELDID(6, CEVT_LPWSTR),
DBSYSCALLLOG_NAME_FIELD=FIELDID(7, CEVT_LPWSTR),
// 8 is not used
// 9 exists, but use is unknown FIELDID(9, CEVT_I4)
DBSYSCALLLOG_NUMBERTYPE_FIELD=FIELDID(10, CEVT_LPWSTR),
};
enum SysCallType {
SYSCALL_MISSED=4,
SYSCALL_OUTGOING=5,
SYSCALL_INCOMING=6,
SYSCALL_REJECTED=7,
};
you have all SDK for Call API inside of MS PPC2003SDK or Smartphone SDK

Basic Socket Opening

Hey all
I have the following code to open a socket on Windows Mobile 6.1:
Code:
string hostIP = "192.168.0.2";
IPAddress ip = IPAddress.Parse("192.168.0.2");
int port = 80;
IPEndPoint localEP = new IPEndPoint(ip,port);
Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream,ProtocolType.Tcp);
try
{
listener.Bind(localEP); // socket exception here
listener.Listen(15);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
The goal is to simply open a socket, so I can develop on top of this and receive web requests but I receive a socket exception on the line where the bind takes place. Any ideas what might be going on?
maybe the options?
serverIPEndPoint = new IPEndPoint( serverIP, serverPort );
listenerSock = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
listenerSock.SetSocketOption( SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1 );
listenerSock.Bind( serverIPEndPoint );
listenerSock.Listen( 200 );

[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

[DEV] trying to port 2-way record to CM7/9

For the begging,
I found out that the problem for 2-way is on the libaudio.so, than I downloaded the source code from the github of samsung aries.
I found the file AudioHardware.cpp as the main one.
I googled the web and found a same file with 2-way and there is the code which do that
Code:
//wxj add for voice recorder
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdlib.h>
#include <poll.h>
//wxj add end
Code:
//-------------- wxj add for voice recorder ----------------
#if RECORDER_MOMEM
/*
AT^DAUDREC=<ON/OFF>
<ON/OFF> 0 turn off record
1 turn on record
*/
#define MODEM_RECORD_INCALL_ON "at+audr=1\r"
#define MODEM_RECORD_INCALL_OFF "at+audr=0\r"
//define pty device for send at command
#define AUDIO_AT_PATH "/dev/ttymux4"
#define AUDIO_DATA_PATH "/dev/ttymux4"
#define NUM_ELEMS(a) (sizeof (a) / sizeof (a)[0])
static const char * s_finalResponsesError[] = {
"ERROR",
"+CMS ERROR:",
"+CME ERROR:",
};
/**
* returns 1 if line is a final response indicating success
* See 27.007 annex B
* WARNING: NO CARRIER and others are sometimes unsolicited
*/
static const char * s_finalResponsesSuccess[] = {
"OK",
};
static Mutex audioLockMutex;
static int isFinalResponseError(const char *line)
{
size_t i;
for (i = 0 ; i < NUM_ELEMS(s_finalResponsesError) ; i++) {
if (strcasestr(line, s_finalResponsesError[i])) {
return 1;
}
}
return 0;
}
static int isFinalResponseSuccess(const char *line)
{
size_t i;
for (i = 0 ; i < NUM_ELEMS(s_finalResponsesSuccess) ; i++) {
if (strcasestr(line, s_finalResponsesSuccess[i])) {
return 1;
}
}
return 0;
}
/**
* returns 1 if line is a final response, either error or success
* See 27.007 annex B
* WARNING: NO CARRIER and others are sometimes unsolicited
*/
static int isFinalResponse(const char *line)
{
return isFinalResponseSuccess(line) || isFinalResponseError(line);
}
static int s_fd = -1;
static int WriteATCommand(const char *s)
{
AutoMutex lock(audioLockMutex);
//int s_fd = open(AUDIO_AT_PATH,O_RDWR | O_NONBLOCK);
if ( s_fd < 0 ) {
LOGE(" AudioHardware ERROR OPEN AT interface, errno = %d ,s_fd = %d",errno,s_fd);
return -3;
}
size_t cur = 0;
size_t len = strlen(s);
ssize_t written;
LOGV(" AudioHardware AT> %s\n", s);
/* the main string */
while (cur < len) {
do {
written = write (s_fd, s + cur, len - cur);
} while (written < 0 && errno == EINTR);
if (written < 0) {
LOGE("AudioHardware write str error, errno = %d ",errno);
close(s_fd);
s_fd = 0;
return -1;
}
cur += written;
}
#if 0
/* the \r */
do {
written = write (s_fd, "\r" , 1);
} while ((written < 0 && errno == EINTR));
if (written < 0) {
LOGE(" AudioHardware write r error, errno = %d ",errno);
close(s_fd);
s_fd = 0;
return -1;
}
#endif
const int buf_len = 1024;
int readLen = 0, count = 0;
char* buffer = new char[buf_len];
//buffer[0] = '\0';
memset((void*)buffer, 0, buf_len);
bool final = false;
int tryTimes = 0;
int pollResult = 0;
for(;;){
while (0 == pollResult){
struct pollfd fpolls;
fpolls.fd = s_fd;
fpolls.events = POLLIN;
fpolls.revents = 0;
pollResult = poll(&fpolls, 1, 1000); //timeout 5 seconds
//data ready to be read
if (pollResult > 0 && POLLIN == fpolls.revents ){
LOGD(" AudioHardware data is available %d \n",__LINE__);
break;
}else if (pollResult < 0){
LOGD(" AudioHardware pollResult < 0 %d \n",__LINE__);
if (errno == EINTR){
continue;
}else{
break;
}
}else{
LOGE("timeout, but no data available");
if (tryTimes < 5){
tryTimes++;
}else{
LOGE("timeout, exit this command ");
delete []buffer;
close(s_fd);
s_fd = 0;
return -1;
}
}
}
do {
readLen = read (s_fd, buffer + count, buf_len - count);
} while ((readLen < 0 && errno == EINTR));
if (readLen > 0){
count += readLen;
}
if (isFinalResponse(buffer)){
final = true;
LOGD("at result=%s", buffer);
break;
}
tryTimes++;
if (tryTimes > 5){
break;
}
}
LOGV("AudioHardware AT>%s sucess", s);
delete []buffer;
//close(s_fd);
return 0;
}
#endif
//----------------- wxj add end for voice recorder -----------
I don't have linux or other way to compile the files, and I wish someone with more experience from me will compile it and I'm sure we will fine volunteers to test that.
the full cpp files are attached.
By the way, the lib file will be good even to the other ICS roms which based on samsung aries of CM
would be really cool to have that possibilty in more roms, so thx to come up with that and hopefully some dev has the time and knowledge to do this...
sry that i can't help you myself!
greetz,
sUsH
What model does this AudioHardware relate to? If this is related to MSMxxxx audio hardware, probably this will not work in any way. DEAR DEVELOPERS, can you help to continue this work to finally implement this feature? I think that we can start collecting dotations in order to make everybody involved in this project!!
I wish good luck and say THANKS to OP and all people who is able to help in any way!! I hope that this project will not stop and finally we add this so useful feature to our beloving Galaxy.
I'm afraid it does belong to msm, but even if not, there must be a way based on that, for just changing the code.
I can't find the source again but I think it was belong to defy
it IS definitely possible on our sgs, cause i remember some miui-rom i once flashed and used for a while, and with this rom two-way-call-recording was possible, meaning while in call i could just press the record-button and the call (both the caller and me) got recorded.
don't know if it was some dirty hack but it worked, i recorded plenty of calls with this rom. even automatic call recording was possible, so that everytime i got a call, it got recorded automagically.
if this is of interest, i could search for that specific miui-rom in my rom-archive.
greetz,
sUsH
sUsH667 said:
it IS definitely possible on our sgs, cause i remember some miui-rom i once flashed and used for a while, and with this rom two-way-call-recording was possible, meaning while in call i could just press the record-button and the call (both the caller and me) got recorded.
don't know if it was some dirty hack but it worked, i recorded plenty of calls with this rom. even automatic call recording was possible, so that everytime i got a call, it got recorded automagically.
if this is of interest, i could search for that specific miui-rom in my rom-archive.
greetz,
sUsH
Click to expand...
Click to collapse
Afaik, 2 way recording wasn't implemented on cm7/miui like ever. It was illegal and a dirty hack to.
Sent from my GT-I9000 using xda premium
siky_dude said:
It was illegal and a dirty hack to.
Sent from my GT-I9000 using xda premium
Click to expand...
Click to collapse
But remember that not in every country...
hmm, are you sure? i really have that in my mind.
well, i'll look through my rom-history and see which one i think it was, maybe i am wrong...
Rausio said:
But remember that not in every country...
Click to expand...
Click to collapse
Yeah... but if they changed something in the framework to enable recording it would become a upstream change... so everyone living in a legal/illegal country would have this feature... so it was never made as an upstream change.
Still, I never understand people that needed call recording. It's kind of creepy.
Sent from my GT-I9000 using xda premium
siky_dude said:
Yeah... but if they changed something in the framework to enable recording it would become a upstream change... so everyone living in a legal/illegal country would have this feature... so it was never made as an upstream change.
Still, I never understand people that needed call recording. It's kind of creepy.
Sent from my GT-I9000 using xda premium
Click to expand...
Click to collapse
it is legal in every country... the issue in USA is that the recorder partner should tell the other side that the conversation is recorded, for example in Israel, just one side should know that the conversation is under recording, to prevent illegal bugging.
and it's not creepy we should record conversation for a lot of reason, even for people who are on ways all time and want to remember the conversation issue, or even when we argument with the cellular/internet providers.
It was working fine on froyo:
http://forum.xda-developers.com/showthread.php?t=967297
And stayed as project on gingerbread:
http://forum.xda-developers.com/showthread.php?t=1089425
Guys, let's stop offtopic discussing how legal is call recording or not, and also is it useful feature or useless; it is being discussed in other threads many times.
And the project on gingerbread trying to modify existing libraries probably ended with no success after trying all possible things, so we have to follow this way meaning developing the missing code, and i think now it is the only right way.
P.S. Probably this code also relates to call recording:
Code:
#if RECORDER_MOMEM
if(devices == AudioSystem::DEVICE_IN_VOICE_CALL) {
LOGV("set begin recording voice ");
mDevices = devices;
mVoiceRecorderFD = ::open(AUDIO_DATA_PATH,O_RDWR | O_NONBLOCK);
int i = 0;
while(mVoiceRecorderFD < 0) {
i++;
LOGV("AudioStreamInALSA::set i = %d ",i);
usleep(5000);
mVoiceRecorderFD = ::open(AUDIO_DATA_PATH,O_RDWR | O_NONBLOCK);
if(i > 20) {
LOGE(" AudioStreamInALSA::setDevice open muxaudio failure ",i);
return NO_INIT;
}
}
s_fd = mVoiceRecorderFD;
WriteATCommand(MODEM_RECORD_INCALL_ON);
return NO_ERROR;
}
#endif
l2tp, the code you brought here, seems to be related to ALSA (our galaxy) and is not related to the one I brought.
It's seems to be better chance.
Hey guys, did anybody try to do something on this?
Let's not give up!
siky_dude said:
Yeah... but if they changed something in the framework to enable recording it would become a upstream change... so everyone living in a legal/illegal country would have this feature... so it was never made as an upstream change.
Still, I never understand people that needed call recording. It's kind of creepy.
Sent from my GT-I9000 using xda premium
Click to expand...
Click to collapse
Disabling camera shutter sound is also illegal for some countries. But you can disable it on Cyanogenmod settings. It just warns you about legality.
I have the coding skills but not the time to fully do this. I just thought I'd post and offer to assist if anyone wants to lead the project.
Plz do not give up!!
l2tp said:
Hey guys, did anybody try to do something on this?
Let's not give up!
Click to expand...
Click to collapse
I have also been waiting for this ever since I lost the feature after moving from Froyo to GB. :crying: It was a wonderful feature which eradicated the need for keeping a pen and paper ready for long office conference calls, specially when on the road. I was using some automatic recording script with customizable file naming convention and was in bliss!
In terms of legality, please let's keep that out of the equation as already pointed out with the camera shutter analogy. :silly:
The way I saw it, the legality thing was brought into picture by the MIUI 'porting' teams after the Froyo -> GB upgrade and instead of trying to 'fix' it, the questionable legality argument got presented.
Frankly, since the hardware supports it, it is only a question of finding and tweaking the correct sources. I do not have access to a compiler at the moment, but if someone needs help with code-reading/ review, please continue posting here or on pastebin. :fingers-crossed:
+1 this would be awesome!
2 way call recording is very important for me. Still using Darky 9.5 (Froyo) because of that, but I would like to try a GB or ICS ROM if a patch was available.

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

Categories

Resources