' "T610 as a webcam". Copyright (c) 2004 HRS.' this script remotely triggers the camera of the T610,
' transfers the taken picture on the local pc and
' deletes it from the camera.' path and filename of the picture on the camera
Const filename = "/Pictures/Picture(1).jpg"' output directory for the transferred files on the local pc
' terminating backslash required
Const outputdirectory = "c:\Webcam\"Sub OnInit
fma.Debug "OnInit Called"
fma.AddCmd "Take a picture", "OnTakeSinglePicture"
fma.AddCmd "Start Webcam (loop)", "OnStartWebcam"End SubSub OnTakeSinglePicture
Dim cmd
If fma.Connected = 1 Then
TakePicturee
MsgBox "Picture taken and sent"
Else
MsgBox "Not Connected to Phone"
End If
End Sub' ...........................................Sub TakePicturee
Dim cmd
If fma.Connected = 1 Then cmd = "at+clck=""CS"",0" ' Unlock phone
Transmit cmd
cmd = "AT+CKPD="":C""" ' Enter camera mode
Transmit cmd
cmd = "AT+CKPD="":C""" ' Take picture
Transmit cmd ' create filename here to get the (more or less) exact time & date of the picture
outputfile = outputdirectory & LeadZero(Minute (time)) & "-" & LeadZero(Second (time)) & ".jpg" delay (1)
cmd = "AT+CKPD="":C""" ' Save picture
Transmit cmd
delay (4)
cmd = "AT+CKPD="":R""" ' Return to main menu
Transmit cmd fma.ObexGet outputfile, filename
fma.ObexDelete filename
cmd = "AT+CKPD="":R""" ' Return to main menu
Transmit cmdEnd If
End Sub
' ...........................................Sub OnStartWebcam
Dim cmdcmd = "at+clck=""CS"",0" ' Unlock phone
Transmit cmd cmd = "AT+CKPD="":C""" ' Enter camera mode
Transmit cmdIf fma.Connected = 1 Then
While (true)
TakePicture
Wend
Else
MsgBox "Not Connected to Phone"
End If
End Sub
Sub TakePicture
Dim cmd
If fma.Connected = 1 Then cmd = "AT+CKPD="":C""" ' Take picture
Transmit cmd ' create filename here to get the (more or less) exact time & date of the picture
outputfile = outputdirectory & LeadZero(Minute (time)) & "-" & LeadZero(Second (time)) & ".jpg" delay (1)
cmd = "AT+CKPD="":C""" ' Save picture
Transmit cmd
delay (5)
cmd = "AT+CKPD="":R""" ' Return to main menu
Transmit cmd
delay (2) .... (isn't nessessery)
fma.ObexGet outputfile, filename
fma.ObexDelete filenameEnd If
End Sub
Function delay(N) ' delay N seconds
Dim StartTime, EndTime
StartTime = Timer
EndTime = Timer + N
Do
Loop while EndTime > Timer
End FunctionFunction LeadZero(ByVal N)
if (N>=0) and (N<10) then LeadZero = "0" & N else LeadZero = "" & N
End Function' FMA enchancements - DO NOT REMOVE/ALTER THIS FUNCTION!!!
Sub FmaInternalObjectCall(command)
Execute(command)
End Sub' FMA enchancements - DO NOT REMOVE/ALTER THIS FUNCTION!!!
Sub FmaInternalObjectCallEx(command, arguments)
Dim args, param
If IsArray(arguments) And UBound(arguments) > -1 Then
' Generate argument list
args = " "
For Each param In arguments
args = args & """" & param & """" & ", "
Next
' Cut tailing ","
If Right(args, 2) = ", " Then args = Left(args, Len(args) -2)
Else
args = ""
End If
Execute(command & args)
End Sub
' transfers the taken picture on the local pc and
' deletes it from the camera.' path and filename of the picture on the camera
Const filename = "/Pictures/Picture(1).jpg"' output directory for the transferred files on the local pc
' terminating backslash required
Const outputdirectory = "c:\Webcam\"Sub OnInit
fma.Debug "OnInit Called"
fma.AddCmd "Take a picture", "OnTakeSinglePicture"
fma.AddCmd "Start Webcam (loop)", "OnStartWebcam"End SubSub OnTakeSinglePicture
Dim cmd
If fma.Connected = 1 Then
TakePicturee
MsgBox "Picture taken and sent"
Else
MsgBox "Not Connected to Phone"
End If
End Sub' ...........................................Sub TakePicturee
Dim cmd
If fma.Connected = 1 Then cmd = "at+clck=""CS"",0" ' Unlock phone
Transmit cmd
cmd = "AT+CKPD="":C""" ' Enter camera mode
Transmit cmd
cmd = "AT+CKPD="":C""" ' Take picture
Transmit cmd ' create filename here to get the (more or less) exact time & date of the picture
outputfile = outputdirectory & LeadZero(Minute (time)) & "-" & LeadZero(Second (time)) & ".jpg" delay (1)
cmd = "AT+CKPD="":C""" ' Save picture
Transmit cmd
delay (4)
cmd = "AT+CKPD="":R""" ' Return to main menu
Transmit cmd fma.ObexGet outputfile, filename
fma.ObexDelete filename
cmd = "AT+CKPD="":R""" ' Return to main menu
Transmit cmdEnd If
End Sub
' ...........................................Sub OnStartWebcam
Dim cmdcmd = "at+clck=""CS"",0" ' Unlock phone
Transmit cmd cmd = "AT+CKPD="":C""" ' Enter camera mode
Transmit cmdIf fma.Connected = 1 Then
While (true)
TakePicture
Wend
Else
MsgBox "Not Connected to Phone"
End If
End Sub
Sub TakePicture
Dim cmd
If fma.Connected = 1 Then cmd = "AT+CKPD="":C""" ' Take picture
Transmit cmd ' create filename here to get the (more or less) exact time & date of the picture
outputfile = outputdirectory & LeadZero(Minute (time)) & "-" & LeadZero(Second (time)) & ".jpg" delay (1)
cmd = "AT+CKPD="":C""" ' Save picture
Transmit cmd
delay (5)
cmd = "AT+CKPD="":R""" ' Return to main menu
Transmit cmd
delay (2) .... (isn't nessessery)
fma.ObexGet outputfile, filename
fma.ObexDelete filenameEnd If
End Sub
Function delay(N) ' delay N seconds
Dim StartTime, EndTime
StartTime = Timer
EndTime = Timer + N
Do
Loop while EndTime > Timer
End FunctionFunction LeadZero(ByVal N)
if (N>=0) and (N<10) then LeadZero = "0" & N else LeadZero = "" & N
End Function' FMA enchancements - DO NOT REMOVE/ALTER THIS FUNCTION!!!
Sub FmaInternalObjectCall(command)
Execute(command)
End Sub' FMA enchancements - DO NOT REMOVE/ALTER THIS FUNCTION!!!
Sub FmaInternalObjectCallEx(command, arguments)
Dim args, param
If IsArray(arguments) And UBound(arguments) > -1 Then
' Generate argument list
args = " "
For Each param In arguments
args = args & """" & param & """" & ", "
Next
' Cut tailing ","
If Right(args, 2) = ", " Then args = Left(args, Len(args) -2)
Else
args = ""
End If
Execute(command & args)
End Sub
解决方案 »
- 这个功能,我实在是不知道用什么方法来实现!已经找了半个月了,无果,你要是有空的话,就进来指点一二!
- 怎么没显示!
- ClinetDataSet 怎样进行动态排序??
- 字符串问题(大富翁没人理):#$19#$C==>'#$19#$C'
- 我做好了一个exe文件,有什么工具可以将它做成安装盘
- adodataset按给定条件(dblookupcombobox和edit1控件中输入)查询出错?????
- Delphi 中关于数组的问题。
- 有关mousemove
- 请教一个图形缩放问题...
- 有大量的图片好维护,是把他们存到数据库,还是直接放在硬盘目录中。
- Delphi如何入门?
- 打到小日本,支持大罢工(深圳),大去看看
你去找FMA Project,关于T610/618手机的Delphi项目。
begin
fma.Debug('OnInit Called'); //这里不明白,要看看fma.Debug的声明
fma.AddCmd('Take a picture', 'OnTakeSinglePicture');
fma.AddCmd('Start Webcam (loop)', 'OnStartWebcam');
End;procedure OnTakeSinglePicture;
var
cmd: string;
begin
If fma.Connected = 1 Then
begin
TakePicturee;
showmessage('Picture taken and sent');
end
Else
showmessage('Not Connected to Phone');
End;' ...........................................procedure TakePicturee;
var
cmd: string;
begin
If fma.Connected = 1 Then
begin cmd := 'at+clck=''CS'',0'; // Unlock phone
Transmit(cmd); //这个不知道,估计是这样的
cmd := 'AT+CKPD='':C'''; // Enter camera mode
Transmit(cmd);
cmd := 'AT+CKPD='':C'''; //Take picture
Transmit(cmd); // create filename here to get the (more or less) exact time + date of the picture
outputfile = outputdirectory + LeadZero(Minute (time)) + '-' + LeadZero(Second (time)) + '.jpg'; sleep (1000);
cmd := 'AT+CKPD='':C''' ' Save picture
Transmit(cmd);
sleep (4000);
cmd := 'AT+CKPD='':R'''; // Return to main menu
Transmit(cmd); fma.ObexGet(outputfile, filename);
fma.ObexDelete(filename);
cmd := 'AT+CKPD='':R'''; // Return to main menu
Transmit(cmd);End;//if
End;
' ...........................................procedure OnStartWebcam;
var
cmd: string;
begin
cmd := 'at+clck=''CS'',0'; // Unlock phone
Transmit(cmd); cmd := 'AT+CKPD='':C'''; // Enter camera mode
Transmit(cmd);If fma.Connected = 1 Then
begin
While (true)//不知道
TakePicture
Wend
end
Else
showmessage('Not Connected to Phone');End;
procedure TakePicture;
var
cmd: string
begin
If fma.Connected = 1 Then
begin
cmd := 'AT+CKPD='':C'''; // Take picture
Transmit(cmd); // create filename here to get the (more or less) exact time + date of the picture
outputfile := outputdirectory + LeadZero(Minute (time)) + '-' + LeadZero(Second (time)) + '.jpg'; sleep (1000);
cmd := 'AT+CKPD='':C'''; // Save picture
Transmit(cmd);
sleep (5000);
cmd := 'AT+CKPD='':R''' //Return to main menu
Transmit(cmd);
sleep (2000); .... (isn't nessessery)
fma.ObexGet( outputfile, filename);
fma.ObexDelete( filename);End;// If
End;Function LeadZero(var N:integer):string;
if (N>=0) and (N<10) then
result := '0' + inttostr(N)
else
result := '' + inttostr(N);
End;' FMA enchancements - DO NOT REMOVE/ALTER THIS FUNCTION!!!
procedure FmaInternalObjectCall(command: string);
begin
Execute(command);
End;' FMA enchancements - DO NOT REMOVE/ALTER THIS FUNCTION!!!
procedure FmaInternalObjectCallEx(command: string; arguments//不知道什么类型);
var
args: string;
param: integer;
begin
If IsArray(arguments) And (UBound(arguments) > -1) Then
begin
// Generate argument list
args := ' ';
//下面这段不知道
For Each param In arguments
args := args + '''' + param + '''' + ', ';
// Cut tailing ','
If copy(args, length(args)-1, 2) = ', ' Then args = copy(args, 1, Length(args) -2);
end
Else
args = '';
Execute(command + args);
End;