PDA

View Full Version : ارتباط با خط تلفن



هانی هاشمی
جمعه 19 بهمن 1386, 15:50 عصر
سلام
می خوام برنامه ای بنویسم که باهاش بتونم از طریق خط تلفن دیتا ارسال کنم به یه کامپیوتر دیگه (یه چیزی تو مایه های هایپر ترمینال)
تو سایت جستجو کردم و به مطالب خوبی رسیدم که با سریال پورت می شه این کارو انجام داد .

بعد از پیدا کردن پورت مودمم (com3) کد زیر رو نوشتم :

if (serialPort.IsOpen == false)
{
serialPort.Open();
serialPort.Write("ATDT 119\r");
}

اما هر کاری می کنم نمی تونه بازش کنه و می گه توسط برنامه ی دیگری در حال استفاده است !!!!!! ریستارت می کمم بازم همین ارور رو می ده :(:عصبانی++::عصبانی++:

از کجا می شه فهمید چه برنامه ای داره ازش استفاده می کنه
ویندوزمم ویستا و رو لپتاپ دارم اجراش می کنم.

ممنونم

raravaice
جمعه 19 بهمن 1386, 16:05 عصر
سلام

هانی عزیز من این احتمال رو میدم که خود برنامت اونو باز نگه میداره چون شما اصلا پورت رو نبستی.

برای شرط یه else هم بزاری بد نیست که اگر باز بود ببندتش.

موفق باشی

هانی هاشمی
جمعه 19 بهمن 1386, 17:11 عصر
بازم همون ارور رو داد


The process cannot access the port 'COM3' because it is being used by another process.

raravaice
جمعه 19 بهمن 1386, 17:29 عصر
سلام

سیستم رو restart کن با hyper terminal برای مودم at بفرست ببین کار میکنه. اگر توی اون کار کنه 100% باید برنامت هم کار کنه.
start > programs > Accessories > Communications > HyperTerminal

"احیانا اگر با dialup آنلاینی اتصالت رو به اینترنت قطع میکنی بعد برنامه رو تست میکنی دیگه"

خبرشو بهم بده

موفق باشی

هانی هاشمی
جمعه 19 بهمن 1386, 18:24 عصر
سلام
بالاخره درست شد :D یه برنامه به نامه FXSSVC بود که از مودم استفاده می کرد (نامرد)

خیلی خیلی لطف کردین جناب raravaice ، (http://barnamenevis.org/forum/member.php?u=37086) شرمنده وفتتون رو گرفتم :خجالت:

موفق باشین :لبخند:

tthenry14plus
شنبه 20 بهمن 1386, 12:55 عصر
ببخشید
من قبلا این سوالو مطرح کردم ولی به نتیجه نهایی نرسیدم:

چطور وقتی تلفن زنگ می زنه می تونم از پورت com3 شماره تلفن خط فرستنده رو بگیرم :

این کدهای هم جواب نمیده :



serialPort.PortName = //port name
serialPort.Open();
serialPort.RtsEnable = true;
serialPort.DiscardNull = true;
serialPort.WriteLine("ATZ" + "\r\n");
serialPort.WriteLine("AT+VCID=1" + "\r\n");

private void serialPort_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
try
{
string s = serialPort.ReadExisting();
if (s.Contains("NMBR"))
{
string[] sArray = s.Split('=');
serialPort.Close();
MessageBox.Show(("با شما تماس گرفته " + sArray[3].ToString().Trim()), "تماس جدید", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}

}

raravaice
شنبه 20 بهمن 1386, 13:03 عصر
tthenry14plus (http://barnamenevis.org/forum/member.php?u=43949) عزیز
پیشنهاد میدم برای سئوالت یه تاپیک جدید باز کنی.

tthenry14plus
سه شنبه 23 بهمن 1386, 23:57 عصر
دوست عزیز قبلا اینکارو کردم ولی به نتیجه نرسیدم

raravaice
چهارشنبه 24 بهمن 1386, 10:22 صبح
سلام

چرا دوست من اگر عنوان تاپیک و محل اونو مناسب انتخاب کنی حتما به جواب میرسی.
این at ها رو توی hyperterminal چک کن ببین اصلا مودمت CLID رو ساپورت میکنه


AT#CID=0 Disable Caller ID
AT#CID=1 Enable Caller ID with formatted presentation
AT#CID=2 Enable Caller ID with unformatted presentationبعد برو این صفحه رو بخون تا اطلاعات کاملی در این زمینه بگیری.
http://www.uktsupport.co.uk/reference/modem.htm

tthenry14plus
پنج شنبه 25 بهمن 1386, 00:41 صبح
دوست عزیز تاپیکی تحت عنوان کالر آی دی تشکیل دادم ببینید بد نیست
مودمم هم کالر آی دیرو پشتیبانی میکنه
راستی لینک هم کار نمیکنه

raravaice
پنج شنبه 25 بهمن 1386, 10:31 صبح
سلام
tthenry14plus (http://barnamenevis.org/forum/member.php?u=43949) عزیز شما اگر میگی پشتیبانی میکنه و اگر شماره رو تونستی توی hyper ببینی پس مشکل حله شما حالا باید یک جوری شمارتو از بین بقیه اطلاعات بکشی بیرون.



راستی لینک هم کار نمیکنه




Basic Modem AT Command Set

Some applications may require a custom modem initialisation string. The AT Command set listed below is for reference only.
Basic AT Commands


A/ Re-execute command
A Go off-hook and attempt to answer a call
B0 Select V.22 connection at 1200 bps
B1 Select Bell 212A connection at 1200 bps
C1 Return OK message
Dn Dial modifier
E0 Turn off command echo
E1 Turn on command echo
F0 Select auto-detect mode (equivalent to N1). (RC144)
F1 Select V.21 or Bell 103. (RC144)
F2 Reserved. (RC144)
F3 Select V.23 line modulation. (RC144)
F4 Select V.22 or Bell 212A 1200 bps line speed. (RC144)
F5 Select V.22 bis line modulation. (RC144)
F6 Select V.32 bis or V.32 4800 line modulation. (RC144)
F7 Select V.32 bis 7200 line modulation. (RC144)
F8 Select V.32 bis or V.32 9600 line modulation. (RC144)
F9 Select V.32 bis 12000 line modulation. (RC144)
F10 Select V.32 bis 14400 line modulation. (RC144)
H0 Initiate a hang-up sequence
H1 If on-hook, go off-hook and enter command mode
I0 Report product code
I1 Report pre-computed checksum
I2 Report OK
I3 Report firmware revision, model, and interface type
I4 Report response programmed by an OEM
I5 Report the country code parameter
I6 Report modem data pump model and code revision
I7 Reports the DAA code (W-class models only)
L0 Set low speaker volume
L1 Set low speaker volume
L2 Set medium speaker volume
L3 Set high speaker volume
M0 Turn speaker off
M1 Turn speaker on during handshaking and turn speaker off while receiving carrier
M2 Turn speaker on during handshaking and while receiving carrier
M3 Turn speaker off during dialling/receiving carrier and turn speaker on during answering
N0 Turn off automode detection
N1 Turn on automode detection
O0 Go on-line
P Force pulse dialling
Q0 Allow result codes to DTE
Q1 Inhibit result codes to DTE
Sn Select S-Register as default
Sn? Return the value of S-Register n
=v Set default S-Register to value v
? Return the value of default S-Register
T Force DTMF dialling
V0 Report short form (terse) result codes
V1 Report long form (verbose) result codes
W0 Report DTE speed in EC mode
W1 Report line speed, EC protocol and DTE speed
W2 Report DCE speed in EC mode
X0 Report basic call progress result codes
X1 Report basic call progress result codes and connections speeds
X2 Report basic call progress result codes and connections speeds
X3 Report basic call progress result codes and connection rate
X4 Report all call progress result codes and connection rate
Y0 Disable long space disconnect before on-hook
Y1 Enable long space disconnect before on-hook
Z0 Restore stored profile 0 after warm reset
Z1 Restore stored profile 1 after warm reset
&C0 Force RLSD active regardless of the carrier state
&C1 Allow RLSD to follow the carrier state
&D0 Interpret DTR ON-to-OFF transition per &Qn: 0,5,6 Ignores DTR. 1,2,3,4 Hangs up
&D1 Interpret DTR ON-to-OFF transition per &Qn: 0,1,4,5,6 Asynchronous escape. 2,3 Hangs up
&D2 Interpret DTR ON-to-OFF transition per &Qn: &Q0 through &Q6 The modem hangs up
&D3 Interpret DTR ON-to-OFF transition per &Qn: 0,1,4,5,6 Performs soft reset. 2,3 Hangs up
&F0 Restore factory configuration 0
&F1 Restore factory configuration 1
&G0 Disable guard tone
&G1 Disable guard tone
&G2 Enable 1800 Hz guard tone
&J0 Set S-Register response only for compatibility
&J1 Set S-Register response only for compatibility
&K0 Disable DTE/DCE flow control
&K3 Enable RTS/CTS DTE/DCE flow control
&K4 Enable XON/XOFF DTE/DCE flow control
&K5 Enable transparent XON/XOFF flow control
&K6 Enable both RTS/CTS and XON/XOFF flow control
&L0 Select dial up line operation
&M0 Select direct asynchronous mode
&P0 Set 10 pps pulse dial with 39%/61% make/break
&P1 Set 10 pps pulse dial with 33%/67% make/break
&P2 Set 20 pps pulse dial with 39%/61% make/break
&P3 Set 20 pps pulse dial with 33%/67% make/break
&Q0 Select direct asynchronous mode
&Q4 Select Hayes AutoSync mode
&Q5 Modem negotiates an error corrected link
&Q6 Select asynchronous operation in normal mode
&R0 CTS tracks RTS (async) or acts per V.25 (sync)
&R1 CTS is always active
&S0 DSR is always active
&S1 DSR acts per V.25
&T0 Terminate any test in progress
&T1 Initiate local analog loopback
&T4 Allow remote digital loopback
&T5 Disallow remote digital loopback request
&V Display current configurations
&W0 Store the active profile in NVRAM profile 0
&W1 Store the active profile in NVRAM profile 1
&X0 Select internal timing for the transmit clock
&X1 Select external timing for the transmit clock
&X2 Select slave receive timing for the transmit clock
&Y0 Recall stored profile 0 upon power up
&Y1 Recall stored profile 1 upon power up
&Zn=x Store dial string x (to 34) to location n (0 to 3)
%E0 Disable line quality monitor and auto retrain
%E1 Enable line quality monitor and auto retrain
%E2 Enable line quality monitor and fallback/fall forward
\Kn Controls break handling during three states:
When modem receives a break from the DTE
\K0,2,4 Enter on-line command mode, no break sent to the remote modem
\K1 Clear buffers and send break to remote modem
\K3 Send break to remote modem immediately
\K5 Send break to remote modem in sequence with transmitted data
When modem receives \B in online command state:
\K0,1 Clear buffers and send break to remote modem
\K2,3 Send break to remote modem immediately
\K4,5 Send break to remote modem in sequence with transmitted data
When modem receives break from the remote modem:
\K0,1 Clear data buffers and send break to DTE
\K2,3 Send a break immediately to DTE
\K4,5 Send a break with received data to the DTE

\N0 Select normal speed buffered mode
\N1 Select direct mode
\N2 Select reliable link mode
\N3 Select auto reliable mode
\N4 Force LAPM mode
\N5 Force MNP mode
\V0 Connect messages are controlled by the command settings X, W, and S95
\V1 Connect messages are displayed in the single line format
+H0 Disable RPI
+H1 Enable RPI and set DTE speed to 19200 bps
+H2 Enable RPI and set DTE speed to 38400 bps
+H3 Enable RPI and set DTE speed to 57600 bps
+H11 Enable RPI+ mode
-SDR=0 Disable Distinctive Ring
-SDR=1 Enable Distinctive Ring Type 1
-SDR=2 Enable Distinctive Ring Type 2
-SDR=3 Enable Distinctive Ring Type 1 and 2
-SDR=4 Enable Distinctive Ring Type 3
-SDR=5 Enable Distinctive Ring Type 1 and 3
-SDR=6 Enable Distinctive Ring Type 2 and 3
-SDR=7 Enable Distinctive Ring Type 1, 2, and 3
-SSE=0 Disable DSVD
-SSE=1 Enable DSVD * Serial interface operation only
ECC Commands


%C0 Disable data compression
%C1 Enable MNP 5 data compression
%C2 Enable V.42 bis data compression
%C3 Enable both V.42 bis and MNP 5 compression
\A0 Set maximum block size in MNP to 64
\A1 Set maximum block size in MNP to 128
\A2 Set maximum block size in MNP to 192
\A3 Set maximum block size in MNP to 256
\Bn Send break of n x 100 ms MNP 10 Commands


-K0 Disable MNP 10 extended services
-K1 Enable MNP 10 extended services
-K2 Enable MNP 10 extended services detection only
-SEC=0 Disable MNP10-EC
-SEC=1,[] Enable MNP10-EC and set transmit level 0 to 30
(0dBm to -30dBm) W-Class Commands


*B Display list of permanently blacklisted numbers
*D Display list of delayed numbers Caller ID Commands


#CID=0 Disable Caller ID
#CID=1 Enable Caller ID with formatted presentation
#CID=2 Enable Caller ID with unformatted presentation Fax Class 1 Commands


+FCLASS=n Service class
+FAE=n Data/fax auto answer Fax Class 2 Commands


+FCLASS=n Service class
+FAA=n Adaptive answer
+FCLASS= Service class
+FCR= Capability to receive
+FDCC= DCE capabilities parameters
+FDIS= Current sessions parameters
+FPTS= Page transfer status
+FREV? Identify revision Voice/Audio Commands


#MDL? Identify model
#MFR? Identify manufacturer
#REV? Identify revision level

saeen
جمعه 26 بهمن 1386, 11:45 صبح
سلام
ببخشید من فرمانهای AT را توی کدوم قسمت Hyper Terminal باید وارد و اجرا کنم
اگه ممکنه یه کم در مورد اجرای فرامین AT توضیح بدین
ممنون

raravaice
جمعه 26 بهمن 1386, 12:52 عصر
saeen (http://barnamenevis.org/forum/member.php?u=10314) عزیز

از این به بعد سئوالات رو توی یه تاپیک جدید اعلام کن دوست من.

بعد از اینکه به hyper terminal وصل شدی و مودم خودت رو معرفی کردی توی صفحه سفیدی که توی برنامه هست فرامین رو بنویس و برای هر کدوم یه enter بزن البته فرامین در حالت عادی نشون داده نمیشه اول ولی عمل میکنه یه atz برای شروع بزن تا فرامین هم بهت نشون بده که چی داری تایپ میکنی.

موفق باشی

aminM#
چهارشنبه 26 فروردین 1388, 12:11 عصر
من تا یه جایی جلو رفتم یعنی ارتباط رو برقرار میکنم ولی به محض اینکه می خوام یه داده ارسال کنم بهم پیغام می ده No Carrier Mode و بعد تماس قطع میشه چرا؟

NewFoxStudent
چهارشنبه 26 فروردین 1388, 12:24 عصر
باید با دستور مربوطه که الان متاسفانه یادم نیست تماس رو به مد انتقال دیتا تبدیل کنی
مدل مودم رو بگو تا دستورش رو پیدا کنم

aminM#
چهارشنبه 26 فروردین 1388, 12:32 عصر
با تشکر از توجه سریع شما

zoltrix و اگه برای من یه نمونشو پیدا کنی برای نمونه های دیگش می تونم مشکل رو حل کنم

NewFoxStudent
چهارشنبه 26 فروردین 1388, 12:39 عصر
این لینکش دستورش رو میتونی از اینجا پیدا کنی
http://www.zoltrix.com/SUPPORT_HTML/modem/USEMODEM.HTM

NewFoxStudent
چهارشنبه 26 فروردین 1388, 12:40 عصر
فکر میکنم دستورشم این باشه



ATO <Enter>


در هرصورت تو لینک بالا توضیحات کامل هست

Mrs.Net
یک شنبه 15 شهریور 1388, 22:38 عصر
من با serialport بین دوتا دستگاه ارتباط برقرار کردم
و تونستم کاراکتر انتقال بدم
حالا میخوام با تلفن به کامپیوتر وصل بشم و بعد از برقراری ارتباط تلفن عددی رو بزنه و من بفهمم
از بعد از جواب دادن به تماس راهنماییم کنید باید چه تنظیماتی انجام بدم