Skip to content

Commit

Permalink
h324m protocol library
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jan 17, 2013
1 parent b8122b3 commit 3bb7fb8
Show file tree
Hide file tree
Showing 75 changed files with 204,185 additions and 0 deletions.
117 changes: 117 additions & 0 deletions 3GPort.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include "h324m.h"



unsigned char env[] =
{
0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00,
0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00,
0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00,
0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00,
0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00,
0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00,
0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00,
0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00,
0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00,
0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00,
0x87, 0xb2, 0x00, 0x00, 0x00, 0x87, 0xb2, 0x00, 0x00, 0x00};


/*
static int myaffiche(unsigned char *buf, int len)
{
int i,m=0;
for(i = 0; i <len; i++){
//printf("%02x ",reverse(buf[i]));
printf("%02x ",buf[i]);
if (m == 15){
printf("\n");
m = 0;
}
else m++;
}
if(len)
printf("\n");
return 0;
}
*/

const unsigned char tmplate[16][20] = {
"AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0 \r\n"
"ATZ \r\n",
"AT&F \r\n",
"AT&C1 \r\n",
"ATE1 \r\n",
"ATQ0 \r\n",
"ATV1 \r\n",
"AT+CMEE=1 \r\n",
"AT+CPBS=\"SM\" \r\n",
"AT+CBST=134,1,0 \r\n",
"AT+CLIP=1 \r\n",
"AT+CLIR=1 \r\n",
"ATS10=10 \r\n",
"ATS0=0 \r\n",
"ATS7=60 \r\n",
"ATS0=1 \r\n",
"ATD0634065160 \r\n", //Compose le numero ici
};




int main(int argc, char *argv[])
{
h324m_session *session;
session = new_session();
FILE *out, *in;
unsigned char buffer[4096];
int *fd, *fdb;
unsigned int m,n,i,k=0;

out =fopen("output.amr","wb");
fprintf(out,"#!AMR\n");
fclose(out);
out = fopen("Received.bin","wb");
in = fopen("Sent.bin","wb");

printf("AMIN RAMTIN, TUNNEL \n");
fd = open("/dev/ttyUSB2",O_RDWR);

for(i = 0; i < 15; i++){
n = write(fd,tmplate[i],strlen(tmplate[i]));
printf("%d: Ecrit %d %s\n",i,n,tmplate[i]);
usleep(50000);
bzero(buffer,256);
n = read(fd,buffer,256);
printf("Lu %d %s\n",n,buffer);
bzero(buffer,256);
}
printf("READY\n");

fdb = open("/dev/ttyUSB0",O_RDWR);

while(1){
n = read(fd,buffer,4096);
k+= n;
h324m_OnReceived(session,buffer,n);
//myaffiche(buffer,n);
fwrite(buffer,1,n,out);
// h324m_TreatPackets(session);
if(session->audiolen)
myaffiche(session->audiobuf, session->audiolen);

if (k >= 160){
k = 0;
h324m_MakePdu(session);
m = write(fdb,session->Output,160);
fwrite(session->Output,1,160,in);
}
}
}



Binary file added 3GPort.o
Binary file not shown.
20 changes: 20 additions & 0 deletions 3gpp2.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "3gpp2", "3gpp2.vcproj", "{48E6238E-167D-4A0C-A1B1-6AC99099D978}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{48E6238E-167D-4A0C-A1B1-6AC99099D978}.Debug|Win32.ActiveCfg = Debug|Win32
{48E6238E-167D-4A0C-A1B1-6AC99099D978}.Debug|Win32.Build.0 = Debug|Win32
{48E6238E-167D-4A0C-A1B1-6AC99099D978}.Release|Win32.ActiveCfg = Release|Win32
{48E6238E-167D-4A0C-A1B1-6AC99099D978}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added 3gpp2.suo
Binary file not shown.
193 changes: 193 additions & 0 deletions 3gpp2.vcproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="3gpp2"
ProjectGUID="{48E6238E-167D-4A0C-A1B1-6AC99099D978}"
RootNamespace="My3gpp2"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@



cfiles: *.c
# cd asn1; make
gcc -g -ggdb -static -c *.c
g++ -g -ggdb -c -static -I ./asn1/ *.cpp
cp *.o ./output/
cd output; make
clean:
make -C asn1 clean
# make -C output clean
rm -rf *.o *.a

Loading

0 comments on commit 3bb7fb8

Please sign in to comment.